The humble line follower is a great starter project for those getting into robotics. In this instructable we'll go over the steps needed to build one.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Parts & Tools
|2||140 RPM Right Angle Gearmotor|
|2||Right Angle Gearmotor Mount|
Comes with two 4-40 x 7/8” Pan Head Phillips Screws
|2||2.55" Press Fit Wheels|
|1||Aruino Leonardo (others such as the Uno would also work)|
|1||Arduino Channel Snap Mount|
|1||9V Battery Channel Mount|
|1||9v snap connector|
|1||1.50" Aluminum Channel|
|1||Pololu DRV8835 Dual Motor Driver Shield for Arduino|
|1||1x4 stackable female header row|
This is optional. I used one of these on one side of the motor controller shield so I would still have access to the 5v and ground pins of the arduino. If you use the included header row pins you can still access ground and 5v the bottom left and bottom right ICSP pins respectively. Also you can solder a header row pin to the "mode" solder paddles near the top of the motor controller... the pin closest to the word "MODE" will give you access to 5v.
|1||QTR-1RC Reflectance Sensor (2-Pack)|
|6||male-female jumper wires (40 pack)|
|2||5 hole beam (585663)|
|1||7 hole beam (585664)|
|1||9 hole beam (585666)|
|2||Attachment Blocks B (585600)|
|5||6-32 nuts (24 pack)|
|1||1/2" long 6-32 screw|
|6||3/8" long 6-32 screws|
|2||1/4" long 6-32 screws|
If you get Hardware Pack B from servocity.com it comes with all the 6-32" screws and nuts you'll need for this project and more, plus a 7/64" hex key (alan wrench) for use with 6-32 screws.
|2||nylon spacer (561-KSP2) 0.125" Long - 0.115" ID - 0.187"OD|
(for mounting the sensors)
|2||3/8" 2-56 Socket Head Machine Cap Screw (91251A079)|
(for mounting the sensors)
|2||2-56 nut (90480A003)|
(you guessed it... for mounting the sensors)
Step 2: Assemble the Body
I'll let the photos do most of the talking here... especially since I've littered them with notes.
Step 3: Wire It Up
The wiring is fairly easy. Again I added notes to most of these photos - to see the notes view the photos at full size by clicking on them.
Step 4: The Code
Use codebender or the arduino IDE to load this sketch onto your arduino.
Step 5: Test It Out
Your mileage may vary. How far away the sensors are from the table will make a big difference. Adjust the beams to find the best performance in your environment. Lighting, thickness of the line, and contrast from the line to the table will make a difference as well. The greater the contrast the better. You can also tweak the contrastThreashold and/or MaxDesiredSpeed variables in the code. Speed is another consideration, the faster it goes more likely it is to overshoot tight corners. Also keep in mind that as the 9v runs low the bot will go slower.