Turning too much

So the robot I built is a two-wheeler, well three-wheeler, its got one small rotating wheel on the back. It uses an ultrasonic sensor to measure distance. My problem is that I'm having hard time making him go straight. Neither of the two DC motor driven wheels is more powerful than the other, they rotate at the same speed, and I programed them to do so. But when the robot gets to a wall for instance, and it turns around, it sorta keeps going in a curve, it doesn't straighten up, it keeps going forward but if it turned left at the wall now it'll keep moving slightly in an ark to the left, and if it turned right it'll keep going slightly to the right. It only goes straight when I first put it on the ground, but even if one of the wheels makes a slight bump it'll start going in a turn, as if one of the wheels is getting less power.

Not having any gyrometers, accelerometers or magnetometers on board, I was wondering if this can be corrected by some programming or maybe a different design? 

Given your budget,

have you considered trying to find some junked ball mice? They will likely have rotary encoders. It will take a bit of engineering to incorporate them into your current design, but, what would you learn if it was easy. :stuck_out_tongue:

What if I used stepper

What if I used stepper motors instead of DC ones? I never tried anything with steppers. Would I need encoders or some kind of meters then?

I actually found an old ball

I actually found an old ball mice, well the PCB from it. I disassembled the mouse some time ago to repair another one. It has three optosensors. Now I just need to figure out how to use them. The wheels on my robots have these small wheels on the other end of the axis with holes in them, which I pressume was made precisely with the intention of using some kind of optosensors.

I have a link to video that might help explain the encoder

programming. https://www.youtube.com/watch?v=39Zzx7RHsR4

CtC is talking about Hall effect sensor, but, the programming should be similar.