# Difference in motor speed

I have build a robot out of old LEGO bricks, since my gearbox and tank tracks haven't arrived yet. I have used the standard one-motor-per-wheel-in-the-front-and-one-small-wheel-in-the-back-design. My problem is, that the two motors aren't running with the same speed, so my 'bot is turning to the right all the time. I have considered putting a resistor on the fast motor to make it slower, but would like to ask, if any of you have any other solution to this problem? The best solution would be some sort of sensor on the motor to tell the speed and let the CPU adjust the speed.

## Comment viewing options

This allways happens to robots with that design.

My approach is never to rely on the robot drive in a straight line.

Even if you do manage to make them equal, next thing is a bump on the road, and you are back to square one.

You could also begin counting how many spins pr wheel, but then again you are knocked out if one wheel is spinning a little for one reason or another.

So this is typical to the approach I prefer; Say your purpose is to track another object. Well, then focus on tracking that. Nomatter if your wheels are uneven, if the object moves, if one wheel is stuck etc etc, the bastard will try to follow that object no matter what.

Think of it as Terminator one, the movie; One goal, no matter what else happens. Don´t think of it as a train where you plan the next station before departure.

Constant focus on the goal, constant ajustments. Then you should be able to deliberatly hinder one wheel, and the darn thing still just wants to go the right direction.

See the Line Follower - film here: http://letsmakerobots.com/node/37 (Better videos are on the way for this site) At one point I stick out my foot to stop the one side of the robot, that does not make the thing turn. When I remove my foot, it godes same direction. I am sure that if I just "turned on both weels, that robot would go in circles, just like yours.

/ Frits

Yes this is a very annoying problem when using differential steering on robots but it can be solved by adding encoders to each wheel (these are sensors that can sense if the wheel is rotating and which way they are rotating) and then using some form of regulation on the motor outputs based on the encoder inputs. PID-regulation is very useful in this situation and depending on how good resolution you have on the encoders (i.e. how small change in rotation can they detect) you can make your robot go almost in a straight line. Encoders can also be used for measuring robot speed, direction and regulating the speed to some desired value. They are VERY nice to have onboard.

LEGO NXT motors have encoders built in to them but if you're using old 9V mini motors (those grey cubish ones) then you need additional sensors - either the LEGO rotation sensors (which are a bit tedious to power and measure) or just use a photo interrupter scheme like most computer mice use for their wheel (and old non-optical ones use for movement). I can elaborate on these subjects if necessary.

Another solution is to make another LEGO design that can eliminate the problem. Try looking at this "adder subtracter" design:

http://staff.science.uva.nl/~leo/lego/diff.html

I've made a design based on the adder subtractor idea that also enables gear shifting:

http://iloblog.defiant.dk/robocup2007?Home&post=10

but I guess it's not that easy to get the idea from that one picture I have of it.

- Jimmy

This might be what I need. Can I have a copy of your LeoCAD file please? I would like to study it further. I'll try to build an add/sub from the abstract idea to see if I can make it work.

Strange I can't seem to attach files to this comment... anyway you can get it from here:

http://defiant.dk/files/nyeste_robot.lcd

- Jimmy

(We are getting into the file attachement-issue in comments etc)

/ Frits

Ahaaa.. This is fun!

But.. I must ask; Who the phuck wants to go in a straight line so desperatly? Why on earth? You should use other tools than robots to make straight lines!

The purpose is to go from A to B, right? Well go to B then. With that aproach you are Ok even if the road is bumby, B changes etc.

If the purpose REALLy is to go in a straight line, I would simply set up a laser and follow that :D

But this is funny, and as said, I respect your way of thinking, just dont see the drive in it.. Hurray, I have made a robot that drives in a straight line!! More fun for me is; Hurray, I have made a robot that tracks down my cat!

/ Frits

Actually there are some robot competitions where you have to be able to go in a straight line and find your way back to where you started (without being allowed to attach lasers and death stars to the competition) :-).

Of course you have to consider if driving in a straight line is really necessary to achieve the goal. Your answer was dead on with that point :-).

- Jimmy

Hmmm.. A competition where you have to be able to go in a straight line and find your way back to where you started.. Is the floor plain? I would attach 2 optical mice.. No - I would make a vehicle with no diferential steering and large flat-shaped tires, and when it should turn, I would lift up the whole thing on a servo, and turn it precisely, and go back!

Perhaps!

/ Frits

The purpose of building the robot was to get something up and running fast. This revealed a problem and problems needs solving. The purpose for me, now, is not trying to make a robot go straight, because robots going straight is fun, but to see if the problem can be solved.

My robot has some switches on the front that will trigger if the robot runs into anything. That's not much fun either, because it's a 1 minute programming exercise, but since the switches did not always trigger, I will see if I can make it work, just for the purpose of solving the problem and to learn something about mechanics, that might come in handy later.

/jesper

Got you, of course, sorry.

My mind was somewhere else in robo-land :)

/ Frits