Introduction: A Simple Arduino Based Line Follower

Picture of A Simple Arduino Based Line Follower

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.

Step 1: Parts & Tools

Parts List
QTY
2140 RPM Right Angle Gearmotor
2Right Angle Gearmotor Mount
Comes with two 4-40 x 7/8” Pan Head Phillips Screws
22.55" Press Fit Wheels
1Aruino Leonardo (others such as the Uno would also work)
1Arduino Channel Snap Mount
19v battery
19V Battery Channel Mount
19v snap connector
11.50" Aluminum Channel
1Pololu DRV8835 Dual Motor Driver Shield for Arduino
11x4 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.
1QTR-1RC Reflectance Sensor (2-Pack)
6male-female jumper wires (40 pack)
25 hole beam (585663)
17 hole beam (585664)
19 hole beam (585666)
2Attachment Blocks B (585600)
56-32 nuts (24 pack)
11/2" long 6-32 screw
63/8" long 6-32 screws
21/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.
2nylon spacer (561-KSP2) 0.125" Long - 0.115" ID - 0.187"OD
(for mounting the sensors)
23/8" 2-56 Socket Head Machine Cap Screw (91251A079)
(for mounting the sensors)
22-56 nut (90480A003)
(you guessed it... for mounting the sensors)

Tools

  • 5/64" hex key(57185A43) (for mounting the sensors)
  • 7/64" hex key(57185A44)
  • small slot head screwdriver (for the screw terminals)
  • soldering iron and solder (to assemble the motor driver sheild)
  • #1 phillips screwdriver for the motor mounts

Step 2: Assemble the Body

Picture of 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

Picture of 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

Picture of 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.

Comments

becca4sdja (author)2016-11-09

Is there any way to build this using arduino and OSEPP's "IRFOL-01"? Ive been trying to complete an assignment and this is the closet project to it

farsadheidari (author)2016-06-11

hi
i can use TCRT5000L for sense and write code by Pololu QTR-8RC Arduino library???

stringstretcher (author)2015-12-20

Thanks for showing me codebender! Wow, what an improvement over the IDE. Nice robot, too.

Scramblbot126 (author)2015-11-30

This may be a stupid question but what is the wiring? Is there a scamatic or somthing, thanks a billion.

ethan24 (author)2015-11-09

How much will all the supplies cost

TeamJaeger (author)ethan242015-11-09

It depends a little on if there are things on the list that you already have or not (I try to make my parts list very verbose including things like wires and screws and nuts etc). If you need everything you'd spend around $40 at ServoCity ($10 of that is "hardware pack B" to get you an assortment of screws and nuts and a hex key), around $11 at Pololu for the sensors and motor controller shield and $4 at Adafruit for the wires. You'd also need an arduino, I used a leonardo but you could use other flavors as well like the mega or uno. A really cheap one that I've found is only $7 at https://www.fasttech.com/products/0/10000015/1001700-arduino-compatible-uno-r3-rev3-development-board which I ordered and tested out and it seems to operate just fine. Many makers will already have things like jumper wires and an arduino. The Actobotics components are like a high end erector set where they can be used and re-used to make anything so if you've worked with them before you'll likely have the screws, nuts, hex key and probably some of the other bits lying around as well. I think most folks would likely spend in the range of $20- $55 on this project.

About This Instructable

10,530views

157favorites

License:

Bio: I work at RobotZone ( the folks behind Actobotics and ServoCity.com ) in Winfield, KS. I love working on projects with my kids and seeing what ... More »
More by TeamJaeger:DeathGrip: Robot Claw GauntletLightweight Weed WhackerRC Fireworks Truck
Add instructable to: