ad

Build Your Own Line Follower Robot: A Simple Indoor AGV for Package Transportation

In the modern era of automation, Automated Guided Vehicles (AGVs) are transforming how we handle logistics. While industrial AGVs can cost thousands of dollars, building a basic functional model for indoor package transportation is an achievable project for makers and students. A line-following robot serves as the perfect entry point into this technology, providing a reliable way to move goods along a fixed path in a warehouse, office, or home environment.

What is an AGV?

An AGV is a portable robot that follows long lines or wires on the floor, or uses radio waves, vision cameras, magnets, or lasers for navigation. In this guide, we focus on the most cost-effective and easy-to-implement version: the Optical Line Follower. By following a high-contrast track (usually black tape on a white floor), the robot can navigate from a loading station to a delivery point without human intervention.

Essential Components for the Project

To build a robust indoor AGV capable of carrying small loads, you will need the following components:

  • Microcontroller: Arduino Uno or Nano (The brain of the operation).
  • Motor Driver: L298N or L293D (To control the power and direction of the motors).
  • Sensors: IR Sensor Module (2 or 3 sensors depending on the precision required).
  • Motors: 2 x 12V DC Geared Motors (High torque is better for carrying goods).
  • Chassis: A sturdy wooden or acrylic base.
  • Power Source: 7.4V or 11.1V Li-ion battery pack.
  • Wheels: 2 main wheels and 1 castor wheel for balance.
  • Jumper Wires: For making connections.

The Working Principle

The core of this AGV lies in the Infrared (IR) sensors. These sensors consist of an IR LED and a Photodiode. The IR LED emits light, and the photodiode detects the reflection.

  • White Surface: Reflects IR light, sending a high signal to the Arduino.
  • Black Surface (The Line): Absorbs IR light, sending a low signal to the Arduino.

By placing two sensors on either side of a black line, the robot can determine its position. If the left sensor detects black, the robot knows it has drifted right and must turn left to correct itself. If both sensors detect white, the robot moves forward.

Circuit Connections

Connecting the components correctly is vital for the robot's functionality. Follow these logical steps:

1. Motor Driver to Arduino

  • ENA & ENB: Connected to PWM pins (e.g., D5, D6) to control speed.
  • IN1, IN2, IN3, IN4: Connected to digital pins (e.g., D7, D8, D9, D10) to control direction.

2. IR Sensors to Arduino

  • Left Sensor Output: Connected to Digital Pin 2.
  • Right Sensor Output: Connected to Digital Pin 3.
  • VCC and GND: Connected to the Arduino’s 5V and GND pins.

The Programming Logic

Below is a clean, simplified Arduino code to get your AGV moving. This code uses basic logic to ensure the robot stays on the track.

// Define Motor Pins
const int leftMotorForward = 7;
const int leftMotorBackward = 8;
const int rightMotorForward = 9;
const int rightMotorBackward = 10;

// Define Sensor Pins
const int leftSensor = 2;
const int rightSensor = 3;

void setup() {
  pinMode(leftMotorForward, OUTPUT);
  pinMode(leftMotorBackward, OUTPUT);
  pinMode(rightMotorForward, OUTPUT);
  pinMode(rightMotorBackward, OUTPUT);
  
  pinMode(leftSensor, INPUT);
  pinMode(rightSensor, INPUT);
}

void loop() {
  int L_state = digitalRead(leftSensor);
  int R_state = digitalRead(rightSensor);

  // If both sensors are on white, move forward
  if(L_state == LOW && R_state == LOW) {
    moveForward();
  }
  // If left sensor hits the black line, turn left
  else if(L_state == HIGH && R_state == LOW) {
    turnLeft();
  }
  // If right sensor hits the black line, turn right
  else if(L_state == LOW && R_state == HIGH) {
    turnRight();
  }
  // If both sensors hit black, stop (Delivery Point)
  else {
    stopRobot();
  }
}

void moveForward() {
  digitalWrite(leftMotorForward, HIGH);
  digitalWrite(rightMotorForward, HIGH);
  digitalWrite(leftMotorBackward, LOW);
  digitalWrite(rightMotorBackward, LOW);
}

void turnLeft() {
  digitalWrite(leftMotorForward, LOW);
  digitalWrite(rightMotorForward, HIGH);
}

void turnRight() {
  digitalWrite(leftMotorForward, HIGH);
  digitalWrite(rightMotorForward, LOW);
}

void stopRobot() {
  digitalWrite(leftMotorForward, LOW);
  digitalWrite(rightMotorForward, LOW);
}

Step-by-Step Assembly Guide

Step 1: Chassis Preparation

Mount your DC motors to the underside of your chassis using brackets. Ensure the wheels are aligned perfectly. Attach the castor wheel at the front or back to provide a third point of stability, allowing the robot to pivot easily.

Step 2: Sensor Mounting

Mount the IR sensors at the front of the robot. They should be placed about 1-2 cm apart and roughly 5mm above the ground. If they are too high, they won't detect the line; if they are too low, they might scrape the floor.

Step 3: Wiring

Place the Arduino and Motor Driver on top of the chassis. Use a breadboard or direct jumper wires to connect the components according to the circuit logic mentioned above. Use a cable tie to organize the wires so they don't interfere with the wheels.

Step 4: Creating the Track

Use black electrical tape on a light-colored floor. Start with a simple oval shape with wide curves. Avoid sharp 90-degree angles initially, as basic line followers struggle with very tight turns.

Calibration and Testing

Once the robot is on the track, you may notice it "jitters" or moves too fast. You can calibrate the sensitivity of the IR sensors using the small potentiometers (the blue knobs) located on the sensor modules. Turn them until the onboard LED triggers only when the sensor is over the black tape.

If the robot is too fast, you can use analogWrite() in your code instead of digitalWrite() for the motor pins to reduce the speed and increase the accuracy of the turns.

Future Improvements for Goods Transportation

While this basic model proves the concept, you can upgrade it for real-world use:

  • PID Control: Implement Proportional-Integral-Derivative control in your code for smooth, fluid movement rather than jerky corrections.
  • Ultrasonic Sensors: Add an HC-SR04 sensor to the front to detect obstacles (like people or boxes) and stop automatically to prevent collisions.
  • Load Platform: Build a flatbed or a basket on top of the chassis to securely hold packages.
  • Wireless Control: Add a Bluetooth or Wi-Fi module to start and stop the AGV from a smartphone app.

Conclusion

Building a line follower AGV is a rewarding project that bridges the gap between simple hobby electronics and industrial automation. By following this guide, you have created a machine capable of navigating an indoor environment autonomously. With further refinement and the addition of obstacle detection, your robot can become a highly efficient tool for transporting goods in any indoor setting.

Comments

DO NOT CLICK HERE