DIY Smart Vacuum Robot ๐ŸงนArduino Floor Cleaning Robotics Project for Kids

DIY Smart Vacuum Robot ๐ŸงนArduino Floor Cleaning Robotics Project for Kids
๐Ÿงน ROBOTICS FOR KIDS · LEVEL: INTERMEDIATE

Build a Mini Vacuum Robot That Cleans Its Own Room!

Meet Sweepy — a miniature acrylic-and-MDF robot with a real Arduino Uno on top, twin ultrasonic "eyes," and a mini vacuum fan. It rolls around a tiny room, dodges furniture, and sucks up dust and paper bits while its OLED proudly displays "Cleaning..."

⏱️ 5–6 hours ๐ŸŽ‚ Ages 10+ (with an adult) ๐ŸŒ€ Real Suction Fan
Cleaning...

๐ŸŒ€ Say hi to Sweepy, your mini vacuum robot!

What Is a Smart Vacuum Robot, Anyway?

Real robot vacuums use sensors to "see" the room, motors to move around, and suction to pick up dirt — all without a person steering them. Sweepy works the same way on a mini scale: two ultrasonic sensors act as its eyes, two DC motors drive its wheels, and a small vacuum fan pulls light debris into a collection area, all controlled by a visible Arduino Uno mounted right on top of its acrylic body.

๐Ÿ‘€ Ultrasonic Obstacle Detection ๐Ÿ”„ Automatic Direction Change ๐ŸŒ€ Real Suction Fan ๐Ÿ–ฅ️ Live OLED Status
๐Ÿงฐ

What You'll Need

Gather these parts before you start building Sweepy!

x1

Arduino Uno

Mounted visibly on top — the brain of the whole robot.

x2

Ultrasonic Sensors (HC-SR04)

Angled front-left and front-right to "see" obstacles.

x2

DC Gear Motors + Wheels

Drive the robot forward, backward, and in turns.

x1

L298N Motor Driver

Lets the Arduino safely control both drive motors.

x1

Mini Vacuum Fan (5V DC)

Creates suction to pull in dust and paper bits.

x1

0.96" I2C OLED Display

Shows live status like "Cleaning..." and "Obstacle!"

x1

Acrylic or MDF Sheet

Laser-cut or hand-cut into the robot's round chassis layers.

x1

Caster Wheel

A free-spinning third wheel for balance.

x1

Small Buzzer

Beeps briefly whenever an obstacle is detected.

x1

7.4V Battery Pack

Powers the motors and fan through the motor driver.

~25

Jumper Wires + Breadboard

Connects every sensor, motor, and display.

๐Ÿ”Œ

The Circuit Diagram

Two ultrasonic sensors, two motors, a vacuum fan, an OLED, and a buzzer — all wired to one Arduino Uno.

Arduino Uno UNO A0,A1 — Ultrasonic Left (Trig/Echo) A2,A3 — Ultrasonic Right (Trig/Echo) A4,A5 — OLED (I2C) Pins 7,8,9 — Left Motor (IN1/IN2/ENA) Pins 12,13,10 — Right Motor (IN3/IN4/ENB) Pin 6 — Vacuum Fan (via transistor) Pin 2 — Buzzer 5V GND Ultrasonic — Left Ultrasonic — Right OLED Display L298N + Left Motor L298N + Right Motor Vacuum Fan Buzzer
Ultrasonic sensors → A0–A3 OLED (I2C) → A4, A5 Left motor → pins 7,8,9 · Right motor → pins 10,12,13 Vacuum fan → pin 6 · Buzzer → pin 2
๐Ÿ› ️

Step-by-Step Build Instructions

We'll build the chassis first, then add the electronics layer by layer. Work with an adult on cutting and wiring the fan!

1

Cut the acrylic or MDF chassis

Cut a round or oval base plate plus a smaller top plate to hold the Arduino, leaving a cutout underneath for the vacuum fan and dust path.

2

Mount the motors, wheels, and caster

Attach the two DC gear motors on either side of the base with their wheels, and add a free-spinning caster wheel at the front or back for balance.

๐Ÿ’ก Tip: Keep the two drive wheels symmetrical — an uneven robot will curve instead of driving straight!
3

Install the vacuum fan and dust path

Mount the mini vacuum fan underneath, angled to pull air (and light debris) up from the floor into a small collection area or mesh bag.

4

Mount the Arduino and motor driver on top

Fix the Arduino Uno and L298N motor driver visibly on the top plate, so all the wiring is easy to see and troubleshoot.

5

Add the ultrasonic "eyes"

Mount the two ultrasonic sensors at the front, angled slightly outward (like eyes looking left-forward and right-forward) for wide obstacle coverage.

6

Add the OLED display and buzzer

Mount the OLED somewhere visible on top to show live status messages, and place the buzzer nearby for obstacle alerts.

7

Wire everything and test

Connect all sensors, motors, and the fan exactly as shown in the circuit diagram, upload the code, place Sweepy on a mini room floor with paper bits, and watch it clean!

๐Ÿ’ป

The Arduino Code

This code needs the Adafruit_SSD1306 and Adafruit_GFX libraries for the OLED. Copy it into the Arduino IDE and click Upload.

smart_vacuum_robot.ino
// ๐Ÿงน๐Ÿค– Sweepy the Smart Vacuum Robot — Arduino Robotics Project
// Ultrasonic obstacle avoidance + real vacuum suction + OLED status

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 display(128, 64, &Wire, -1);

// ---- Ultrasonic sensors ----
const int trigLeft = A0, echoLeft = A1;
const int trigRight = A2, echoRight = A3;
const int safeDistanceCM = 15;

// ---- Left motor ----
const int leftIN1 = 7, leftIN2 = 8, leftENA = 9;
// ---- Right motor ----
const int rightIN3 = 12, rightIN4 = 13, rightENB = 10;

// ---- Fan + buzzer ----
const int fanPin = 6;
const int buzzerPin = 2;

void setup() {
  pinMode(trigLeft, OUTPUT);  pinMode(echoLeft, INPUT);
  pinMode(trigRight, OUTPUT); pinMode(echoRight, INPUT);
  pinMode(leftIN1, OUTPUT);  pinMode(leftIN2, OUTPUT);  pinMode(leftENA, OUTPUT);
  pinMode(rightIN3, OUTPUT); pinMode(rightIN4, OUTPUT); pinMode(rightENB, OUTPUT);
  pinMode(fanPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  analogWrite(fanPin, 200);   // start the vacuum fan spinning
  showStatus("Cleaning...");
}

void loop() {
  long distLeft  = readDistanceCM(trigLeft, echoLeft);
  long distRight = readDistanceCM(trigRight, echoRight);

  bool blockedLeft  = (distLeft > 0 && distLeft < safeDistanceCM);
  bool blockedRight = (distRight > 0 && distRight < safeDistanceCM);

  if (blockedLeft || blockedRight) {
    avoidObstacle(blockedLeft, blockedRight);
  } else {
    driveForward();
    showStatus("Cleaning...");
  }
}

// Stops, beeps, reverses a little, then turns away from the closer side
void avoidObstacle(bool blockedLeft, bool blockedRight) {
  stopMotors();
  tone(buzzerPin, 900, 150);
  showStatus("Obstacle! Turning...");

  driveBackward();
  delay(300);
  stopMotors();

  if (blockedLeft && !blockedRight) {
    turnRight();
  } else if (blockedRight && !blockedLeft) {
    turnLeft();
  } else {
    turnRight();   // blocked on both sides — pick a direction
  }
  delay(400);
  stopMotors();
}

void driveForward() {
  digitalWrite(leftIN1, HIGH);  digitalWrite(leftIN2, LOW);
  digitalWrite(rightIN3, HIGH); digitalWrite(rightIN4, LOW);
  analogWrite(leftENA, 180); analogWrite(rightENB, 180);
}

void driveBackward() {
  digitalWrite(leftIN1, LOW);  digitalWrite(leftIN2, HIGH);
  digitalWrite(rightIN3, LOW); digitalWrite(rightIN4, HIGH);
  analogWrite(leftENA, 160); analogWrite(rightENB, 160);
}

void turnLeft() {
  digitalWrite(leftIN1, LOW);  digitalWrite(leftIN2, HIGH);
  digitalWrite(rightIN3, HIGH); digitalWrite(rightIN4, LOW);
  analogWrite(leftENA, 160); analogWrite(rightENB, 160);
}

void turnRight() {
  digitalWrite(leftIN1, HIGH); digitalWrite(leftIN2, LOW);
  digitalWrite(rightIN3, LOW); digitalWrite(rightIN4, HIGH);
  analogWrite(leftENA, 160); analogWrite(rightENB, 160);
}

void stopMotors() {
  analogWrite(leftENA, 0);
  analogWrite(rightENB, 0);
}

// Measures distance using an ultrasonic sensor
long readDistanceCM(int trigPin, int echoPin) {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  long duration = pulseIn(echoPin, HIGH, 20000);
  return duration * 0.034 / 2;
}

// Updates the OLED with the robot's current status
void showStatus(String msg) {
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 25);
  display.println(msg);
  display.display();
}
๐Ÿง 

How Does Sweepy Actually Work?

Here are the big robotics ideas hiding inside this project:

๐Ÿ“ก

Two Sensors, Better Vision

With one ultrasonic sensor angled left and one angled right, Sweepy can tell which side an obstacle is on — not just that something is there — so it knows which way to turn.

⚙️

Differential Drive

By spinning the left and right wheels in different directions or speeds, Sweepy can drive straight, turn in place, or curve — the same steering trick used in real robot vacuums.

๐ŸŒ€

Continuous Suction

The vacuum fan runs the whole time Sweepy is cleaning, using analogWrite() to control its speed through a transistor, since the Arduino pin alone can't power a fan directly.

๐Ÿ–ฅ️

Live Status Feedback

The showStatus() function updates the OLED every time the robot's behavior changes, so anyone watching always knows exactly what Sweepy is doing.

๐Ÿง‘‍๐Ÿ”ฌ Safety First!

  • Build with an adult, especially when cutting acrylic/MDF and wiring the motor driver and fan.
  • Keep fingers clear of the fan blades and wheels while the robot is powered on.
  • Test on a clear, open mini-room floor first before adding paper bits, to make sure obstacle avoidance works reliably.
  • This mini vacuum fan is for light dust and paper only — never test it near liquids or electronics.
  • Sand any sharp edges on the cut acrylic or MDF chassis before handling.

Frequently Asked Questions

Why use two ultrasonic sensors instead of one?

A single sensor can only tell you "something is close," but two angled sensors let Sweepy compare distances on each side and choose the smarter direction to turn.

Can I control the fan speed?

Yes! Since the fan is connected through analogWrite(), you can change the number (0–255) in setup() to make suction stronger or gentler.

Why does the robot reverse before turning?

Backing up a little first gives Sweepy room to turn without bumping into whatever it just detected — the same habit real robot vacuums use.

What age group is this project good for?

Because it combines a physical chassis build with motors, sensors, and a display, this project is best for kids around age 10+ working closely with an adult.

๐ŸŽ‰ Fantastic work — you just built a real obstacle-avoiding vacuum robot! Scatter some paper bits on the floor and watch Sweepy clean up.

⬆️ Back to Materials List

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
๐Ÿ–จ️
3D Print
All parts
Wire it
Circuit guide
๐Ÿ’ป
Code it
Arduino IDE
๐Ÿค–
Watch it
Walk & react
๐Ÿ“‹ Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
๐ŸŒ International: $5 USD
One-time · Instant digital delivery
๐Ÿ”’ Secured by Razorpay · Your data is safe
๐Ÿ“„ Download Free Sample Copy
๐Ÿ”’ Secured by Razorpay · Your data is safe
๐Ÿ“
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
๐Ÿ–ฅ️
Wokwi
No hardware
๐Ÿ
MicroPy
From zero
๐Ÿ”จ
21 Projects
IoT + sensors
๐Ÿ“„
Certificate
Verified cert
๐Ÿ“‹ Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
๐ŸŒ International: $5 USD
One-time · Lifetime access · No subscription
๐Ÿ”’ Secured by Razorpay · UPI · Cards · NetBanking
๐ŸŽ‰

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

๐Ÿ“– Access Your eBook Now
๐ŸŽ‰

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

๐Ÿ“ Go to My Course