simple line follower

rascal.jpg

This is a walk through for a simple line follower that can follow a black line on a lighter surface, i used black insulating tape on the floor. The robot can be made in an hour and expanded on easily.

 

parts list

if your pc has a serial port you can buy the cheaper 28 board pack with the serial lead but if like my laptop you haven't you will have to get the one with the usb lead

picaxe 28 board usb
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/AXE001U

picaxe 28 board serial
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/AXE001

 

picaxe 28x1 chip x1
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/AXE010X1

l293d motor driver x1
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/ICO030

resistor 330R x1
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/resistormaster/SubProducts/RES0R&ChangeAction=SelectSubProduct

resistor 10k x2
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/resistormaster/SubProducts/RES330R&ChangeAction=SelectSubProduct

stripboard x1
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/PCB001

 

The battery box shown hear is not the one one you want, check that they can send you one with 4aa laying next to each other

battery box
http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/BAT011

 

gm9 with wheels x2
http://www.active-robots.com/products/motorsandwheels/solarbotics.shtml

qrb1134ir photorefelctor x2
http://www.active-robots.com/products/sensors/sensors-fairchild.shtml

 

wire

solder

double sided tape

black insulating tape

soldering iron

 

 

optional

4 pin pcb header plug and suitable plug

step 1

 

 

new_28_board.jpg

The 28 board will come with a darlington chip fitted, the robot wont use this chip but you can leave it in to keep it safe. The large chip socket is for the 28x1 chip and the smaller one is for the l293d motor driver, The two chips should not be fitted yet but have to be fitted the right way look for the noches on the chip and chip holder

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

step 2

Next you need to cut a small piece off the strip board, 11 by 6 counting the holes. you will also have to put a break in one of the tracks, have a look at the pic to see where to put it. To make the break use a drill bit and and turn it using your hand.

strip_board_.jpg

cutting_strip_board_0.jpg

 

cut_strip_board_0.jpg

strip_board_layout_.jpg

step 3

You need to solder your 2 x 10k resistors and 1 x 330r resistor to the strip board in the places shown above. If your using a 4 pin pcb header plug that should be soldered where the yellow line is, if your not you can solder the ribbon cable straight to the strip board. Next cut down the leads on the two QRB11134IR sensors and solder them to the strip board, there will be a white, blue, green and orange lead they should be soldered where the coloured dots are on the pic above

 

ribben_cable_leads.jpg

completed_strip_board_.jpg

Your strip board should look something like this i have soldered my leads higher up but there still on the same tracks.

The numbers above the header pins represent the wire on the ribbon cable, you should now solder these to either your plug or on to the strip board

 

 

 

 

 

 

 

 

 

 

 

 

 

 

step 4

cut 4 bits of wire and soder to the motors and to the 28 board

motor_conected_to_board_0.jpg

motor.jpg

 

step 5

Fit your wheels to your motors and stick them to the battery box using double sided tape. connect the battery box to the board. Then stick the board to the motors.

 

battery_motors_and_board_fixed_1.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

step 6

Place the 28x1 chip and l293d motor driver chip on the board, make sure you put them on the right way, insulate the strip board with tape and stick it on to the 28x1 chip and connect the ribbon cable. Stick the two sensors to the robot, you want them to be as close to the floor as possible in the centre of the robot, make sure they are just a bit wider than the line you want to follow.

sensors_stuck_to_robot_1.jpg

ribbon_cable_connected_to_board.jpg



strip_board_insulated_0.jpg

 

 

 

 

 

 

 

 

step 7

Your robot is now finished and ready to be programed.

install the program that came with your 28 board, put the battery's in your robot connect it to your pc with the lead and open up the program editor.

copy and paste the code below into the editor upload it to your robot, follow the notes in the code (green writing at the bottom in the editor) and make a track and watch it go.

 

 

 

wait 5 'wait 5 seconds to start
main:
readadc 3,b0 'read one sensor
readadc 2,b1 'read the other sensor
if b0>251 and b1<251 then 'check if sensor b0 can see black,
low 4 high 5 low 6 high 7 'these should make your robot turn its b0 sensor away from the black line,
endif
if b0<251 and b1>251 then 'check if sensor b1 can see black
high 4 low 5 high 6 low 7 'these should make your robot turn its b1 sensor away from the black line
else 'if none of the sensors see the black line then move forward
low 4 high 5 high 6 low 7 'these should make your robot move forward
endif
goto main


' lines 6, 9, and 11 will need to be changed for you robot to work

' you must change the high,low on motors a and b,

' high 4 low 5 will make motor A go in one direction and low 4 high 5 will make it go the other way, 6 and 7 control motor B

' put the battery in and hold the robot in the air and wait for it to start, both motors should drive forward if they dont change the high low combanation on line 11

' when you have got both motors running forward you can work out how to change lines 6 and 9

' make a circuit for the robot to follow and place the robot on it

' if your robot turns the wrong way when it gets to a turn switch the sensors over, right to left and left to right

 

 

 

 

 

https://www.youtube.com/watch?v=gq6Hqs0pcNo

Wow, very nice! Thanks!

Wow, very nice! Thanks! :slight_smile:

Are ou going to make a video of it in action?

I’ll link to this from “start here” :slight_smile:

video
yeh i uploaded a vid to youtube a few days ago but its still being processed, when its there il add it

this is great!
I am wanting to add line following and edge detection to Jasper. Thanks for the walkthrough! I will be using it.

You will have to upload
You will have to upload again, it does take time with youtube, but never days!

video
3rd time lucky. iv managed to get a video on youtube but the quality is not great, not sure why, its fine until i upload it

Cool video, good working
Cool video, good working little line chaser.