A little robot that roams a table and never falls off the edge.
Built and tested by Anju.A · Industrial Robotics Institute

A small autonomous robot that drives around on a table top without falling off. A single IR sensor at the front bottom watches the surface; when it sees the edge, the robot backs up, turns and carries on in a new direction.
| Component | Qty |
|---|---|
| Arduino Uno | 1 |
| IR Sensor Module | 1 |
| L298N Motor Driver Module | 1 |
| BO Gear Motors | 2 |
| Robot Chassis | 1 |
| Wheels | 2 |
| 2-cell 18650 Battery Holder with Switch | 1 |
| Jumper Wires | As needed |
| From | Connect to |
|---|---|
| IR sensor VCC | 5V |
| IR sensor GND | GND |
| IR sensor OUT | Pin 3 |
| L298N IN1 (left motor) | A0 |
| L298N IN2 (left motor) | A1 |
| L298N IN3 (right motor) | A2 |
| L298N IN4 (right motor) | A3 |
| Battery + | L298N 12V |
| Battery − | L298N GND |
| Arduino GND | L298N GND |
Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the Arduino Uno.
int sensor = 3;
int IN1 = A0;
int IN2 = A1;
int IN3 = A2;
int IN4 = A3;
void setup() {
pinMode(sensor, INPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}
void forward() {
digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW);
}
void backward() {
digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH);
}
void left() {
digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW);
}
void stopMotor() {
digitalWrite(IN1, LOW); digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW); digitalWrite(IN4, LOW);
}
void loop() {
int edge = digitalRead(sensor); // 0 = table surface, 1 = edge
if (edge == 0) {
forward();
} else {
backward();
delay(500);
left();
delay(400);
}
}A small autonomous robot that drives around on a table top without falling off. A single IR sensor at the front bottom watches the surface; when it sees the edge, the robot backs up, turns and carries on in a new direction.
You need: Arduino Uno (1), IR Sensor Module (1), L298N Motor Driver Module (1), BO Gear Motors (2), Robot Chassis (1), Wheels (2), 2-cell 18650 Battery Holder with Switch (1), Jumper Wires. Software: Arduino IDE.
Yes. It is rated beginner and takes about 1–2 hours to build, using the Arduino Uno. The guide on this page explains every connection and step.
The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.
Yes. IRI sells a kit with the parts for this project (PRJ-008). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.