Line Following Sensor (DIY)

Line Following Banner
This is my attempt to create a simple line following sensor on my own. These sensors can be easily bought but it can be quite expensive considering that the components on it are quite simple.

It’s been some time since I’ve played with passive components and analogue design. I will be using the humble op-amp (operational amplifier) to compare the input signals and translate it into digital output. It will save CPU resource for other important tasks.

A line following robot will detect a contrasting line, meaning black line on white background or white line on black background.

mqdefault[4]

Black colour will absorb all the light while white colour will reflect all the light. By using these characteristics, we can utilize the LDR (light dependent resistor) to detect how much light is available at that instance. When it is on black, the resistance will be very high because there is very little light reflection from the black surface. When it’s on the white surface, the resistance will be low because white surfaces reflect most of the light.

12015-500x5001

Be sure to get all of the LDRs from the same shop at the same time to ensure that they are manufactured in the same batch. Doing this will ensure all of them will behave the same way and eliminates the need of tuning each sensor individually.

Let’s start with a simple comparator circuit.

img_04[1]

A voltage reference is being sent into the inverting input while an external signal is sent to the non-inverting input. When the non-inverting input is higher than the inverting input, Vout will saturate to V+. Otherwise, Vout will saturate to V-.

With this basic idea, we can compare the input level of the LDR to a reference level.

line1

Case study

line2

line3

Comparator output conditions

line4

Timing diagram

line5

This is my test circuit and video for a single sensor.

IMG_1155

IMG_1156

I’ve used two LM324 Quad Op-Amp IC to get eight comparators.

0001686_lm324_opamp[1]

This is my circuit on a donut board. It has 8 LDR sensors.

IMG_1159

Super bright red LEDs to illuminate the surface. There are 9 of them so that each LDR has uniform coverage.

IMG_1163

IMG_1162

LM324.

IMG_1165

The reason why I didn’t use a normal copper PCB because this kind of circuit will require two layers and it’s quite a hassle.

IMG_1167

Instead I just have jumper wires flying around the board. Very messy but it works.

IMG_1170

A single 10k ohm potentiometer to calibrate all 8 sensors at once.

IMG_1171

Turned on.

IMG_1190

In the dark.

IMG_1178

Here’s a demonstration video.

  1. Anderson11-29-2016

    Can u give me a circuit for reference?

  2. Shreyesh Desai09-13-2015

    any specific reason for using red leds..can white leds be used

  3. Shreyesh Desai09-13-2015

    Any specific reason behind using red leds..would white leds do..??

  4. krish06-04-2015

    can i know why u have used 9 sensors instead….

  5. vick06-05-2013

    Awesome!! Gonna try it out soon !

    • http://www./12-24-2016

      Beautiful post, Elaine. I especially like the line, “Because the understanding birthed in our long ago and far away can be the sure and vital anchor that serves us in our now.” I really love that. If ever an anchor was needed, it’s now.

    • That’s 2 clever by half and 2×2 clever 4 me. Thanks!

    • who is who? who came up with that one? did they tell you they wanted to do that or does it come in your package??? one more question, do ask your costumers what kind of music they prefer or do you just go with the flow??? I love your videos mikey mike i learn allot from them thankxxxxx

  6. Kwong Ming You06-02-2013

    Hi, can you tell me where you buy that 10k ohm potentiometer?

    • Wai Hung06-02-2013

      Most shops in Jalan Pasar will have it. Just mention for PCB mount, they will understand 🙂

Leave a Reply to Wai Hung Click here to cancel reply.