www.eXtremeElectronics.co.in

Line Sensor

AVR ATmega8 Bases Line Follower.

Easy to make PID LFR Robot.

A line follower robot, or a LFR in short, is a simple autonomous robot that optically tracks a line made on the surface of the floor. That means you have an arbitrary line drawn on the floor and the robot tracks it by moving right along it! The line is sensed using a piece of hardware called a line sensor.

A line sensor can be easily made using a low cost IR Rx/Tx pair. The IR Rx emmits IR radiation and the Rx helps in receiving the waves. See the figure below for working of line sensor.

Line Sensor Working

Fig. 1 - Working of Line Sensor

Schematic for Line Sensor.

Line Sensor Schematic

Fig. 2 - Line Sensor Schematic

 

IR Rx Tx Pair

Fig. 3 - Actual IR Rx Tx Pair.

Line Sensor Array.

Actually a group of such sensor units as described above is required to make a line follower robot. We generally use 3 or 5 such sensor unit to make a line sensor array.

GLCD Font Creator Main Screen

Fig. 4 - Line Sensor Board.

 

line sensor connected to atmega8

Fig. 5 - Connection.

 

line sensor mounted

Fig. 6 - Mounting

 

Connection with MCU.

The line sensors are connected to the analog to digital converter(ADC) module of the MCU. The ATmega8 MCU has 6 ADC channels of which 5 are connected to the 5 line sensor elements. Each element gives a value between 0-1023 depending on the amount of IR rays reflected from the surface in from of that element. Due to the nature of wiring of the sensor elements when the amount of reflected ray is more the value tends to 0 and when no ray is reflected value tends to 1023. So when a black line comes in from of the element the ADC will give a value larger than when a white surface is next to the element.

MCU ADC Channel

Sensor

ADC0

Left Most

ADC1

Left

ADC2

Center

ADC3

Right

ADC4

Right Most

 

Reading Sensor Value.

Sensors can be read easily using the ADC Library. A simple call to the function ReadADC( <adc channel number> ) will give you the sensor reading with varries between 0-1023 as discribed above. For example to to read right most sensor write as follows :-

unsigned int right_sensor;
right_sensor=ReadADC(4); //Right Most Sensor is connected to channel 4

a

 

 

Return to Help Index.