Introduction: DIY Line Follower Sensor Array

Picture of DIY Line Follower Sensor Array

In this Instructable you'll learn how to make your very own Line follower sensor array!!

It consists of two parts :

  1. The IR LED board.
  2. The Op-Amp Board.

The IR LED board consists of an array of 5 pairs of IR LEDs and photodiodes.The neat part about the board is that you can add more IR Tx/Rx pairs if you need to very easily...while making sure your supply has enough juice to power the LEDs.

Since the output of the IR sensor alone is in milivolt the Arduino will always read it as LOW no matter what....therefore an Amplifier is needed to convert the sensor output to TTL level..this is where the Op-Amp board comes in.

Finally the output of the Op-amp board is fed into the Arduino digital pin and you get a reading of HIGH for Black and LOW for White. (Since I plan on using it to follow a black line...more on that later.)

Some prerequisites that you might need are :

  1. Basic idea of how to solder.
  2. Basic idea of arduino programming.

Step 1: Parts List

Picture of Parts List

For the IR LED board :

  1. IR LED and Photodiode pair X 5
  2. 10kΩ Resistor X 5
  3. 100Ω Resistor X 5
  4. Connecting Wires
  5. Male header pins
  6. Perf board or PCB

For the Op-amp board :

  1. LM358 X 3
  2. 16-pin IC sockets X 2
  3. 4.7kΩ Resistors X 10
  4. Green LEDs X 5 (optional)
  5. 100Ω Resistors X 5
  6. Female and Male Header pins
  7. PCB
  8. Connecting Wires

Additional Tools :

  1. Soldering Iron
  2. Solder Wire
  3. Hot glue gun
  4. Breadboard to test everything before soldering.
  5. Arduino IDE installed on the computer.

And ofcourse an Arduino to make sense of all your readings :p

Step 2: Making the IR LED Array

Picture of Making the IR LED Array

Making the IR LED board is pretty easy.Take a look a the ckt diagram in order to familiarize yourself with the connections.

For the IR LED : The longer pin is the anode and the shorter pin is the cathode.

For the photodiode/phototransistor : The longer pin is the the emitter and the shorter one the collector...another way to identify the collector is that the side of the side of the photodiode is flat.

I've marked out each terminal for both the IR LED and the phototdiode.Now on to the soldering...

Start by soldering twomale header pins for the power and ground lines.Then place the IR led and the photodiode as shown in the picture.The anode of the led and the collector of the photodiode face each other.(easier to understand from the picture.)

Then place the two resistors (10kΩ and 100Ω) in the following way...

For the 10kΩ resistor : One terminal to the emitter of the photodiode...the other terminal to ground.

For the 100Ω resistor : One terminal to the cathode of the IR led and the other terminal to ground.

Have a look at the pictures for a better understanding of the connections.

Now connect a set of 5 male header pins on top of the pcb...take a wire and connect each junction of the 10kΩ resistor and emitter to each header pin.(Have a look at the pictures.)

Follow these steps for the other four pairs leaving approximately 2cm between each pair(this distance depends on the resolution you want for your sensor and also the line's thickness.)

Now on to the Op-Amp board.....

Step 3: Making the Board for the Op-Amps

Picture of Making the Board for the Op-Amps

As explained before the op-amps are needed to convert the IR sensor outputs to TTL logic.

The op-amp I've used is LM358 as its cheap and easily available.The chip contains 2 op-amps so 3 chips are needed for 5 led sensors(2 per chip).

The sensor input goes to the non-inverting terminal(pins 3 and 5).

Pin 1 and 7 of the op-amp are the output pins and are connected to the arduino digital pins.Having indicator LEDs at the output is optional....though it adds a nice effect and helps in debugging :p

Pin 4 goes to ground and 8 to 5V.

Normally a 10k pot is used as an input for the inverting terminal so that the sensitivity of the senor can be changed.However,I've used two 4.7kΩ resistors instead since I tested it and got a decent range.

For the op-amp connections have a look at the ckt diagram provided...the conncetion for each op-amp is identical.

The male header pins are where the output from the IR sensor array is connected and the female header are where the output of the op-amp board is connected to the arduino.

Note : Since my goal is to detect a black line on a white surface I've made the connections accordingly...if you want to detect a white line on a black surface just switch the connections for the inverting and non-inverting pins.

Step 4: Some Code to Start Out With...

Picture of Some Code to Start Out With...

Here's some code to get you started on taking readings from the sensor....no libraries needed just paste and go!!

What the code does :

  1. Each sensor reading (either 1 or 0) is stored in an array of 5 elements.
  2. readOut() function runs through each array element and save all reading into a 5 digit integer(E.g. 00100)
  3. The integer is returned to the main loop where the reading is displayed.

I'm currently working on the code to use these readings with a PID control filter to use on the line follower robot.

Step 5: More Pictures

Picture of More Pictures

Some more pictures...

Improvement tips :

  1. Try and mount the sensor as low as possible to the ground so that you get a good reading and since the sensor will be less affected by ambient light.
  2. Try and add a barrier between each pair (like a heatshrink tube over the IR led) so that each pair isnt affected by the others reading.

So now that you're done with the sensor array the only thing left is mounting it to the chassis and connecting motors..I will update that in another instructable once its done.

P.S : Please vote for this Instructable if you liked it :)

Comments

lindula (author)2017-09-20

Hello, I'm trying to find a part number for the IR LED and Photodiode pair X 5. If anyone can recommend a pair please include the part numbers. This is exactly the project I've been wanting to learn. Thanks, Joe

SrijaniP (author)2017-01-05

very nice project

DeepakV20 (author)2016-09-26

Hi, Thanks for project, its very nice project I tried it but only object is detecting not black/white color.

Kethaka Vidyananda (author)2016-08-05

Not bad but very good ??

HaythamL (author)2016-06-21

you schema doesnt make sense you saied

The sensor input goes to the non-inverting terminal(pins 3 and 5).

should i connect +5v to them or what? im really confuse

as-WIN-th (author)2016-06-01

If I place the transmitter and the receiver facing each other in opposite direction. What could be the minimum possible distance between each IR pair!

That is, the distance should be safe enough that, when IR pair 1 is triggered it should not affect its neighboring pairs.

MesdiS (author)2016-05-11

Hello. i want to know about the configuration of IR Led and photodiode to a LM358. can you show how to configuration pin Ir led and photodiode.

Thanks

ammar Khalil (author)2016-03-18

Hi? İ want to know that you place leds 2cm apart? how do we get to know that at what distance leds should be placed.?

Seconds, why you have not used lm324 quad amplifier

Thanks

jaydeepb3 (author)ammar Khalil2016-04-28

its upto you. you can anything

DylanF25 (author)2016-04-23

Hello, Im building a sensor array for a line following project, I would like to know if I can use a TL084 opamp??

jaydeepb3 (author)DylanF252016-04-28

ya sure u can

ParthP23 (author)2016-03-13

Superb Work Done.....Very Helpful

goldenshuttle (author)2015-02-15

Great project. Can this work as a moving person tracker ? say if we use more powerful IR reflection ?

VasiN2 (author)goldenshuttle2015-12-15

Hello! I want to buy these two plates (for the IR LED board and board for the Op-amp). Is it possible?

I am a student and I want to do a similar project. Can you help me please?

r5sb (author)goldenshuttle2015-02-15

Thanks! This module probably won't be very useful in tracking faces as-is since its meant to detect a line that's just 1-2cm away. Something like the Compound Eye or a PIR sensor or maybe even an array of Ultrasonic sensors would be much more practical as a person tracker.

VasiN2 (author)2015-12-15

Hello! I want to buy these two plates (for the IR LED board and board for the Op-amp). Is it possible ?

ManeeshaS (author)2015-08-25

You can use lm324 ic to make an op amp.it will sensitive about 30cm object.

Awesome project! Thanks for sharing it!

Thank you :)

About This Instructable

45,075views

49favorites

License:

Bio: I break things so I can figure out how they're made when I put it back together.
More by r5sb:Raspberry Pi Document Scanner With Automatic Upload to Dropbox.Arduino Hexapod (With A Personality)DIY Line Follower Sensor Array
Add instructable to: