Cheap Odometry for Your Wheeled Robot!

by Monoclecat in Circuits > Robots

6864 Views, 14 Favorites, 0 Comments

Cheap Odometry for Your Wheeled Robot!

P1020644.JPG
For the past year I have been building a large wheeled robot, and I wanted to implement odometry into it.
But I didn't want to spend much money on it so I found a DIY way.
In this Instructable I will show you a low-budget (but also low accuracy) method of odometry using an encoder disk, infrared LEDs and phototransistors.

What is odometry?
Here's the Wikipedia definition: "Odometry is the use of data from moving sensors to estimate change in position over time. Odometry is used by some robots, whether they be legged or wheeled, to estimate (not determine) their position relative to a starting location."

Why implement it?
If your robot has two driving wheels which are each attached to a motor, you'll certainly have issues with one wheel turning faster than the other one, especially when you are using low-price motors.
This results in the robot not driving perfectly straight which can be a real pain.
Implementing odometry, you can not only make your robot drive straight, but also measure how far it drove.

What You Need

disc.jpg
For this Instructable you need:

For the encoder disks:
- cutable plastic or wood thicker than 1/8 inch (~4mm)
- ruler
- tape
- a bandsaw or hacksaw
- ~1/4 inch bolt, nut and washers
- scaled and printed image of the encoder disk template (in pictures below)
- optional but useful: black (spray)paint

For the circuits:
- perfboard and wire
- double sided mounting tape
- IR LED
- resistor for LED (mine was 100 ohms)
- photodiode (better if it is a IR photodiode)
- Lm339 comparator ic
- 25k ohm potentiometers
- 1M ohm resistors
- 100 ohm resistors
- 4.7k ohm resistors
- optional but useful: male & female header pins

Cutting the Disks

P1020618.JPG
P1020620.JPG
P1020623.JPG
P1020622.JPG
P1020625.JPG
Start by cutting your plastic sheet into two disks that fit the printed encoder disk.
They should be pretty perfect circles.

The size of the disk should definitely be smaller than your wheel and is perhaps limited by other factors.
If you can make the disk very large, consider searching on the internet for encoder disk images that have more sprockets.
This results in a higher resolution and accuracy.

After cutting out the disks, drill a hole through the middle of them and fasten them together with the bolt,nut and washers.

Make the Sprockets

P1020629.JPG
P1020630.JPG
P1020633.JPG
P1020634.JPG
Now, add the printed encoder disk template to the fastened disks and secure it with tape.

Because we don't want the sprockets to break off, we need to set a minimum diameter of the center circle, so that we don't make the sprockets too thin. Check out picture #2 for clarification.

Now take your saw and cut straight into the edges of the white stripes, so that you don't cut width off of the black stripes and make them thinner.

Finishing the Encoder Disk

P1020642.JPG
P1020638.JPG
P1020640.JPG
P1020655.JPG
P1020650.JPG
Now seperate the disks from each other and use pliers to break out the thinner stripes.

Clean the encoder disk up and paint it black. This is optional but recommended, as the black paint will reduce reflection of the IR light.

Now fit the hole of the disks to the width of your shaft and attach them to it.

The Circuit

Circuit_drawing.jpg
P1020908.JPG
Comparator_ledanddiode.JPG
Comparator_schematic.JPG

Finished!

P1020907.JPG
Circuit_drawing_2.jpg
P1020905.JPG
And this is how to implement cheap odometry into your robot!
Now all that is left to do is to write the program that handles the counting.

But if your robot does not offer any room behind the encoder disk to fit an LED or diode behind it, you will have to take a different approach:
Don't cut into the plastic disks, instead glue a template of the encoder disk to each of the disks and make the circuit to look like in picture #2. This way, the IR light will be reflected when hitting a white stripe and absorbed when hitting a black stripe.
This way you'll be able to count the stripes passing by.

Anyway, thanks for giving my Instructable some attention and I hope it helped!
Don't be shy to comment what you think or when you need help!