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.
Step 1: What You Need
For this Instructable you need:
For the encoder disks:
- cutable plastic or wood thicker than 1/8 inch (~4mm)
- 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
Step 2: Cutting the Disks
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.
Step 3: Make the Sprockets
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.
Step 4: Finishing the Encoder Disk
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.
Step 5: The Circuit
Step 6: Finished!
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!