Line Follower Sensor Tutorial
In this tutorial I will show you how sensors are constructed in connection to line follower mobots. Sensors are the eyes of your line follower. Without them, your mobot will not be able to follow the black line and race through the course.
The most common sensor used in a line follower, is the Infrared LED and Photodiode pair shown below.
The black component is the Photodiode and the transparent one is the Infrared LED.
These sensors are commonly seen on computer ball mouses. You might want to find a junk balled mouse. Open it up and you’ll usually see two to three pairs.
Tip: “If you have come to encounter photodiodes with cover, the better.
Since it photodiodes without covers typically are designed for wide-angled reception.
Applying it as your mobot’s sensor, might not be a good idea. Though, I am not saying that all non-covered photodiodes are wide-angled, some you might find are narrowed.
Lucky you then!”
We all know that your line follower’s job is to follow the black line.
Therefore the first thing we must do is to detect the black line.
Knowing that as a condition, we can utilize the concept of light and its reaction properties to every type of surface.
On a black surface the light is absorbed.
One a white surface the light is reflected.
If the Photodiode receives light, it will allow current to pass through it. By that concept, we can produce varying outputs of voltage.
This picture below represents the connection diagram of a mouse ball photodiode.
As you can notice, the mouse ball sensor is composed of two photodiodes with each anode thrown to the center pin and cathodes to the end pins.
The higher the intensity of light received by the sensor, the higher the conductivity.
The image below shows three photodiodes with their respective comparator circuits.
If chances are, you might wonder why a 100k resistor is present between the anode and input 1.
Here’s the explanation.
The resistor R acts as a load resistor to obtain a voltage drop. It can be drawn in this manner below.
I think you already got it but still, let me explain to be clear.
If the photodiode is receiving high intensity light, the voltage across R will be the same as the source, in this case, 5 volts.
If the photodiode is experiencing medium light the diode conductivity is medium, presumably, the voltage across R is 2-3volts.
If the photodiode is receiving no light (dark), then no voltage is present on the resistor.
Why do we need to compare? Why not directly connect the resistor to the pin of the microcontroller?
The voltage across the resistor is analog meaning it can be 1 volt, 2 volts, 3 volts, 3.5 and etc.
What we need is a digital output —–> 0 volts and 5 volts, logic low and logic high.
The next step that we need to do is to assign a digital value for black and white.
In my case, I assigned:
Logic 0 on Black
Logic 1 on White
In order to attain this, you need to adjust the values of your potentiometer. If the comparator circuit still confuses you, visit this page –> Comparator Tutorial.
You can notice in the image below that the sensors are placed in a white, black, white position. The LEDs represent the output of the comparator which is now 1, 0, 1. You can adjust the output comparator’s sensitivity by simply adjusting the knob of the potentiometer.
The Infrared LEDs can be treated as normal LEDs. 10mA to 15mA of current is enough.
You can either connect it this way:
Or this way:
Another thing, to know that your Infrared LED is working – try viewing it on digital camera. If you see a violet light, that’s your infrared light.
The picture below shows a white, white, black.
The picture below shows a black, white, white position.