Let's Make Robots!

simple line follower

can follow a black line on a flat lighter surface

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

picaxe 28 board serial


picaxe 28x1 chip  x1

l293d motor driver  x1

resistor 330R  x1

resistor 10k  x2

stripboard  x1


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


 gm9 with wheels x2

qrb1134ir photorefelctor x2




double sided tape

black insulating tape

soldering iron




4 pin pcb header plug and suitable plug 

step 1




 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.




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



 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



step 5

motors_fixed_to_battery_box.jpgFit 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.
















 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.











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
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,
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
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






Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
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 little line chaser.
I am wanting to add line following and edge detection to Jasper. Thanks for the walkthrough! I will be using it.

Wow, very nice! Thanks! :)

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

I'll link to this from "start here" :)

yeh i uploaded a vid to youtube a few days ago but its still being processed, when its there il add it
You will have to upload again, it does take time with youtube, but never days!