← Back to portfolio
STM32F446 · CAN · KiCad · DCDC Isolation · Damiao Motors · MuJoCo · Inverse Kinematics

Ratta “Geomcat” Automated Cat Litter Box

Ratta (Supernote) · Mechatronic Systems Engineer · Jul 2026 – Aug 2026

Mechatronic systems engineer responsible for the core capability of the product. Worked on a 12-person product team building an automated cat litter box. Designed all electrical, firmware, software, and control components for an inverted 4-DOF robotic arm that scoops waste and deposits it into a collection bin. Built 3 arms that passed a total of 5,000+ continuous scooping trials over 100 hours with zero failures and exhibited the product at Pet Fair Asia 2026.

Designed a PCB with three galvanically isolated power domains, STM32F446 firmware, IK/FK with Dijkstra-based safe motion planning, MuJoCo simulation environment with a custom motion scripting language. Co-designed the overall architecture and communication protocol with the RK3576 main controller.

System architecture

Two-controller split. An infrared and an HD camera feed into the RK3576, which detects waste and computes a target in polar coordinates. The RK3576 also handles product logic and the mobile monitoring app.

Coordinates travel over isolated TTL to the STM32F446, which executes the scooping motion at 200 Hz through the CAN bus. Joint telemetry streams back to the RK3576 for real-time monitoring.

PCB & power architecture

4-layer PCB with three galvanically isolated power domains. The STM32F446 logic domain connects to the motor power domain through an ADM3053 isolated CAN transceiver, and to the RK3576 host through ADUM digital isolators on the TTL link. Calculated current budgets for capacitor sizing, DC-DC converter selection, and slip-ring specification.

Supported the mechanical engineer in arm component selection. The arm uses 3 Damiao CAN joint motors running MIT impedance mode and a closed-loop stepper, all on a shared 1 Mbps CAN bus.

Firmware

Wrote the entire firmware from scratch. Bare-metal main-loop architecture with interrupt-driven peripherals.

Handles two motor protocols over CAN. Damiao joint motors run in impedance mode with bit-packed command frames. The closed-loop stepper uses a separate multi-packet protocol on CAN extended frames. Motor stiffness and damping gains adjust dynamically by action phase.

The trajectory playback engine runs at 200 Hz on a hardware timer, reading pre-computed lookup tables from flash and sending motor commands with velocity feedforward.

Co-designed the TTL communication protocol between STM32 and RK3576, iterated through 7 versions. 12 commands covering reset, movement, motor control, the full scooping workflow, emergency stop, and health reporting. An asynchronous state machine manages multi-step action lifecycles.

Four telemetry streams report joint position, velocity, torque, and temperature back to the RK3576 for monitoring through the mobile app.

Control & trajectory pipeline

Trajectories are learned from hand-guided teaching. The telemetry stream records joint positions during demonstration and exports them as .h lookup tables that feed into an imitation learning model.

A MuJoCo simulation environment handles sim-to-real transfer, fine-tuning the IL model and the recorded trajectories.

Given a scooping radius, the model outputs trajectory points. Adaptive planning interpolates between them with collision avoidance.

Engineering Timeline

Jul 13
First CAN motor spins

Debugged protocol mismatch between Damiao motor frames and STM32 CAN peripheral. Discovered the motor expects bit-packed impedance commands at a specific arbitration ID, not the documented one.

CANfirmware
Jul 16
MuJoCo sim + .rarm DSL

Built a MuJoCo simulation of the inverted 4-DOF arm with gravity compensation. Created a domain-specific language (.rarm) for scripting arm motions, with Dijkstra-based joint-space path planning for collision avoidance.

simulationcontrols
Jul 17
Sim-to-real trajectory pipeline

Exported MuJoCo trajectories as int16 centidegree lookup tables, flashed into STM32 and played back at 200 Hz with velocity feedforward. First successful physical arm motion from simulation data.

controlsfirmware
Jul 18
Position-speed to MIT impedance mode

Switched DM motors from built-in position-speed control to MIT impedance mode, giving the STM32 direct 200 Hz command over position, velocity, and torque per joint. Unified the entire firmware under simulation coordinates, converting only at the CAN send boundary with a per-joint sign flag.

controlsfirmware
Jul 20
PCB V2.1 isolation review

Reviewed 4-layer layout with three galvanically isolated power domains. Calculated bulk capacitance requirements for motor inrush, selected DC-DC converters, and specified the slip-ring current budget.

PCBpower
Jul 21
Real-time monitor + 17-commit marathon

Built a live telemetry dashboard streaming joint position, velocity, torque, and temperature from the STM32 through the RK3576 to a desktop monitor. Pushed 17 firmware commits in one session to stabilize the data pipeline.

firmwaretooling
Jul 22
Inverted arm standby problem

Ceiling-mounted arm holds pose indefinitely or it falls. Explored fail-safe electromagnet docking (energized to release, power loss latches), searched prior art for the magnet-to-motor handoff moment. Evaluated mechanical pin latch and spring-loaded cradle alternatives before converging on a trajectory-based sleep pose with firmware overload protection.

safetymechanical
Jul 27
Power budget crisis: 21.4 A vs 8 A terminal

Measured 21.4 A peak draw during aggressive scooping, but the slip-ring and connector chain were rated for only 8 A continuous. Redesigned the motion profile to stagger joint torques and added current monitoring with software-enforced limits.

powerfirmware
Jul 30
Radius-banded dig tables

Segmented the litter basin into radius bands with per-band trajectory lookup tables. Added integral compensation to correct for mechanical slop. Scooping accuracy improved from ~60% to consistent hits across the full basin.

controlsfirmware
Aug 3
Volatile bug found via ELF disassembly

Intermittent CAN data corruption traced to a missing volatile qualifier. Discovered by disassembling the ELF: the compiler optimized out a re-read of a DMA-updated CAN mailbox register. One-line fix after 2 days of hunting.

firmwaredebugging
Aug 8
Arm runaway → limp-enable safety

Motor runaway during testing drove the arm into a hard stop at full torque. Implemented a limp-enable protocol: motors power up in zero-torque mode and ramp stiffness only after a handshake with the main controller confirms safe state.

firmwaresafety
Aug 15
Standby with overload protection

Final firmware build (fw29): implemented standby mode with continuous torque monitoring and automatic limp on overload. Froze the TTL protocol at V7 with 12 commands. Three arms passed 5,000+ continuous scooping trials.

firmwaremilestone

Highlights

  • Rescued a stalled project by designing all electrical, firmware, and control systems for a demo-ready inverted 4-DOF robotic arm within 6 weeks
  • Product verified at Pet Fair Asia, ran nonstop for 10 hours every day during the 5-day expo.
  • Built STM32 firmware, arm controller PCB schematic and layout, sim-to-real MuJoCo pipeline and control algorithm.