Datasheet

Table Of Contents
27
revolution
(c) Copyright Revolution Education Ltd. Web: www.picaxe.co.uk Version 1.1 04/10
BOT120.PMD
BOT120 PICAXE-20X2 MICROBOT
Programming Example 6 – Line Tracker Testing
The Line Tracker module consists of a red LED which is permanently
illuminated and phototransistor detector which will detect the red light
reflected off the surface below.
The infra-red sensor is ued as an analogue sensor to determine the
amount of light reflected back from the surface it is over, which will give
a measure of how white or black it is. Pin C.2 is also analogue channel 8
so to determine the amount of reflection a ‘readadc’ command is used
on analogue channel 8. The value returned will decrease as the amount
of infra-red light reflected back increases; a low reading indicates bright
light (large reflection over a white surface) a high reading indicates a
small amount of reflection (over a black surface).
A simple line tracker will most likely zig-zag across the black line, turning
when it leaves the black line, crossing over it again, then turning again in
the opposite direction. The net result is that the Microrobot follows the
edge of the line.
The best way to create a line to follow is to use black insulation tape
stuck down onto a light surface (e.g. a piece of MDF wood). The
background can be any pale colour, it does not have to be white.
A more complex line follower can be created by using two (or even three)
line follower modules at the front of the robot. Additional line followers
can be purchased separately as part BOT127.
The following program tests the line tracker module to see that it is
operating correctly. This program can also be used to calculate the
analogue threshold value (which is a number half way between the white
background reading and the black line reading).
Sample Logicator Flowchart File:
BOT120 LINE TRACKER TEST.PLF
Sample BASIC File:
BOT120 LINE TRACKER TEST.BAS
main:
readadc 8,b0
debug
goto main