Komli

Wednesday, June 18, 2008

IR sensors From Scratch + Line follower





IR emitter and IR phototransistor
An infrared emitter is an LED made from gallium arsenide, which emits near-infrared energy at about 880nm.
The infrared phototransistor acts as a transistor with the base voltage determined by the amount of light hitting the transistor.
Hence it acts as a variable current source. Greater amount of IR light cause greater currents to flow through the collector-emitter leads.
As shown in the diagram below, the phototransistor is wired in a similar configuration to the voltage divider.
The variable current traveling through the resistor causes a voltage drop in the pull-up resistor.
This voltage is measured as the output of the device







IR reflectance sensors contain a matched infrared transmitter and infrared receiver pair.
These devices work by measuring the amount of light that is reflected into the receiver.
Because the receiver also responds to ambient light, the device works best when well shielded from abient light,
and when the distance between the sensor and the reflective surface is small(less than 5mm).
IR reflectance sensors are often used to detect white and black surfaces. White surfaces generally reflect well,
while black surfaces reflect poorly. One of such applications is the line follower of a robot.









Schematic Diagram for a Single Pair of Infrared Transmitter and Receiver











To get a good voltage swing , the value of R1 must be carefully chosen. If Rsensor = a when no light falls on it and Rsensor = b when light falls on it. The difference in the two potentials is:

Vcc * { a/(a+R1) - b/(b+R1) }
Relative voltage swing = Actual Voltage Swing / Vcc
= Vcc * { a/(a+R1) - b/(b+R1) } / Vcc
= a/(a+R1) - b/(b+R1)

The resistance of the sensor decreases when IR light falls on it. A good sensor will have near zero resistance
in presence of light and a very large resistance in absence of light. We have used this property of the sensor to form a potential divider. The potential at point ‘2’ is Rsensor / (Rsensor + R1). Again, a good sensor circuit should give maximum change in potential at point ‘2’ for no-light and bright-light conditions. This is especially important if you plan to use an ADC in place of the comparator

To get a good voltage swing , the value of R1 must be carefully chosen. If Rsensor = a when no light falls on it and Rsensor = b when light falls on it. The difference in the two potentials is:
Vcc * { a/(a+R1) - b/(b+R1) }

Relative voltage swing = Actual Voltage Swing / Vcc
= Vcc * { a/(a+R1) - b/(b+R1) } / Vcc
= a/(a+R1) - b/(b+R1)




If the emitter and detector (aka phototransistor) are not blocked, then the output on pin 2 of the 74LS14 will be high (apx. 5 Volts).
When they are blocked, then the output will be low (apx. 0 Volts). The 74LS14 is a Schmitt triggered hex inverter.
A Schmitt trigger is a signal conditioner. It ensures that above a threshold value, we will always get "clean" HIGH and LOW signals.
Not Blocked Case: Pin 2 High Current from Vcc flows through the detector. The current continues to flow through the base of Q2.
Current from Vcc also flows through R2, and Q2's Drain and Emitter to ground.
As a result of this current path, there will be no current flowing through Q1's base.
The signal at U1's pin 1 will be low, and so pin 2 will be high. Blocked Case: Pin 2 Low Current "stops" at the detector.
Q2's base is not turned on. The current is re-routed passing through R2 and into the base of Q1.
This allows current to flow from Q1's detector and exiting out Q1's emitter. Pin 1 is thus high and pin 2 will be low.
To detect a line to be followed, we are using two or more number of poto-reflectors.
Its output current that proportional to reflection rate of the floor is converted to voltage with a resister and tested it if the line is detected or not.
However the threshold voltage cannot be fixed to any level because optical current by ambent light is added to the output current.
Most photo-detecting modules are using modurated light to avoid interference by the ambient light.
The detected signal is filtered with a band pass filter and disused signals are filtered out.
Therefore only the modurated signal from the light emitter can be detected.
Of course the detector must not be saturated by ambient light, this is effective when the detector is working in linear region.






The line position is compeared to the center value to be tracked, the position error is processed with Proportional/Integral/Diffence filters
to generate steering command. The line folloing robot tracks the line in PID control that the most popular argolithm for servo control.
The proportional term is the commom process in the servo system. It is only a gain amplifire without time dependent process.
The differencial term is applied in order to improve the responce to disturbance, and it also compensate phase lag at the controled object.
The D term will be required in most case to stabilize tracking motion. The I term that boosts DC gain is applied in order to remove left offset error,
however, it often decrease servo stability due to its phase lag.
When any line sensing error has occured for a time due to getting out of line or end of line, the motors are stopped and
the microcontroller enters sleep state of zero power consumption.
Typical Examples of infrared Transmitter and Receiver installation



9 comments:

stephen said...

I am using a pair of photodiode as
a reciever for my line follower. But it is sensitive to ambient sunlight. What can I do about the reciever not to pick up ambient sunlight???

ANIL M M said...

Could any one suggest an Ideal sensor positioning for A line following Bot which has to traverse arena containing even Intersecting lines??? (Perpendicular lines)

Faizy said...

@ stephen
srry for the late reply

u can use a simple filter of RC , so it will cut down high frequencies r low frequencies depending on which kind of filter ur using

@ anil

More the number of sensors the better it is , when there is a perpendicular line , all the recievers will be high and hence u can know when there is a straight line

NAVRATI said...

IN line follower robot what shud be done if the track consists of intersections?

Faizy said...

@ Navrati

When you have intersections, try to count the number of intersections, so that when you start next time you can travel with much ease.

An other thing, if you have to take a turn at intesection, the position of wheels should be in line with the intersection line. Hope you got it.

akinaktugaksoy said...

i am trying to build a heatbeat finger sensor.which ir-led and phototransistors should i choose.they must be at same frequency working length.and the value of R1 is 39K.so which photo transistor must placed there? i have a shematic for this project but i couldnt find models of photo transistor and ir-led.

BALASUBRAMANIAN said...

could anyone tell me how i can make my line follower bot detect lines n make turns at high speed about 300rpm?????

Maadhu said...

my IR sensor is reflected in all surface so wat can i do for tat?
plzzzzz tell me

mandy said...

im using line follower ckt.but motor is not rotating according to the sensor values so plz tell me what mite be the problem..