Auto Bot

Auto Bot

The Autobot is a basic robot controlled using two DC motors, an L298N motor driver, and an Arduino Uno. It follows a sequence of movements:
✅ Move forward for 2 seconds
✅ Move backward for 2 seconds
✅ Turn left for 2 seconds
✅ Turn right for 2 seconds
✅ Stop for 2 seconds

Components Required

  1. Arduino Uno – The brain of the robot
  2. L298N Motor Driver – Controls the motors
  3. Two DC Motors – For movement
  4. Power Source – 9V battery or Li-ion battery pack
  5. Chassis – The robot body
  6. Jumper Wires – For wiring

Programming

int IN1=9;

int IN2=10;

int IN3=11;

int IN4=12;

void setup()

{

pinMode(IN1, OUTPUT);

pinMode(IN2, OUTPUT);

pinMode(IN3, OUTPUT);

pinMode(IN4, OUTPUT);

}

void loop()

{

moveForward();

delay(2000); // Move forward for 2 seconds

moveBackward();

delay(2000); // Move backward for 2 seconds

turnLeft();

delay(2000); // Turn left for 2 seconds

turnRight();

delay(2000); // Turn right for 2 seconds

stopRobot();

delay(2000); // Stop for 2 seconds

}

void moveForward()

{

digitalWrite(IN1, HIGH);

digitalWrite(IN2, LOW);

digitalWrite(IN3, HIGH);

digitalWrite(IN4, LOW);

}

void moveBackward()

{

digitalWrite(IN1, LOW);

digitalWrite(IN2, HIGH);

digitalWrite(IN3, LOW);

digitalWrite(IN4, HIGH);

}

void turnLeft()

{

digitalWrite(IN1, LOW);

digitalWrite(IN2, HIGH);

digitalWrite(IN3, HIGH);

digitalWrite(IN4, LOW);

}

void turnRight()

{

digitalWrite(IN1, HIGH);

digitalWrite(IN2, LOW);

digitalWrite(IN3, LOW);

digitalWrite(IN4, HIGH);

}

void stopRobot()

{

digitalWrite(IN1, LOW);

digitalWrite(IN2, LOW);

digitalWrite(IN3, LOW);

digitalWrite(IN4, LOW);

}

How It Works

  1. Moves forward for 2 seconds
  2. Moves backward for 2 seconds
  3. Turns left for 2 seconds
  4. Turns right for 2 seconds
  5. Stops for 2 seconds, then repeats

Applications of This Autobot

Basic Robotics Learning
Obstacle Avoidance (with sensors)
Autonomous Navigation (AI-based modifications)
Line-Following Robots (with IR sensors)