Pages

Saturday, August 14, 2010

Membuat line follower sederhana

Theory: by Lol Elner

Obviously the line following robot will need to see the line, therefore we require an light detector of some sort. We also would like it if the line following robot could do this regardless of the ambient conditions (is the room dark or light? is it lit by sunlight or artificial light?). So the robot will also need its own illumination source. The weapon of choice here will be Infra Red (IR) light.

To make this easy for ourselves the light only needs to be constant... if a white line is present then it will reflect a lot of IR from our source. If the line is black then we see the opposite effect.

The circuit

All we need is an IR source, an IR photo-transistor and a couple of resistors! Here are the resources:


  • IR emmiters and detector pairs: UK - Maplins,CH10L and CH11M, or SFH409 and SFH309.
  • IR emmiters and detector pairs: US - Solarbotics QRD1114 (this has both in one package)
On top of these, it would be nice if the signal that we get could be TTL (on or off, 0V, 5V). So to do this we will also require our favourite BEAM chip, the 74AC240, heres the circuit:







Circuit operation is simple.... no line to follow put the input to the inverter high, and therefore the inverter outputs a low, line detection turns on the transistor (or photodiode) and thus the inverter gets a low and outputs a high. If your robot is following a black line on a white page, then add another invereter after or before the first.

So what should the values for R1 and R2 be? and how do I set up the 74AC240 chip exactly..... The value for R1 affects the source IR brightness, for maximum brightness we set R1 to give the maximum allowable forward current for the IR led. So what should it be?? Well, look at the datasheet for your LED, lookup the value of the maximum forward current. Now a simple bit of electronic theory tells us V=IR, I will assume you are using 5V because this is the volatge the 74AC240 should be run at (6V is OK... 4 AA batteries).

Now lets say that the max forward current is 100mA so we have 5V = 100mA * R , therefore:

5/100*10^-3 = R = 50ohms.

Experiment with different values until you get a sensitivity that you are happy with... too bright and the detector will see it when it shouldn't! Also remember this will affect the distance you can have it from the line you are following.

So how about R2? just set R2 to about 4K.

The chip setup is simple too... ground pins 1, 10 and 19, put 5V onto pin 20. Now choose a pin to input your signal to, if you look at the 74AC240 datasheet on page 1, you will see a connection diagram, any pin with an I is an input, follow it across to find its output.
Pins 1 and 19 are the enable pins, which we have grounded to permanently enable the inputs on both side of the chip, this leaves you free to use any of the input pins. For example (in case I haven't spelt it out enough already)... input your signal at pin 4 and take the ouput from pin 16.

The output signal could be used to directly drive your motor... just connect one side of the motor to the ouput, and the other side to ground. If you do this for two motors (2 sets of line detectors will require two sets of emitters and detectors, but only one 74AC240 chip), then you have a basic line follower already! The left detector should be used to drive the right motor and vice versa
The behaviour of this robot as it stands will be too turn a motor on IF a line is present, if both detectors are over the line then it will drive straight, if the left detector goes of the line, it will turn off the right motor causing the robot to turn back onto the line, if the right detector goes off the line then it will turn off the left motor and again go back onto the line. If both detectors come off the line (end of line) then the robot will stop altogether, perfect! 


originally post : http://www.tombot.net/beam/linefollowingcircuit.html
 
 

Blogger