Help with building a vehicle

Hey, I made a thread earlier, but I figured I'd post again since it's not quite the same as the last one.

I need to build a vehicle that travels any straight line distance between 5 and 10 meters on a surface indoors, most likely a gym floor. I need to get the distance it travels accurate to the millimeter. I can't do anything to the floor that would make it stop. People mentioned using a light sensor at the end of the path traveled to make it stop, which I couldn't do since it would require putting something on the ground to stop the vehicle. Others mentioned using a laser from an optical mouse to measure distance traveled which would stop the vehicle, which might work, but I was warned that wouldn't be as accurate as I would hope.

I was thinking that I would end up doing it by setting the motors on the wheels to spin w/e degrees that would make it go to the specific distance using the circumference of the wheels. Would that not be a likely option?

I'm relatively new to the idea of building a vehicle, so I don't know much about wheels or motors. People mentioned using stepper motors. Not sure about the wheels.

Also, I thought of using Arduino based on how it seems like there'd be a lot of information to help me along with this, and it also seems like a good choice in general. If anyone thinks that Arduino would be the wrong board to use for this sort of project, please do let me know (though that seems unlikely since this is an arduino forum :smiley: )

Any help would be appreciated

I seriously doubt that you can get 1mm presision by using the circumference of the wheels.

First you would have to meassurethe circumference extreamly precisely, even the smallest error would add up to more than 1mm after a few rotations. Then you would have to be absolutely sure that there will be no wheel slip what so ever while roling over the floor. There will almost always be some slipping especially when starting and stopping.

Then there's the issue of straight line travel. To travel in a straight line and end up with 1mm precision would require that the "pull" on all the wheels is exactly the same, which is verydifficult to achieve.

Sorry to sound so negative :slight_smile: but i really cant see how to do this without putting something on the floor, even with something on the floor it would be seriously difficult.

This is a tricky problem.

How will you know how far the vehicle will have to travel? Do you dial in, say 7.250 push go and the vehicle has to go that far?

Is the vehicle allowed any external help? Or does it have to work out the distance on its own?

Does the vehicle have to go the distance in a specific time?

How close to straight is straight?

I think you could measure the distance with the wheels. The problem MikMo raises about the wheels is valid. However, if you were to make wheels accurately out of something like aluminium and put the thinest of thin "tyres" on them (I'm thinkking of stretching a balloon over the wheels to form tyres). Then calibrate the wheel by measuing revolutions over, say, 10 metres. I'm envisage wheels with a 6 inch diameter.

Steppers would seem an obvious choice, but when they step then can cause wheels to slip slightly. There are algorithms for driving the stepper coils with half steps and quarter steps to reduce this and this may be enough to reduce the wheel slips. Certainly if you use a stepper you should use a gearbox and a encoder as with a dc motor.

I would be tempted to try driving the wheels with an ordinary dc motor though a good gearbox. Have the motor running at a slow, but steady speed and the vehicle running dead slow. In order to minimise slip, you might want to control the start up speed by ramping it in a controlled manner.

As for measuring the distance. IF you get good wheels, and a good gearbox, I would put a rotary ancoder on the motor side of the gearbox.

Even with a modest encoder you could get thousands od pulses per revolution, more than enough to measure to 1mm.

The trouble of keeping a straight line maybe covered by the accuracy of the manufacture of the wheels. Its hard to tell without the spec on straight line, or the floor surface.

Anyway, these are my thoughts - I'm sure others will throw in their's.


Am I correct in assuming this is for some sort of competition? If it is, it may be useful to post the rule-set that are your guidelines. I have found that by careful study of the rules, a creative solution often surfaces.

That being said, an idea occurred to me about how to reduce some of the issues raised on this thread about wheel slippage. A wheel connected to a motor will slip because there are multiple forces acting upon the wheel, namely gravity, and the torque of the motor applied to the wheel. When the torque overcomes the friction that is acting on the wheel from gravity, your wheel will slip. So... What if you had a freewheel that was more-or-less pulled along with no motor torque applied. As long as there was enough force to keep this on the ground, it would only turn as long as the vehicle was making forward progress. If you were to attach an encoder of some sort to THIS wheel you could remove some worry about slippage.

Think: like one of those distance tools used by land surveyors, on a small scale.

good luck!

I agree about the competition rules - often they will guide you as well.

Salernos, I like the idea of a trailing wheel, but it has a disadvantage: 1mm accuracy is a very small turn of the wheel which would require a means of measuring small angular turns of the wheel.

One advantage of using a gearbox and having an encoder on the motor side of the box is that you get many more pulses for the same distance moved on the floor.

Not ruling out your idea, just raising a point about it.



Ahh... very good point Mike.
I still think with a little finesse you could get this to work.

It will be interesting to see what the actual application for this vehicle is if the rules ever get posted!

I still think with a little finesse you could get this to work.

I’m sure you’re right.

One thing I was thinking about, which the OP may have alluded to, is the use of the innards of a no-moving-parts optical mouse (or creating a system based on the idea).

The system works by repeatedly taking images of the surface and comparing one to another and determining how far the image has moved.

Mouse innards may not be sensitive enough, but the innards of a digital camera even at 1 mega pixels may be. I would be concerned with the cummulative error, though.

It will be interesting to see what the actual application for this vehicle is if the rules ever get posted!



Another thought I had, which is probably not a go-er, but is worth throwing in the pot is the use of an electronic tape measure.

You can get them in DIY shops for $25, (but they may not have the accuracy as they are based on ultrasonics), but there are these:

Laser range finder

which claim a 1mm accuracy.

Whether you can get at the reading electronically is another matter.


I think the purpose of this exercise is to get you thinking, and experimenting :slight_smile:

Though it would be kind of cool to modify an old ball mouse (ps2 or serial, both are easy to interface with arduino) with a solid axle and a couple drive wheels (front wheel drive of course), and an atmega128 :slight_smile: Most mice can do hundreds of counts per inch, and you only need 25.4 to measure a millimeter.

I might put the buttons on the back and figure out how to program the distance with them. It would be neat if the whole thing, except drive wheels, fit in the original mouse housing, but do some experiments first certainly.

more mouse stuff.

The idea with the ball mouse seems really cool. I'd have to rip it up to see how exactly that might work out.

I think I should buy an arduino soon and just play around with it (and get familiar with a lot of the things you guys are talking about...I don't know what gearboxes or encoders are. I'm guessing drive wheels would be whatever set of wheels are being driven by a motor. I guess I am very new to this stuff.

I was thinking I should buy an Arduino Starter Pack from Adafruit to get started, unless anyone thinks I should go a different route first.

And I apologize for not getting the rules down yet. Let me post those now.


-Vehicle designed to travel between 5 to 10 meters and come to a complete stop without straying from the center of the track. Exact travel distance to 1cm set at competition, not beforehand (so its random).
-Has to use max 4 batteries 1.5 v each or less, or 1 battery pack of 4.8 volts or less (kind of worried about this part)
-Sighting devices that do not use electricity are allowed, electrical sighting devices, like lasers, are prohibited (damn). All sighting devices must be permanently attached in a fixed position and travel with the vehicle
-wheel base (distance between front and rear axles measured parallel to the direction of travel on the track) must be between 28-32 cm, distance from outermost sides of left and right tires must not exceed 20cm
-Must have a stationary, pointed object extending forward of all other parts of the vehicle, including the wheels, within 1 cm of the track's surface, used as a reference point for vehicle's distance measurements (could be a toothpick)
-The braking system can't touch the ground

-Smooth, hard, level track
-One-inch tape used to define track's center, starting line, and target distance.

Competition stuff:
-Vehicle has to be set to travel the specified distance at a predicted time (by contestants) of 45 seconds or less. In the most difficult level of the competition, the time will be set by the judge to be between 1.5 and 4 seconds per meter at increments of .1 seconds and the vehicle has to be set to go the target distance in the set time as closely as possible.
-You're given 10 minutes to do 2 trials for the distance specified. You can make w/e adjustments to the vehicle during the time.
-You can't touch the vehicle to start it, you have to hit a switch with a pencil or dowel rod or something.


I think you have the right idea. Pick up the starter pack and start trying stuff out! All the forum posts in the world can’t replace trial and error.

As far as your vehicle is concerned, is it just something for you to try out ideas with, or is there some other goal in mind?
Good luck, and don’t be shy about posting on this forum, I have just started posting here and everyone has been real great.


salernos: It's a competition. I just edited the post above yours with rules.

Thanks for the advice and encouragement. I think I'll pick up the starter pack soon. I'm not sure if I need to order the motor shield just yet, but I probably do...

It seems from the rules that they are setting you up to make a line following robot. This website and forum have lots of examples to help you out.

It appears from the rules that there is a center tape mark that stretches to the end distance. So if you have a guidance system that is always keeping an eye on the tape mark, you can simply stop when you reach the end of the tape. This would be a good first goal.


Remember, they made optical PS/2 mice too. You can interface PS/2 with the Arduino, and read the incremental movements sent by the mouse. If it’s OK to have the mouse basically dragging on the floor, it would work without modification; otherwise, you’d have to figure out an optical solution to focus on the floor from a longer distance.

800 DPI seems to be a pretty common resolution. I don’t think you could accurately get direction tracking with the mouse’s other axis, but if you used two mice you could keep the vehicle moving in a straight line. :slight_smile:

As stated in the rules, electrical sighting devices, like lasers, aren't allowed. I assume that includes lasers used in optical mice.

But, the balls in PS/2 mouses seem like they'd be okay....Like if I could rig the the mouse ball to sit in the axle that's being driven, and have that measure distance traveled, then that would work. Anyone think I could just drill a hole through the mouse and shove the axle through the hole, and through the mouse ball as well? So, when the vehicle moves forward, the mouse ball is turned, registering movement, and use that to measure distance traveled and just set the vehicle to travel a set distance and let it go? In this scheme, could I just use a simple DC Motor to drive the vehicle? Could I just rip motors out of a floppy drive? Since speed isn't an issue I could just make it go relatively slow to minimize any possible slipping.

Or, as was done here, I could just use the internals of the mouse minus the rubber ball and using elastic rubber bands have the wheel on the mouse as well, but i'm not positive:

Also, should I be worried about the batteries? It said 4 1.5v cells or 1 4.8 volt cell. That kinda scares me...isn't that a bit low for powering both the Arduino and motors?

How are you supposed to detect the tape without some kind of optical sensor? I think you need to get some clarification of the this just a dead reckoning contest? In that case, you shouldn't be worried. It's 1 CM, not 1 MM as you said before, so it'll be easy.

Not to be negative... But if this is a school related competition asking a forum how to do it isn't very... you know.

On the otherside of things I will share some input :wink:

  1. I must point out that the rules are kinda funny. They state that the breaking system can't touch the ground, so you could always win by disqualifying all of your oponents who use their wheels to break, and you can use a fan driven system... or something.

  2. So because the rulse state 1cm resolution not 1mm. I think you could go with the first suggestion given: using continous rotation servos and coutning the pulses. Use high friction wheels from towerhobbies and calibrate the system a few times. I don't think slip will be an issue.

3)In my eyes, line following with no electronic imaging allowed is impossible. The only way to detect a line, which is a different color from the floor is with imaging, the only way to use image information in this sceanario uses electricity... Because of this I think they line is there just for judging. *Any sort of light sensor is an imaging device.

Well it says except wheels for the braking system.

And sorry I'm not trying to be shady about this. I'm not really looking for EXACT instructions or anything. I just want to make sure I don't start out in the wrong direction or something.

It's 1 cm intervals, so then you'd want to be as close as u can to the cm, so I'd be looking at mm accuracy. Would the servos be fine for that?

It's not line following. It's goes on a track that's been set up.

I'd like more feedback on the PS/2 mouse idea, using the mouse to measure distance traveled. Then I could just the car stop once it reaches the target distance, right? It seems like it'd be pretty accurate but I don't know what kind of motor I should be using. And...would having the motor stop, stop the vehicle?

I found this gearbox but I have no clue whether this is any good or not:

I guess it uses DC motors, but is that not recommended for my method? I shouldn't have to do things like count pulses. I just have to be able to control speed and the distance traveled, which ideally would be measured by the PS/2 mouse and the vehicle would stop upon reaching the set distance.

If it would help with avoiding wheel slipping, I could use tank treads...:

Since I'm pretty n00b, if someone could explain gearboxes and encoders I would appreciate it very much.

I'm still worried about power as well. I'm not sure how I'd do since Arduino uses 5V and the gearbox uses 3V. Also wouldn't I need to use something like the motor shield on adafruit? The limit is 4 1.5V cells or 1 4.8V cell

So using a ball mouse is kinda the same thing as reading an encoder on the wheel or on the gearbox.

Smash a ball mouse open and you will see that there is a wheel which turns as the ball rolls, this wheel has holes in it, and a laser is shot through the holes, so as the wheel turns it counts how many times the laser is "broken" and translates this into distance.

There really isn't a point of using a ball mouse, it would probably make things more inaccurate if anything. You should just be using an encoder on one of the gears in the gear box or even easier just sending in set number of pulses to a servo.

For instance, lets say you need to move 7 meters, you would have some pots attached to your Arduino and you would move these so that it means 7 meters.(this can be accomplished a few ways) The Arduino would then use a equation you would determine and go... Ok 7 meters that's equal to 7000 pulses to the servo. and then it would execute 7000 pulses.

As far as keeping everything straight... That's where quality building comes in.

I see...but would I be able to get accuracy down to millimeters with servo pulses? Would I even be able to get such accuracy with the gearbox with an encoder.

But since an encoder would use IR, then I don't think I can use it because it would probably count as a sighting device.

But, as I asked earlier, since Servos take 4.8V to power from what I've read, then won't I be screwed for powering the Arduino?

Or would I just power the Servos through the Arduino?

And I would have to modify the servo to rotate continuously right?