Line Follower Robot
Circuit Explanation
The whole PiPico line follower robot can be divided into 3 sections: sensor section, control section, and driver section.
Sensor section:
This section contains IR diodes, potentiometer, Comparator (Op-Amp), and LEDs. The potentiometer is used for setting reference voltage at the comparator's one terminal and IR sensors are used to sense the line and provide a change in voltage at the comparator’s second terminal. Then comparator compares both voltages and generates a digital signal at the output. Here in this line follower circuit, we have used two comparators for two sensors. LM 358 is used as a comparator. LM358 has inbuilt two low noise Op-amps.
Working of Line Follower Robot using Pi Pico
Working with line followers is very interesting. Line follower robot senses black line by using sensor and then sends the signal to Pico. Then pico drives the motor according to the sensors' output.
This project uses two IR sensor modules, namely the left sensor and the right sensor. When both the left and right sensor senses white then the robot moves forward.
If the left sensor comes on a black line then the robot turns the left side.
If the right sensor sense a black line then the robot turns the right side until both sensors come at a white surface. When the white surface comes robot starts moving on forward again.
If both sensors come on the black line, the robot stops.
Circuit
This is a circuit for LFR.
We design a line follower robot using the new microcontroller Raspberry Pi Pico Board.
There were 3 sections of the PCB
1. the First one was the IR sensor section
2. the Second one was the motor driver section
3. The last section was the pico section
The IR sensor section was designed by using lm358 operational amplifiers, pairs of IR emitter and IR receiver, a potentiometer, and some resistance.
IR sensors of this kind can be used to determine the difference between white and black.
the IR emitter throws light on the surface and the IR receiver receives it.
In the case of black color, the IR rays emitted by the emitter are absorbed. So output remains zero
In the case of white color, the IR rays are reflected and received by the receiver. So we get high output.
Coming to the motor driver section
The Motor Driver Section includes L293D motor driver ic and connectors for the motors and battery. L293D is based on H-Bridge. If you want to get more information about motor drivers. I have given a link in the description you can check out that.
The raspberry pi section includes raspberry pi and a 3.3v voltage regulator. Pi works on 3.3v so we used a voltage regulator AMS1117.
Coding
Let’s open VS Code.
To program pico you will need a PICO-go extension installed in your vs code. For more information watch my pico tutorial series click here
It worked fine.
The LFR follows the black line. I programmed it to stop working when both sensors touch black. So on this side of the paper, it stops at every intersection.
Code
?from machine import Pin
import time
in1 = Pin(2, Pin.IN)
in2 = Pin(3, Pin.IN)
m11 = Pin(4, Pin.OUT)
m12 = Pin(5, Pin.OUT)
m21 = Pin(6, Pin.OUT)
m22 = Pin(7, Pin.OUT)
while True:
sensor1 = in1.value()
sensor2 = in2.value()
if sensor1 == 1:
if sensor2 == 1:
m11.value(0)
m12.value(1)
m21.value(0)
m22.value(1)
elif sensor2 == 0:
m11.value(0)
m12.value(0)
m21.value(0)
m22.value(1)
elif sensor1 == 0:
if sensor2 == 1:
m11.value(0)
m12.value(1)
m21.value(0)
m22.value(0)
else:
m11.value(0)
m12.value(0)
m12.value(0)
m22.value(0)
Line Follower Robot
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Prashant Sharma
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
125 0 0 -
DIY Laser Power Meter with Arduino
181 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
165 0 2 -