SpongeBot SteelPants
Magnetic robot that erases whiteboard marker strokes and can be driven remotely over Wi-Fi
Author: Daniel ION
GitHub Project Link: SpongeBot Repository
Description
SpongeBot SteelPants is a two-wheel robot designed to automate the process of cleaning whiteboards. It clings to the board with a PWM-controlled electromagnet and receives real-time drive commands from a phone/PC over Wi-Fi.
Motivation
The main premise I went with when deciding to build this project was fairly simple:
Why not automate something boring?
Cleaning whiteboards is a repetitive chore that eats up a bit of time every day, so
I decided to build a small robot that could take over that chore - and the good news is,
this robot won't take anyone's job!
Architecture
Log
Week 5 - 11 May
- Finished hardware design and completed component selection
- Purchased and received all required components
- Soldered key parts and researched power requirements, safe wiring and GPIO assignments
- Set up defmt debugging to verify Pico functionality and test communication with peripherals
Week 12 - 18 May
- Selected an appropriate chassis suited for the test whiteboard (40x30 cm)
- Mounted and organized all modules onto the chassis
- Assembled complete hardware stack and performed an initial test of all the components
- Implemented and validated test functions for all critical peripherals (MPU-6050, I²C bus, OLED Display), confirming data flow
Week 19 - 25 May
- Completed power system wiring, ensuring proper current handling for the electromagnet and motors
- Encountered and resolved hardware issues:
- Replaced one damaged motor with a different gear-ratio version - couldn't find another version in stock
- Enhanced adhesion by adding two permanent magnets to assist the electromagnet
- Implemented firmware:
- Developed the Rust software stack including UDP command parsing
- Integrated drive logic
- Performed preliminary functionality tests for robot movement, magnet adhesion and sensor checks
- Identified torque imbalance due to mismatched gear-ratio - planned software compensation
Hardware
The main components which I've chosen for the robot are the following:
- Raspberry Pi Pico 2W
- Core component that handles image processing, Wi-Fi commands and GPIO for all peripherals
- TB6612FNG Dual Motor Driver
- Dual H-bridge Motor Driver powered directly from battery rail, receives direction and PWM speed from the Pico
- Drives the two GA12-N20 Gearmotors
- D4184 MOSFET Module
- Logic-level gate which receives commands from Pico
- Adjusts the grip of the electromagnet depending on the tilt angle
- GY-521 (MPU-6050 IMU)
- 3-axis accelerometer + 3-axis gyroscope, supplies tilt angle
- The tilt angle commands the adhesion force through the Pico and towards the MOSFET module
- GA12-N20 Gearmotors
- Small and light, these motors provide the torque needed to pull a sponge and a magnet across a whiteboard
- IR Obstacle Sensors (x4)
- IR LEDs mounted at the corners to prevent the robot from falling off the edge of the whiteboard.
- Electromagnet 5 V/25 N
- Strong enough to cling the small robot to the whiteboard
- PWM-driven grip allows for adjustable adhesion
- 0.96 OLED Display
- Indicates the mode which the robot is currently using (cleaning by using the camera module or just simply going around)
- Displays remaining battery charge
Other components:
- 4xAA Battery Holder powers the robot
- Sponge
- Permanent magnets
- Wires, Breadboards, Jumpers, Diodes, Wheels, Chassis etc.
Schematics
Photos
Videos
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2W | Main microcontroller with Wi-Fi; controls all peripherals | 39.66 RON |
GA12-N20 100:1 Gearmotor | Drives wheels with high torque for sponge movement | 24.99 RON × 2 |
GA12-N20 Gearmotor | Used to replace one of the damaged motors | 22.09 RON |
TB6612FNG Motor Driver | Dual H-bridge to control 2 DC motors via PWM | 24.99 RON |
D4184 MOSFET Module | Switches the electromagnet on/off using PWM | 5.00 RON |
GY-521 (MPU-6050) | Measures tilt to adjust magnet force dynamically | 24.16 RON |
IR Obstacle Sensor | Detects whiteboard edges to prevent falling | 3.07 RON × 4 |
0.96″ OLED Display (SSD1306) | Shows battery level and operating mode | 16.35 RON |
Electromagnet 5V / 25N | Holds robot against whiteboard via magnetic force | ~27.00 RON |
WAGO 5-pin Connector (221-415) | Splits battery power and ground safely | 2.98 RON × 2 |
4×AA Battery Holder | Powers the robot with 4 AA batteries | 6.24 RON |
Miscellaneous (breadboards, wires, diodes, etc.) | Circuit prototyping, motor connection, edge detection, and mechanical assembly | ~70 RON |
Total | - | 303.71 RON |
Software
Library | Description | Usage |
---|---|---|
embassy | Async embedded framework with executors and timers. | Runs tasks concurrently (e.g. motor control, sensors). |
embassy-net | Async network stack (TCP/UDP, DNS, etc.). | Handles communication over Wi-Fi. |
embassy-rp | Embassy HAL for RP2040/RP2350 chips (Pico & Pico W). | Gives async access to GPIO, I²C, SPI, PWM, PIO, etc. |
tb6612fng | Driver for the TB6612FNG dual motor driver. | Used to control direction and speed of both gearmotors. |
mpu6050 | I²C driver for MPU-6050 accelerometer + gyro. | Reads tilt to adjust magnet grip and detect movement. |
ssd1306 | OLED driver for SSD1306 controller over I²C/SPI. | Displays robot mode or battery on 0.96″ screen. |
embedded-graphics | 2D graphics primitives and text rendering. | Renders UI elements on the OLED screen. |
cyw43 | Async Wi-Fi driver for the Pico W’s CYW43439 chip. | Enables Wi-Fi for control or telemetry via Embassy. |
embassy-executor | Async task executor and the #[embassy_executor::task] / #[embassy_executor::main] macros. | Runs the cooperative scheduler behind every firmware task. |
embassy-time | Hardware-agnostic timers, delays and Duration helpers. | Timer::after , Delay for IMU init, periodic heart-beat sleeps. |
embassy-sync | Lock-free channels, mutexes and signals for Embassy. | All SPSC channels (EDGE_CHANNEL , IMU_CHANNEL , …). |
heapless | Fixed-capacity String , Vec , deques — no dynamic allocation. | Builds OLED text lines and parses UDP commands without the alloc crate. |
static-cell | Safe static initialisation of buffers and peripherals. | Holds StackResources , UDP metadata. |
libm | no_std math routines (√, trig, …). | Computes tilt magnitude sqrt(pitch² + roll²) . |
defmt + defmt-rtt | Ultra-light logging with RTT transport. | info! , warn! , error! debug output visible via probe-run . |
panic-probe | Panic handler that prints the panic over defmt then halts. | Gives readable back-traces instead of silent lock-ups. |
embassy-lab-utils | Helper macros for quick Pico W Wi-Fi + network-stack setup. | init_wifi! and init_network_stack one-liners inside main() . |