Follow a Line With IR Sensors

Submitted by Trumpkin on November 28, 2008 - 12:26pm.

In this tutorial I will show you how to make a pair of IR emitter/detector circuits and also how to implement them to follow a line.

 

Pins Needed: One per emitter/detector circuit

 

There are many different methods of setting up sensors for line following. The most popular are:

 

1.V shape, sensors are placed in a V shape

2.row, sensors run across the line

3.two sensors, one on either side of the line

 

For this tutorial I will use configuration 3. 

I am using the QRD1114 emitter and detector package, but later on I will show you how to use other emitters and detectors. The actual circuit is very simple and requires only a few components

 

Schematic:

IR sensors

 

Pseudocode:

take reading1 left (on white)

take reading1 right (on white)

Loop forever

take reading2 left

take reading2 right

If reading2 left < reading1 left

Turn left until reading2 left not less than reading1 left

else if reading2 right < reading1 right

Turn right until reading2 right not less than reading1 left

else if reading2 right > or = to reading1 right

go forward

else if reading2 left > or = reading1 right

go forward

 

 

----More Coming Soon----

  

 

AttachmentSize
IR sensors.png63.48 KB
( categories: )