How to make a Line Follower robot using the Arduino UNO R4 MINIMA board

How to make a Line Follower robot using the Arduino UNO R4 MINIMA board

Hello and welcome back! In this project, we will learn how to make a Line Follower robot using the Arduino UNO R4 MINIMA board, although you can easily use any other Arduino board if you prefer. I used two TCRT 5000 line-tracking sensors to detect the lines. These sensors work by emitting infrared light and measuring the reflection, allowing the robot to determine its position relative to the line. Also, I used two N20 gear motors. These motors provide the necessary torque and speed to navigate effectively along the track.
Additionally, I used regiform to create the robot chassis, so there’s no need for any other robot kit or chassis. With these points, you can do it easily and cheaply. Let’s go ahead.

  • How to use the TCRT5000 Line tracking sensors – Click on me
  • What is the Arduino UNO R4 MINIMA board – Click on me

OK let’s do this project step by step. The required components are given below.

Step 1

Firstly, identify these components.

Step 2

Secondly, create the robot chassis using cardboard, foam board, or Rigifoam. I used a piece of Rigifoam for that. Please use the dimensions below to make the chassis.

Step 3

Thirdly, install the caster wheel at the bottom of this chassis.

Step 4

Next, connect the wheels to the Gear motors and install them on the chassis.

Step 5

Now, install the sensors at the front of the chassis. Then, mount the Arduino board, motor driver, breadboard, and battery holder onto the robot chassis.

Step 6

Afterward, connect these components to the Arduino UNO board. For this, refer to the circuit diagram below.

How to make a Line Follower robot using the Arduino UNO R4 MINIMA board

Step 7

Next, connect the motors to the motor driver board.

Step 8

Now, connect the Arduino board to the computer. Then, copy and paste the following program to the Arduino IDE.

How to make a Line Follower robot using the Arduino UNO R4 MINIMA board
/*Line follower robot.
  created by the SriTu Hobby team.
*/
//motor one
#define A1 5
#define A 6

//motor two
#define B1 9
#define B 10

//sensor pins
#define SL 3
#define SR 2

int mSpeed = 130;//motor speed

void setup() {
  pinMode(A1, OUTPUT);
  pinMode(A, OUTPUT);
  pinMode(B1, OUTPUT);
  pinMode(B, OUTPUT);

  pinMode(SL, INPUT);
  pinMode(SR, INPUT);
  Serial.begin(9600);
}

void loop() {
  bool LValue = digitalRead(SL);//get sensor value one
  bool RValue = digitalRead(SR);//get sensor value two

  Serial.print(LValue);
  Serial.println(RValue);

  if (RValue == 1 && LValue == 0 ) {
    turnRight();
    Serial.println("turnRight");
  } else if (LValue == 1 && RValue == 0) {
    turnLeft();
    Serial.println("turnLeft");
  } else if (LValue == 0 && RValue == 0) {
    forward();
    Serial.println("forward");
  } else if (LValue == 1 && RValue == 1) {
    Stop();
    Serial.println("stop");
  }

}
void turnRight() {
  analogWrite(B1, 140);
  analogWrite(B, 0);
  analogWrite(A1, 0);
  analogWrite(A, 0);
}
void turnLeft() {
  analogWrite(B1, 0);
  analogWrite(B, 0);
  analogWrite(A1, 140);
  analogWrite(A, 0);
}
void forward() {
  analogWrite(B1, 140);
  analogWrite(B, 0);
  analogWrite(A1, 140);
  analogWrite(A, 0);
}
void Stop() {
  analogWrite(A1, LOW);
  analogWrite(A, LOW);
  analogWrite(B1, LOW);
  analogWrite(B, LOW);
}
  • After, select the board and port. Then, click the upload button.

Step 9

Ok then, remove the USB cable and insert the batteries into the battery holder. Finally, connect the battery connector to the Arduino DC power port. In this step, if the motors do not rotate correctly, please switch the motor wires.

You can now test the robot using a black track on a white surface. The full video guide is provided below. We hope to see you in the next project. Have a great day!

Troubleshooting

  • Check the jumper wires.
  • Check the sensor condition.
  • Check the power source.
  • Check the motor connection.

How to make a Line Follower robot using the Arduino UNO R4 MINIMA board

https://youtu.be/PDrs0dZPLKg

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *