Hugo Richmond
Design report

Project Qwen

An offline home-security and assistant robot, built on salvaged hoverboard motors, that sees, listens, guards the house and docks itself to recharge.

The full build, start to finish (16 min): reverse engineering, wiring, printing, security mode and docking.
Abstract

Qwen is a home robot I designed and built from scratch over about three months. A Raspberry Pi 4 (4 GB) runs everything that needs intelligence, all offline: a custom wake word, speech recognition, a local language model, text-to-speech, hand-gesture control, owner face recognition and person detection. An ESP32 handles everything with a deadline: closed-loop wheel speed control on salvaged hoverboard hub motors, obstacle reflexes, the scissor-lift servos and status LEDs. In security mode it sleeps on a motion sensor, wakes to check faces, turns to follow an intruder, lights the room through my smart-home system, sounds an alarm and alerts my phone. It returns to its charger by itself using two AprilTags and wheel odometry, and confirms the dock by measuring charging current. This report covers the design, what failed and how each problem was solved.

100% offlinespeech, LLM and vision on the Pi
2 processorsPi 4 (AI) + ESP32 (real time)
25.2 Vsalvaged 7S hoverboard pack
8.5 mm / countwheel odometry from hall taps
< $70out of pocket for the major parts
01

Goals and constraints

I wanted a robot that is useful around the house rather than a demo: something I can talk to, that keeps an eye on the place while I'm out, and that looks after its own battery.

  • Compute. A Raspberry Pi 4 with 4 GB of RAM and no GPU. RAM, not storage, was the binding limit.
  • Power. A salvaged hoverboard Li-ion pack, 25.2 V nominal (7 cells in series), that the robot recharges itself.
  • Offline. No cloud services for speech, language or vision. Only phone alerts leave the house.
  • Budget. Mostly salvaged and second-hand parts (section 03).

Guiding principle: only cheap processes run all the time; heavy work happens on demand. That rule decided the wake-word design, the security power states, the idle mode and how the camera is shared.

Board split. The Pi does perception and decisions; the ESP32 does anything with a deadline. Safety reflexes such as obstacle stops and the motor watchdog live on the ESP32, so they never depend on a round trip to the Pi.

02

Design and build

Qwen is an original design. I was going for a Star Wars droid look: I sketched it by hand, modeled it in Fusion 360 and printed every part in PETG. I also wanted the neck to reach human height, which just isn't doable with these servos. The one borrowed mechanism is the scissor lift, which I adapted from a Thingiverse design.

Concept sketches.
Lower body in Fusion 360: three slots for the IR sensors in front, LEDs on top, charging contacts on the back.
Printing: the body alone took about 35 hours.

The scissor lift. Each MG996R servo can turn 180°, but I limited it to 130°, as far as the mechanism extends. I added a bridge to join the two mirrored lifts so they support the head better, and melted the joints together with a soldering iron instead of gluing them. The first lift test with every head component on it was far too heavy for the servos, so I stripped the C920 webcam out of its housing and removed a heavy metal plate; after that the lift raised everything smoothly.

Scissor lift under test with the head electronics.
Weight cut: the C920 out of its shell.
  1. Month 1
    Jul 7 –

    AI, vision and first parts. Voice pipeline, wake word, gestures, testing components one at a time, and reverse engineering the hoverboard over UART.

  2. Month 2

    Mechanics. Hub motors on separate controllers, the scissor lift and its weight problem, designing and printing the body and head, mounting the wheels.

  3. Month 3
    – Oct 17

    Integration. Security mode and the smart-home link, perfboards, odometry, speed control, docking, power management, one program that starts at boot.

03

Hardware

Computing

Raspberry Pi 4 · 4 GBAI, vision, decisions

ESP32 dev boardmotors, sensors, servos, LEDs · UART to the Pi, powered over the Pi's USB

Vision + audio

Logitech C920camera + built-in microphone

MAX98357A I²S ampclass D, about 3 W

Gikfun 2″ speaker4 Ω, 5 W: never driven past its rating by the 3 W amp

Drive

2× hoverboard hub motors6.5″ wheels, built-in hall sensors

2× ZS-X11H BLDC controllersDIR + PWM from the ESP32

Logic-level shifter3.3 V ↔ 5 V

12× 10 kΩfour hall-sensor dividers for odometry

Neck + head

Scissor liftThingiverse design, modified, PETG

2× MG996R servoslimited to 0–130°, own 7.2 V supply

Potentiometermove the lift by hand

Sensors

PIR motion sensorin the head, wakes the robot

3× IR obstacle sensorsfront of the body, 3.3 V

INA226 power monitoron the charging branch

Lights

3 W LED module5 V, onboard driver: the head flashlight

4 indicator LEDs + 4× 220 Ωgreen / yellow / red battery, white status

Power

Hoverboard battery7S Li-ion, 25.2 V nominal

2× buck converters5 V (Pi) and 7.2 V (servos)

Power switch

Charging + dock

Hoverboard charger29.7 V measured, no load

Leaf-spring contacts + padsrobot-vacuum style

1N4007 diodein the + pad lead

2× AprilTagstag36h11, IDs 0 and 1, 79 mm

Out of pocket for the major parts: used hoverboard $25 (eBay), C920 $15 (Facebook Marketplace), two ZS-X11H controllers $25, the Pi a hand-me-down. The rest were parts I owned or a few dollars each. Tools: 3D printer, ST-Link v2, USB logic analyzer, Arduino Uno, multimeter, bench supply, soldering iron.

04

System architecture

Everything on the Pi runs in one Python process (assistant.py) started by a systemd service at boot. One process means one owner for each shared resource: one camera manager, one serial link to the ESP32, one web server. That turned out to matter more than any single algorithm. The only separate program is a small C++ tag tracker, which borrows the camera while the robot drives itself. The two boards talk over a plain-text serial protocol (V 30 30 means both wheels at 30 mm/s), and the ESP32 enforces its own safety rules: a 500 ms motor watchdog, an IR obstacle stop and a reverse limit by distance, since there are no rear sensors.

System architecture: software modules on the Raspberry Pi, real-time functions on the ESP32, joined by a UART link Raspberry Pi 4 · 4 GB one process, systemd service Voicewake word → STT → LLM → TTS Visiongestures · faces · YOLO26n Security modePIR · face check · alarm Idle modemotion sensor wakes everything Docking + drivingAprilTags · odometry · teach view Tag tracker (C++)AprilTag pose · ORB-SLAM3 Power managerINA226 · LEDs · return to dock Control pagelive view · WASD · dock steps AlertsTelegram text, photos, video Smart-home clientlights · door · keypad Pi peripherals: C920 camera + mic (USB) · MAX98357A speaker (I²S) · PIR (GPIO24) · INA226 (I²C) · flashlight LED (GPIO23) ESP32 · firmware (C++) Speed controlfeed-forward + PI, 50 Hz, 20 kHz PWM Odometry4 hall taps, 60 counts / rev ReflexesIR stop · 500 ms motor watchdog Lift + LEDs2× MG996R · battery + status LEDs Drive hardware 2× ZS-X11H → hub motors · 3× IR · pot UART 115200
Figure 1. Architecture. The Pi decides; the ESP32 acts. A plain-text serial protocol joins them (for example V 30 30 = both wheels 30 mm/s; the ESP32 reports wheel counts, speeds, IR states and lift position).
05

Voice assistant

The robot was first called Piko, so the first wake word was "Hey Piko". My first prototype skipped a real wake-word model and transcribed everything with Whisper, which kept speech recognition running almost nonstop on a board that also has to do vision, so I replaced it before it reached the Pi.

StageChoiceWhy
Wake wordopenWakeWord, custom "Hey Qwen"A tiny always-on classifier; everything heavier runs only after it fires
Speech to textfaster-whisper tiny.enSmallest model that understood me reliably on the Pi
Language modelQwen 2.5 (1.5B) via OllamaRuns locally, so nothing I say leaves the house
Text to speechPiperNatural voice, runs locally

I tried Google's Gemma 3 first, but its answer to "what is Ohm's law?" wasn't what I expected, so I switched to Qwen 2.5, and that's where the robot's name comes from. I trained the wake word with openWakeWord's notebook, which generates synthetic speech; its voice read "Qwen" as the letter Q, so I spelled it "hey kwen". Piper had the same problem, so the robot's speech swaps in "Kwen" before speaking.

Training the wake word with openWakeWord.

The speaker sits a few centimetres from the microphone, so the robot could wake itself. The fix is one line:

self.mic.mute_for(duration_s + MIC_MUTE_TAIL_S)   # deaf while speaking, + 0.3 s

Known commands (record, photo, flashlight, room lights, look up/down, move, "what do you see", "is anyone here", security mode, alarm) skip the language model entirely. In a quiet room the microphone level is boosted automatically (up to +12 dB) so a soft "Hey Qwen" still wakes it.

06

Vision: gestures, faces and people

Hand gestures

MediaPipe Hands returns 21 points per hand. Instead of training a gesture model, I classify gestures with geometric rules on those points, divided by the palm size so distance from the camera doesn't matter. Telling a fist from a thumbs-up took four attempts; a live overlay that drew the skeleton and the raw measurements made each attempt a measurement instead of a guess. The rule that finally worked uses height, not shape:

if four_fingers_curled:
    # thumb tip well above the folded fingertips?
    if _thumb_raised_ratio(landmarks) > 1.25:      # in palm widths
        return "thumbs_up"
    return "fist"
GestureAction
Thumbs upStart recording
OK signStop recording
Peace signPhoto after 1.5 s
Rock sign, held 1 sToggle the head flashlight
L sign, held 1 sLock the front door (smart-home system)
Gesture overlay: the rock sign toggling the flashlight.
Face labels on the live view (here "uncertain").

Faces and people

Faces are found with YuNet and compared with SFace embeddings: one enrolled owner, everyone else "unknown". Recognition depends on lighting and lift height, so I enroll the owner once per condition. People are detected with YOLO26n exported to NCNN, which runs well on the Pi's ARM cores and still sees someone who has turned away.

07

Security mode and the smart home

Security mode is built around power: the expensive parts only run when there is a reason to.

  • Arming: "Hey Qwen, security mode" or the exit button on my keypad, with a 100 s exit delay.
  • Armed-idle: camera, microphone and lights off; only the PIR motion sensor is watched.
  • Armed-active: on motion the camera wakes and runs face recognition and person detection. When it sees someone, it turns on the room lights and the head flashlight, drives a little away from the wall and turns slowly on the spot to keep the person in view.

Intruder response: an unknown face starts recording and a spoken warning; if they're still there 25 s later, the alarm sounds, the flashlight flashes and the video goes to my phone through a Telegram bot. Recognizing the owner's face, or the correct keypad code, disarms it.

The smart home. Qwen plugs into an ESP32 smart-home system I built earlier: a door-lock servo, two light-switch servos and a keypad on an ESP-NOW hub. From my phone I can unlock the door for someone; Qwen then raises the lift so the camera can see faces from the floor and gives them 3 minutes to be verified before the alarm. Recognizing the owner locks the door again.

Security mode: lights on, the robot facing the person, what its camera sees in the corner.
Remote unlock and light switches from the phone.

Telegram also works the other way: sending stop locks the wheels and lift from anywhere, and resume continues, picking docking back up if it was mid-run.

08

Drivetrain: from hoverboard to closed-loop control

Reverse engineering the hoverboard

A used hoverboard cost $25 and came with two hub motors strong enough to carry a person, plus a 25.2 V battery. My plan was to reflash its controller with an ST-Link, but the programmer kept failing: the chip isn't an STM32 at all but a Linkosemi LKS32MC088, which has no open-source hoverboard firmware.

So I tried speaking the protocol the two boards already use. I found the link pins (12, R1, T1, G), sniffed them with an ESP32 and replayed the "forward" data, but the boards still shut off. Copying data from screenshots kept turning the letter O into zeros, and 115200 baud turned out to be the wrong rate. A logic analyzer settled it: each bit lasts 13 µs, about 76,923 baud, in fixed 19-byte frames. With exact captures turned straight into C arrays, both boards stayed on with no errors, but the wheels never moved. My best guess is that the link only carries status between the boards. I chose to treat the wheels as plain motors instead.

The LKS32MC088, not an STM32.
The board-to-board link pins.
Logic-analyzer capture in PulseView.

Motor controllers

With the first ZS-X11H the motor locked up, vibrated and eventually smoked. I suspected the hall sensors and phases were mismatched and tried all 36 combinations; what finally worked was the hall order printed on the motor's own hall board. The ESP32's 3.3 V signals were too weak for the controller's inputs, so a logic-level shifter sits in between, and each motor now needs just two signals: direction and PWM.

ZS-X11H wired to a hub motor.

Wheel odometry

To know how far each wheel turned, I tapped two hall sensors on each controller's hall connector. They switch at 5 V and the ESP32 only takes 3.3 V, so each tap goes through a divider made of three 10 kΩ resistors:

\[ V_{\text{out}} = 5\ \text{V}\cdot\frac{20\ \text{k}\Omega}{10\ \text{k}\Omega + 20\ \text{k}\Omega} \approx 3.33\ \text{V} \]

Spinning each wheel by hand gave 60 counts per turn. With 162 mm wheels, one turn rolls \(\pi \times 162 \approx 509\) mm, so each count is 8.5 mm. Turning follows from the difference between the two wheels:

\[ \Delta\theta = \frac{s_R - s_L}{b}, \qquad b = 365\ \text{mm (effective, calibrated on the floor)} \]
Odometry: 60 counts per wheel turn, 162 mm wheel, 509 mm per turn, 8.5 mm per count; turning angle equals the difference between the wheel distances divided by the wheel spacing Project Qwen · Odometry counting wheel turns to know how far it moved and turned 1 How far: one wheel turn = 60 counts hall sensors 1 count = 6° of a turn d = 162 mm STEP Spin each wheel one full turn by hand and count the hall pulses: 60 ONE TURN ROLLS C = π × d = π × 162 mm ≈ 509 mm 0 509 mm = one turn, unrolled one count DISTANCE PER COUNT 509 mm ÷ 60 ≈ 8.5 mm so distance = counts × 8.5 mm 2 How much it turned: the difference between the wheels θ turning centre sₗ left sᵣ right b = 365 mm between the wheels start TURNING LEFT The outer (right) wheel rolls farther than the inner (left) wheel. ANGLE TURNED θ = (sᵣ − sₗ) ÷ b example: right wheel 100 mm farther → 100 ÷ 365 = 0.27 rad ≈ 15.7° in radians; × 180/π for degrees. Spinning in place: sₗ = −sᵣ. Counts come from the hub motors' own hall sensors, through 10 kΩ dividers (5 V → 3.3 V) into the ESP32. b is the effective spacing, calibrated on the floor.
Figure 2. How odometry works: distance from wheel counts, turning from the difference between the wheels.

In code, a turn on the spot is just both wheels rolling the same arc in opposite directions:

arc = WHEEL_SPACING_MM * math.pi * deg / 360.0     # each wheel rolls this far
got = self._odo_move(-arc if left else arc,         # one wheel back...
                     arc if left else -arc, speed)  # ...one forward

Closed-loop speed control

Open-loop PWM meant "slow" changed with battery voltage and the two wheels never matched, and even the lowest setting was too fast for docking. Now the ESP32 measures each wheel's real speed from the time between hall counts and corrects it 50 times a second, with an acceleration limit so the rear caster doesn't lift and slam:

float speedOut(float target, float measured, float& integ,
               float dt, float cap) {
  const float err = target - measured;                 // mm/s
  integ = clampf(integ + err * dt * SPEED_KI, SPEED_I_MAX);
  float out = target * SPEED_FF + err * SPEED_KP + integ;  // FF + PI
  ...
}

A second term keeps the wheels in step when driving straight or spinning. The robot now drives anywhere from a few mm/s for fine turns up to 130 mm/s.

09

Electrical design

Two buck converters split the battery: 5 V for the Pi (the ESP32 is powered from the Pi's USB) and 7.2 V for the lift servos, so their current spikes can't brown out the Pi. The motor controllers run straight from the pack.

Power tree: battery, switch, 5 V buck, servo buck, motor bus and the charging branch with the INA226 Battery7S Li-ion, 25.2 V nominalhoverboard pack Switch 5 V bucklogic rail Servo buckkeeps servo spikes off the Pi Pack bus25–29 V direct Raspberry Pi 4 (header 5 V)ESP32 via USB · amp · PIR · INA226 2× MG996R lift servosscissor lift 2× ZS-X11H → hub motorsDIR + PWM from ESP32 Dock charger29.7 V open circuit → spring pads 1N4007in the + pad lead INA2260.1 Ω shunt charging branch only No fuses are fitted yet — the first item in Future improvements (section 17).
Figure 3. Power tree. The two parallel power pairs from the hoverboard pack are the same node, so I tapped one without cutting the original wiring. The INA226 only sees the charging branch.

Charging, and why it charges through the wrong wires

The hoverboard battery has four wires: two for output and two for charging. As soon as it started charging, the battery's protection board switched the output off and everything shut down. A multimeter still read 28 V on the output, but a multimeter draws almost no current, so voltage alone didn't mean it could power anything. The fix was to charge through the output wires instead. That may bypass the battery's own overcharge protection, so the robot enforces it in software: at 90% it says "Battery full" and drives itself off the charger. A 1N4007 diode in the positive pad lead only lets current flow into the robot, so the battery voltage never appears on the exposed pads. The INA226 on that branch tells the robot when it's really charging.

Measuring the pack while chasing the charging cut-off.
Fitting the charging contacts to the back of the body.

Full schematic

Every connection as built, in PCB-schematic style. Labels with the same name are connected.

Project Qwen wiring schematic in PCB-schematic style: power, charging, Raspberry Pi with audio, PIR, flashlight and camera, ESP32 with level shifter, motor controllers, hall-sensor dividers, IR sensors, servos, potentiometer and indicator LEDs 1122334455667788AABBCCDDEEPOWER+BT17S Li-ion25.2 VSW1powerPACK+U11IN+3OUT+2IN-4OUT-Buck 5 V+5VU21IN+3OUT+2IN-4OUT-Buck 7.2 V+7V2CHARGINGJ1Charge padsrear, to dock1+2−D11N4007U3INA2260.1 Ω shunt · 0x401IN+2IN-3VBS4VCC5GND6SCL7SDAPACK++5VI2C_SCLI2C_SDADock: charger 29.7 V (no load) on two leaf-spring contacts.Charging current enters through the battery's output leads(the BMS turns the output off while the charge port is used).NOTES1. All ground symbols are one common ground.2. Global labels with the same name are connected.3. U9's 10 kΩ pull-ups hold PWM high if the ESP32 is unpowered, so the motors run. Planned: 10 kΩ pull-downs.4. No fuses fitted yet (main, INA226 branch, Pi 5 V PTC).5. Firmware drives off the dock at 90 % (BMS bypassed).6. U7 is driven straight from GPIO23, above the pin's current rating. Planned: logic-level MOSFET.7. U10/U11 hall connector Ha/Hb/Hc + 5 V/GND go to the motor.RASPBERRY PI 4U4Raspberry Pi 4 Model B4 GB · J8 header pin no.25V45V6GND3GPIO2 SDA5GPIO3 SCL8GPIO14 TXD10GPIO15 RXD12GPIO1835GPIO1940GPIO2118GPIO2416GPIO23USBUSB-A 1USBUSB-A 2+5VI2C_SDAI2C_SCLUART_TXUART_RXI2S_BCLKI2S_LRCI2S_DINPIR_OUTLIGHTUSB_CAMUSB_ESPU5MAX98357AI²S class-D amp1BCLK2LRC3DIN4VIN5GND6OUT+7OUT-I2S_BCLKI2S_LRCI2S_DIN+5VLS14 Ω 5 WU6PIR sensorin the head2OUT1VCC3GNDPIR_OUT+5VU73 W LED module5 V, 31 mm, onboard driver1+2-LIGHTJ2Logitech C920camera + microphoneUSBUSB_CAMESP32U8ESP32 DevKitWROOM5V (USB)3V3GNDGPIO22 RXGPIO21 TXGPIO17GPIO13GPIO18GPIO5GPIO16GPIO23GPIO32GPIO19GPIO15GPIO35GPIO4GPIO25GPIO33GPIO34GPIO26GPIO27GPIO14GPIO12USB_ESP+3V3UART_TXUART_RXPi TXD → ESP32 RXESP32 TX → Pi RXDHALL_LAHALL_LBHALL_RAHALL_RBIR_LIR_MIR_RSERVO_BSERVO_TPOTLED_GLED_YLED_RLED_WDRIVEU9LV1LV2LVLV3LV4HV1HV2HVHV3HV4GNDLevelshifter+3V3+5VU10PDIRMAMBMCHaHbV+GNDPACK+ZS-X11H LU11PDIRMAMBMCHaHbV+GNDPACK+ZS-X11H RMM1hub, 3~MM2hub, 3~HALL_LA_5VHALL_LB_5VHALL_RA_5VHALL_RB_5VODOMETRY · hall dividers 5 V → 3.33 VHALL_LA_5VR110kHALL_LAR210kR310kHALL_LB_5VR410kHALL_LBR510kR610kHALL_RA_5VR710kHALL_RAR810kR910kHALL_RB_5VR1010kHALL_RBR1110kR1210kSENSORSU12IR left1VCC2GND3OUT+3V3IR_LU13IR middle1VCC2GND3OUT+3V3R1310kIR_MU14IR right1VCC2GND3OUT+3V3IR_RLIFTJ3MG996R bottom2V+1SIG3GNDSERVO_B+7V2J4MG996R top2V+1SIG3GNDSERVO_T+7V2+3V3POTRV1lift potINDICATORSR14–R17 = 220 ΩLED_GR14 · D2 greenLED_YR15 · D3 yellowLED_RR16 · D4 redLED_WR17 · D5 whiteProject Qwen · robot wiringHugo RichmondRev 1.0 · as built2026-10-21Size A3 · KiCad styleSheet 1 / 1
Figure 4. Full wiring schematic. Labels with the same name are connected. Open full size.
FunctionPinsNotes
Pi ↔ ESP32 linkPi 14/15 ↔ ESP32 22/21115200 baud, 3.3 V both sides
Speaker (I²S)Pi 18 / 19 / 21the Pi's fixed hardware I²S pins
INA226 (I²C)Pi 2 / 3address 0x40, powered from the 5 V rail
PIR / flashlightPi 24 / 23the 3 W LED module runs straight from the GPIO
Motors PWM / DIRESP32 17, 13 (L) · 18, 5 (R)through the level shifter, 20 kHz
Hall tapsESP32 16, 23 (L) · 32, 19 (R)through the 10 kΩ dividers
IR sensorsESP32 15, 35, 435 is input-only, with a 10 kΩ pull-down
Lift servos / potESP32 25, 33 / 34servos on the 7.2 V supply
LEDsESP32 26, 27, 14, 12green, yellow, red, white, each through 220 Ω
The Pi's perfboard hat.
ESP32 board with the level shifter and divider resistors.
10

Docking and automatic recharging

The dock is two spring-loaded metal pads, the kind robot vacuums use, on a plate glued to the wall, with two printed AprilTags above it. The robot's contacts are on its back and it has no rear sensors, so docking means reversing blind onto two small pads. When the battery drops to 25%, Qwen says "Low battery, returning to dock":

Top view of the docking sequence: line up on the dock line, drive to the turn spot, turn 180 degrees, reverse onto the pads wall ID 0 ID 1 160 mm pads dock line: 9.0 cm right of ID 0 turn spot: 37 cm out line-up: 80–95 cm out start 1 · close in, sidestep 2 · forward in 10 cm legs 3 · turn 180° 4 · reverse onto pads lateral + out + robot not to scale
Figure 5. The docking sequence. Each step finishes with a measured result and the next step won't start from a bad one.
  1. Find and line up. A 360° scan finds the tags. Using two tags instead of one matters: a single square tag can look the same from two angles, and the robot kept getting confused about which side it was on.
  2. Drive to the turn spot, about 37 cm out, in short measured legs, re-facing the wall between them.
  3. Turn around. Turns on this wooden floor slip, so the turn is checked by the camera against pictures of the room taken while docked.
  4. Back on in gentle nudges, re-checking the heading every few centimetres. It only counts as docked when charging current holds for 3 seconds, and then it says "Charging."

If it doesn't charge, it pulls forward and tries again, up to three times, then asks for help on Telegram. If it can't see the tags at all, it searches the room with ORB-SLAM (section 11).

The robot's view: both tags boxed, the map in the corner.
A docking run, with its camera view inset.
The dock: two spring pads on the wall.

Teaching it the dock

My first "dock line" came from geometry and kept landing a few centimetres off. So I drove the robot onto the dock by hand five times while it recorded where it was before turning around. The positions agreed to within about a centimetre and set both the line it lines up on (9.0 cm right of tag 0) and the turn spot (37 cm out). Then, to fix the blind turn, I had it take a picture every centimetre while creeping slowly off the dock, so while turning and reversing it can compare what it sees to where it should be.

What failed and how I fixed it

ProblemFix
Tag not detected at 30–80 cm: the webcam's autofocus kept huntingFixed focus (0 of 20 frames → 20 of 20)
Robot sure it was on the wrong side of the dockA second tag: one pose solve from 8 corners
Wheels slipped, and even the slowest PWM was too fastPulses at first, then odometry and closed-loop speed control
The 180° turn came out 160° or 200°Turn checked against the docked pictures
The dock's springs pushed the robot back offFoam pads to hold the wheels (more problems, removed); then gentle nudges and "charging for 3 s"
Lined up on one tag instead of between themStep 1 only finishes when it's on the line after facing the wall
Sidestepped into a beanbag from 1.6 m awayDrive toward the tags first; front IR stops sidesteps
Kept driving after I lifted it onto the pads by handMotors stop as soon as real charging current holds 0.6 s (below)
# power_manager.py - while the robot drives itself
if charging and armed:                       # armed = it has been off the charger this run
    since = since or time.time()
    if time.time() - since >= GUARD_HOLD_S:  # 0.6 s of real charging current
        self.robot.stop("DOCKED - charging")
11

Room mapping and the lost-tag search

Docking only works when the robot can see the tags. If the 360° scan finds nothing, Qwen switches its tag tracker into monocular ORB-SLAM and searches: it drives slowly outward in gentle arcs, stops for obstacles, keeps a coarse map of where it has been so it heads somewhere new, and repeats the tag scan every metre or so. As soon as a tag is seen, normal docking takes over; if the search runs out of time, it tells me on Telegram.

ORB-SLAM3 runs on the Pi at about 5–10 frames a second. To test mapping I drove the robot around the room by hand. My first drive turned too fast: at 41°/s and 5.5 fps the view jumps about 7° between frames and tracking kept failing. Turning at about 9°/s on a second, longer drive gave a much better map.

Mapping drive: ORB-SLAM features and the live map in the corner.
Figure 6. Floor map from the second drive (50 cm grid): driven path in blue, obstacles in black, the dock in red.
Limits

The map shows the room's structure but isn't accurate enough for path planning. The weak link is heading: across the drive the robot turned a total of 8,474°, every spin on wood slips a little, and one camera has no true scale. That's why the map is used to search rather than to navigate. A gyro would fix most of it.

12

Operating modes

State diagram: awake, idle, security mode, return to dock, lost-tag search, charging Awakevoice · gestures · vision Idlemotion sensor only 2 min, nomotion motion SECURITY MODE Arming100 s exit delay Armed-idlePIR only Armed-activefaces + people · recordwarn · alarm after 25 s motion 2 min clear voice / keypad owner face or keypad code remote unlock Return to docksteps 1–4 Lost-tag searchORB-SLAM + rescans Charginglift locked · LEDs solid battery ≤ 25 % and idle for 30 s: "Low battery, returning to dock" no tagsafter 360° tagsfound charge held 3 s Alert ownerTelegram ≥ 90 %: "Battery full", drive 13 cm off the pads
Figure 7. Operating modes. Security mode and the battery logic run independently: the robot can return to its dock while armed.
13

Power management and idle mode

  • Battery LEDs, solid at every level: red at 25% or below, yellow up to 50%, green above.
  • Low battery: at 25%, and idle for 30 s so motor current sag can't trigger it, it returns to the dock.
  • Full: at about 90% (a charging-voltage threshold held for a minute) it says "Battery full" and drives 13 cm off the pads.
  • No lift motion while charging: the servos' current disturbed the contacts. Only the remote-unlock face check may raise it.
  • Idle mode: two minutes without motion turns off the camera, gestures and microphone, leaving only the motion sensor. The sensor rides on the head, so the robot ignores it while it moves its own head.
Docked and charging.

I estimate the average draw at about 7.5 W from the wall, mostly asleep in security mode: roughly 0.18 kWh a day, or about 73 cents a month at my utility's rate.

14

What broke along the way

Testing the first components one at a time.
Hunting a short on the finished perfboard.
What happenedCauseFix
A servo and the amplifier fried (smoke)Supplies weren't set before connecting: 15 V into a 5–7 V servo, and far too much into the 5 V ampSet and measure every supply before connecting anything
Pi wouldn't power up, only the motorsThe buck's + output was bridged to − on the back of the perfboardFound with a continuity tester in half an hour
Everything shut off when charging startedThe battery's protection board cuts the output while chargingCharge through the output wires; software stop at 90%
Motors ran at full speed while the ESP32 bootedThe level shifter's pull-ups hold PWM high when nothing drives itPlanned: 10 kΩ pull-downs (until then, lift the wheels)
A wheel ran away during reworkA solder blob fell across a controller's pinsRemoved it; never rework a powered board
Wake word stopped while the live view was openThe video thread starved the audio threadLower priority for the stream
Robot lost Wi-Fi after brownoutsPower dips emptied the network config on the SD cardRepaired the card; a boot service restores the config
Docking and the assistant fought over the cameraThey started as separate programsOne process; the tag tracker borrows the camera

The habit that saved the most time: after soldering each group of parts onto the perfboard, test it before moving on, so when something breaks you know exactly where to look.

15

How I used AI

I used AI assistants throughout, mainly to speed up debugging: reading logs and measurements with me to narrow a fault down faster, drafting code for subsystems I had specified, and checking datasheets and pin maps.

The decisions, the hardware and the testing were mine. I set the requirements, built, wired and soldered the robot, ran every test and judged the results on the real hardware, and caught the AI's mistakes, including a security requirement I had never asked for and fixes that were wrong until I measured what the robot actually did.

16

Results

FeatureStatus
Wake word, speech, local LLM, voice commandsWorking
Hand gestures (5), owner face recognition, person detectionWorking
Security mode, person tracking, alarm, Telegram alerts, smart-home linkWorking
Closed-loop drive and odometryWorking
Docking and recharging, battery-full drive-off, idle modeWorking
Low-battery return to dockWorking
Room map / lost-tag searchTesting
17

Future improvements

  • Safety first: a main fuse and a fuse on the charging branch, a PTC fuse and TVS diode on the Pi's 5 V, 10 kΩ pull-downs on the PWM lines, a MOSFET for the flashlight, and an emergency-stop switch.
  • A proper PCB to replace the perfboards (in progress).
  • A gyro (IMU) for heading that doesn't drift with wheel slip: better turns, map and docking.
  • A dock funnel or wider pads, so a few millimetres of error still lands on the contacts.
  • A fan on the Pi, which reaches the low 80s °C with vision running.
18

What I learned

  • Measure before tuning. The gesture overlay, the logic analyzer and the docking log each turned guessing into measuring.
  • Change the problem when tuning stalls. A new gesture vocabulary beat a fifth threshold; a second tag beat clever single-tag logic; my own manual docks beat the geometry.
  • Negative results point the way. The hoverboard replay and the mapping drift each led to the right next decision.
  • Electrical decisions come from failure modes, not ratings: fuse placement, strapping pins, level-shifter pull-ups and battery protection all bit me or nearly did.
  • Integration is its own engineering problem. One owner per shared resource fixed a whole class of bugs at once.

Back to top ↑