Introduction: Black As Line
Welcome to my Instructable!
If you like it
Please vote for me in the contests!
Here you will learn how to make simple but effective line follower robot.
As for the first line follower I've ever made, I think it is just gorgeous!
Step 1: Idea & Design
Idea for making line follower came when I was on robotic tournament. But their line followers were super professional and I haven't got any experience in building this kind of robots. So I started with more simple one.
Pictures above show design of my project in Fusion 360. It consist of three 3D printed parts (download below) and electronics (custom PCB, Arduino Pro Mini, motors, battery etc.).
Step 2: Parts List
Full parts list:
- Arduino Pro Mini and USB - UART programmer,
- 2x Transistors BC338 - capable of drawing up to 0.8 A of current to the motors,
- Slide switch,
- 4 AAA battery holder,
- 2 standard Pololu motors,
- 3x reflective optocouplers (KTIR0711S - SMD type),
- 2x 100 nF caramic capacitors,
- 3x 200 Ω and 3x 10 000 Ω resistors (SMD),
- 6 mm aluminum pipe,
- Wires, goldpins, heat schrink tubing,
- M2 screws, nuts, washers,
You will also need parts to make PCB - all you need to know is in this instructable.
And of course 3D printed parts.
Cost of all parts is about 15 - 20 $.
Step 3: 3D Printing
Firstly let's print 3 parts - 2 for the main frame of this robot and the remaining one to keep equal distance between sensors and line.
3D printing went without any problems on my custom delta printer. The files are easy to print but they need little support in the back.
I've printed them in black PLA with about 20 % infil.
Step 4: PCB
The next step is to make our PCB.
When I started to design the board in Eagle I immediately found a problem - Eagle did not have the appropriate libraries for my sensors and for Arduino Pro Mini (maybe they are hidden somewhere but i didn't found them). Making custom libraries in Eagle is quite simple so I have made those two. They can be downloaded below, to use them in Eagle paste them into your libraries instalation folder (normally: C:\EAGLE-7.7.0\lbr).
After that I have etched PCB, soldered all the components and painted it with an enamel paint. This will protect copper against oxidizing. You should also cut the arduino pins because they are little bit to long. They need to be shorter than this small 3D printed part.
Step 5: Battery
As I said earlier I wanted my robot not to be super professional - just enough so it will work good. That's why I am using 4 AAA batteries instead of 2 cell Li-Po. They are just easier to use. The disadvantages of this solution are that my batteries discharg very quickly, but for a short period of time robot have enough power.
To the battery holder I have added slide switch to turn On and Off my line follower.
Just cut red wire and solder it's ends to 2 pins next to each other. Than solder female connector at the end of wires.
Step 6: Motors & Wheels
I have used standard Pololu motors, they have just enough power to move whole construction. As you can see they haven't got any sort of gearbox. That's because motor shaft will sit directly on top of the wheel which will rotate slower with more torque.
Firstly solder capacitors in parallel with motors. Also solder wires in the way shown on the photo. You can see there an old servo cable which already have female connector on the other end. This short red piece of wire between motors should be about 3 cm ling (1.2 in), and distance between motors and wires end about 9 cm (3.5 in).
I've also added small piece of heat schrink tubing on shaft to achieve better grip between motor and a wheel.
Speaking about wheels - I recvered my wheels from an old printer, they have preety large friction because they were made to grip paper obviously. Printing (out of flexible filament) 16 mm in diameter 12 mm tall cylinders with 6 mm hole inside will also work.
The shaft is 17 mm long and it is made from 6 mm aluminum pipe.
At the end add there M2 20 mm screw to adjust tension between motor shaft and wheel.
To assemble everything together simply follow the pictures.
Firstly put wheels and motors in place. Than secure 2 parts of the frame together with one M2 8 mm screw.
Secondly use 2x M2 screws to mount battery holder to the drame. Lenght of this screws doesnt matter at this point because we will cut them just above the nut. Sand down sharp end of the screw and make sure that it isn't rubbing against the floor.
At the end secure the PCB with one M2 8 mm screw with a washer. Also at the bottom of PCB stick the remaining 3D printed part (CA glue works good) - it will keep sensors in the right distance from the floor.
Plug the cables and you should be done!
Step 8: Code
Now it is time to load some code!
Program for my robot was made in Basic language using Great Cow BASIC. Flashing it to arduino is really simple:
Plug programmer to arduino and to your computer. Open BlackAsLineCode.gcb in Great Cow BASIC. Than click GCBasic and Edit AVR programmer batchfile.
FlashAVR.bat should open, you will find there header, footer and one line which defines type of programmer you are using. Remove it by typing rem in the beginning of the line.
Than go down to:
Call AVRdude for Arduino_Pro_Mini bootloader:
And uncomment this:
"AVRdude\avrdude.exe" -c Arduino -P Com5 -b 57600 -p AT%2 -U flash:w:%1:i
Change Com5 to whatever port you are using for programmer.
This example shows how to flash Arduino with USB - UART programmer, but if you want you can easily use USB - ASP programmer, because there is ICSP connector on PCB.
Go back to previous tab and click hex / flash. Push the reset button on Arduino board as release is as soon as you will see Program assembled succesfully! in the new little window.
Step 9: Testing
At this stage line follower should be done!
It is very important to adjust the tension between motor shaft and wheel correctly using M2 screw on the back of the robot.
You can put some lubricant on the wheel shaft, but be carefull not to oil wheel itself.
If you see that your robot is going in the wrong direction than it should try to rotate the motor plug on the PCB or replace right motor with the left one.
If you have any ideas how to improve this project or any questions about it make sure to leave them in the comment section below.
Participated in the
Microcontroller Contest 2017
Participated in the
Design Now: In Motion Contest
Participated in the
Robotics Contest 2017