T ThinkEdge Learn

Cleaning Robots: Bumpers, Cliff Sensors and the Brush

A robot vacuum has no map and no idea where the walls are. It bumps into things, backs off, turns by a random amount and repeats, and the trick is that a carefully chosen set of cheap sensors makes that random walk cover the floor properly.

cleaning robot robot vacuum robot vacuum cleaner
Robotics · The navigation loop first, then the parts that make it safe

How a robot vacuum navigates without a map

There is no map. A robot vacuum drives forward, and when a bumper switch or a wall sensor reports contact it reverses, turns by a random angle of roughly 30 to 150 degrees, and drives on. Given enough time, a random walk with a bias towards the walls covers a room well enough, and that bias is what makes it look deliberate. Newer machines add a camera or a laser scanner and build a real floor plan, but the random walk version is the logic a student can write in twenty lines.

The second trick is the schedule. A vacuum that cleaned for 20 minutes and then stopped would leave the far corner of a large room untouched, so real machines clean in bursts, pause briefly and change direction again, which spreads the coverage over time. It is a strange idea, but it measurably improves the result.

Cliff sensors matter more than the brush motor

The brush motor is the part everybody wants to build, and it is the least important. A small brush motor draws a few hundred milliamps and does most of the cleaning, while the navigation decides whether the robot ever reaches the dirt at all. The infrared cliff sensors under the front bumper matter more, because they stop the machine driving off a step onto a stair or into a sock.

Cliff sensing works by measuring how much infrared light comes back. A sensor fires a beam downward and looks for the return. On a floor the reflection is strong and consistent; over an edge there is nothing to reflect from, so the return collapses. The failure mode worth knowing is a black or glossy floor tile, which absorbs the beam and looks like a cliff, so machines with real cliff sensors look at the pattern across several sensors to tell the difference.

Step by step

  1. Build a driving base

    Two geared motors with an H-bridge and a caster wheel. Get it driving straight and turning on the spot before adding any sensors.

  2. Add a front bumper

    A small microswitch on a sprung bracket triggers on contact. This is how the robot knows it hit something, and it is more reliable than trying to detect walls with ultrasonics.

  3. Add a wall sensor

    Mount an ultrasonic sensor facing forward and read the distance. Compare it with the bumper output so you can see which one fires first as the robot nears a wall.

  4. Write the bounce and turn

    On contact, reverse for a fixed distance and then turn by a randomised angle. Log every turn angle so you can see whether the coverage is actually spreading.

  5. Add cliff detection

    Use an IR reflectance module under the front edge to detect a drop and stop the motors. Test it over a dark tile as well as over a step, because the two look the same to a naive sensor.

  6. Add the brush and the dock

    Drive a small brush motor with a MOSFET and add charging contacts so the robot returns to a dock when the battery drops. Then log a full run and look for the floor it never visited.

What you'll need

ItemQtyWhy
Arduino Uno R31Runs the motor control and the sensor logic for a machine that has to keep working between charges.
2WD chassis kit with geared motors and casters1The standard base, with rubber wheels that grip a smooth floor.
L298N dual H-bridge module1Two channels for the drive motors, with a spare channel for the brush.
HC-SR04 ultrasonic sensor1Long range wall detection, so the robot can slow down before it actually bumps.
IR reflectance sensor modules2Cliff detection under the front edge, plus a line sensor if you want a docking guide.
TP4056 LiPo charging module1Charges the pack safely. A plain wire and USB setup is the most common way these projects start a fire.

Practise it before you build it

Every step above has a matching circuit in the ThinkEdge Learn simulator. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so digitalWrite actually drives the LED on screen and the readings change when you change the wiring — no hardware, no burnt components.

Common questions

How much does a robot vacuum cost?

Consumer robot vacuums run from about $150 for a basic random navigation model to $500 or more for one with a lidar scanner and a self emptying dock. A DIY version with an Arduino and parts is $50 to $120: $20 to $40 for the chassis and motors, $6 to $12 for the driver, $4 to $8 for the ultrasonic sensor, $3 to $6 for the cliff sensors, and $10 to $20 for the battery and charging module.

Why does my robot keep backing away from the wall?

Almost always the bumper switch or the ultrasonic threshold is too sensitive. If you are using ultrasonics for wall detection, note that the beam hits a corner and returns a much shorter distance than it should, which reads as a very close wall. Angle the sensor away from the wall or lower the trigger threshold.

Do robot vacuums really clean in a random pattern?

Yes, on the entry level models. A random walk with a wall bias and a duty cycle does cover a room over a full cycle, which is why they sometimes wander for a while and then appear to pick up. The more expensive models replace this with a lidar scan and a planned path, which is faster and far more repeatable.

Related guides

Robotic Lawn Mowers: Boundary, Blades and BalanceHow robotic lawn mowers find the edge of the grass, why the blade motor causes brownouts, and what a $30 ultrasonic sensor can and cannot do. Window Cleaning Robots: How They Stick to GlassHow a window cleaning robot grips glass with a vacuum fan, why the squeegee matters as much as the suction, and how to build the winch logic. How to Build a RobotHow to build a robot from scratch: one motor and a switch, then sensors, then a line-follower that steers itself. Every stage runs in a browser simulator first. Autonomous Vehicles: What the Car Actually SensesAutonomous vehicles fuse lidar, radar, cameras and ultrasonics into one picture of the road. Here is what each sensor is good at, and how to build the loop.

Try the full simulator with your class

103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. NCERT Science mapping on 47 projects, with Arabic and English copy in the regional builds.