Line Follower Robot Code Arduino - All About Forex

Line Follower Robot Code Arduino

Line Follower Robot Code Arduino – A line follower robot is a type of robot that can detect and follow a specific path. The path can be of any width and color. In general, a dark colored line on a light background is preferred. We use a black line on a white background. This type of robot uses either a color sensor or an IR sensor to detect the path. Once the path is detected, the robot starts moving along the path. This type of robot is widely used in automation industry, e-commerce and logistics industry.

The line tracker consists of either a color sensor or an IR sensor to detect the road. In this tutorial we will use IR sensors because they are cheap and easy to use. Here we use a black path on a white background. The IR sensor I’m using here gives a logic 1 when it detects white and a logic 0 when it detects black.

Line Follower Robot Code Arduino

Line Follower Robot Code Arduino

The line tracker robot is equipped with two IR sensors. The black line is always positioned so that it falls in the middle of the two sensors. The robot also has two motors that control the movement of the robot.

Line Follower And Obstacle Avoiding Robot Using Arduino, Ir Sensor And Ultrasonic Sensor

When both sensors are on a light background, the IR rays from the IR sensor are reflected on the surface and we get a logic 1 from both sensors, and when one of the sensors is on the black line, that particular sensor emits a logic 0. All the light emitted by the sensor is absorbed by the black line.

In the first step, the robot should move forward if there is a line between the two sensors. To do this, both engines should be moving forward.

In the second position, when the left sensor is on the black line, the robot needs to align back to its previous position between these two sensors, for which we stop the left motor and turn the right motor forward. direction and the line comes back between the two sensors.

In the third position, the robot should return to its previous position when the right sensor is on the black line. So we stop the right engine and turn the left engine forward. The robot aligns to the center position.

Simple Steps To Make Line Follower Robot With Arduino Uno & L298n

And in the last position, when both sensors are on the black line, this is the end of the line and the robot should stop. To do this, stop both engines.

So, our main component is the Arduino UNO board which controls all the motors and sensors and then controls the movement of the robot.

Then there are two IR sensors on the left and one on the right. The VCC wire of both sensors is connected to the 5V pin of the Arduino UNO, and the GND wire of both sensors is connected to the GND pin of the Arduino UNO. The left sensor data wire is connected to Arduino UNO pin 3 and the right sensor data wire is connected to Arduino UNO pin 2.

Line Follower Robot Code Arduino

I used different colored wires for each connection and assigned a pin to where they connect. So it’s easier for you to build links. For example, the red wire is connected to the Arduino’s 5V pin, so I’ve marked 5V next to the red wire, and so on.

Arduino Line Follower Robot Code And Circuit Diagram

Let’s move on to the second part of the chain. So, we have two motors, one for the left and one for the right wheel, and they are connected to the two terminals of the motor driver. You don’t have to worry about motor polarity, we just change the input signal to switch between wire polarities.

To better control the movement of the motor, we have two pins connected to D4 and D5 pins of the Arduino UNO. Similarly, we have two pins connected to Arduino UNO pins D6 and D7 to control the movement of the left motor.

Now those 6 pins remain. The two trigger pins are designed to connect 5 volts. Both are internally connected, so you can use either pin. The next two pins are for ground and these two pins are internally connected. You need to connect one pin to the GND pin of the Arduino UNO and the other pin to the GND of the external battery. And the last two pins are connected internally, these two pins connect the positive wire of the external battery.

I use two separate batteries, one to power the Arduino UNO board and the other to power the motors. I used two lithium ion cells in both batteries. On the first battery I connected them in series to get an output voltage of 8 volts. These people’s cells put out 4 volts when fully charged. So I have linked two in a row. I get 8 volts from them. You can use any other battery with a voltage above 7.5 volts.

Core Line Following Bot With Tcrt5000/l298n On Microcontroller

In the next battery, I connected the cell in a parallel configuration to get 4 volts. These motors run on 3-6 volts. This battery can be replaced with a battery with a voltage of 3.7-6 volts and a current of 2 amps.

Important Note: If your infrared sensor outputs a logic 1 when it detects a black line and a logic 0 when it detects a white background, change HIGH to LOW and LOW to HIGH in all positions. A line follower, as the name suggests, is a self-propelled vehicle (that follows a line). There are generally two types of tax trackers. In one sense, a line follower follows a black line on a white surface, and in another sense, a white line on a black surface. This type of line follower is used in industries, food restaurants to distribute food, in the medical field to send medicines to patients in need. Now mainly IR sensors, L293D and microcontroller. Here we understand the functionality of IR sensor and L293D and see how we can use it in our line tracker project.

How does the IR sensor work? The IR sensor consists of an IR LED and a photodiode. The IR-LED continuously emits IR rays, and the photodiode acts as a receiver for the infrared rays emitted by the IR-LED. When the infrared rays emitted by the IR LED hit an object (note: the surface should not be black), the rays are reflected back. When the photodiode receives the IR rays emitted by the IR LED, the output of the IR sensor is digital high. If the photodiode does not receive any of the infrared radiation emitted by the IR LED, the output is digitally low. Coming to the operating voltage of the IR sensor, it operates at 5V and the output of the IR sensor module is either 5V (high) or 0V (low).

Line Follower Robot Code Arduino

The L293D module is a dual h-bridge motor driver circuit. The L293D module can be used to control two motors at the same time. It can drive the motor in any direction, making it ideal for any robot project. The working voltage of the module is between 4.5V and 12V. The output current of the module is 1A per channel. The module pinout is shown in the figure below.

Line Following Robot Using Arduino Uno

Links to the Line Follower program are shown below. First, let’s look at the connections between the Arduino and the IR sensors. The IR sensor has 3 pins, the VCC and GND pins are connected to the Arduino’s 5V power supply and the GND pin. The output pin of the IR sensor connected to the left side of the line tracker (left sensor) is connected to Arduino pin 4. The output pin of the IR sensor is connected to the right side of the line tracker (right sensor) and connected to Arduino pin 3. The figure below shows the location of the sensor in the line tracker robot.

Now let’s look at the connections between the Arduino and the L293D motor module. The L293D module has 3 pins that are connected to the power supply. The right pin is connected to Arduino 5V and the left pin gets 9V from the battery. The middle pin is grounded (connect the negative and GND pin of the Arduino battery and connect it to the GND pin of the L293D module).

M1 and M2 terminal

Line follower robot using arduino code, arduino source code for line follower, line follower robot arduino code pdf, code for line follower robot using arduino, arduino robot line follower, pid line follower arduino, light follower robot using arduino, line follower with arduino, line follower robot using arduino, arduino line follower robot code, arduino line follower robot kit, line follower robot code