UBC Open Robotics · Firmware Co-lead
A motorized knob that turns electrical circuit behavior into physical feedback. Rotating it lets users feel resistance, spring-like restoring force, and inertia through a mechanical analogy: voltage corresponds to torque, current to angular velocity, and charge to angular displacement. As firmware co-lead, I designed the control system and its high-level theory, including how electrical circuit behavior maps to mechanical torque feedback. I also implemented the embedded firmware and designed the control loops, encoder feedback, and current-sensing integration.
Firmware architecture
- Developed C/C++ firmware for the ESP32-S3 using FreeRTOS and SimpleFOC. The control architecture combines the inner motor loop with an outer haptic-model update every fifth cycle, holding the latest current command between model updates.
- Organized measured state, runtime settings, motor commands, and fault flags through shared-state interfaces, with separate telemetry and watchdog modules.
Motor control and feedback
- Integrated an MT6701 magnetic encoder over SSI/SPI and MCP3204-based phase-current sensing on separate SPI buses.
- Implemented FOC-based BLDC torque control using a six-PWM driver interface. The hardware layer configures 30 kHz PWM and d/q current-loop PID gains, translating model torque requests into bounded q-axis current commands.
Circuit models and tuning
- The model code includes resistor, capacitor, inductor, diode, and RLC modes. It uses velocity-dependent resistance, displacement-based restoring torque, filtered acceleration feedback, and state updates for virtual RLC current and capacitor voltage.
- Filtering, deadbands, damping, and torque/current limits condition the feedback commands. Serial telemetry and command handlers support model selection, angle zeroing, parameter adjustment, and per-mode PID tuning.
Tech: ESP32-S3, C/C++, FreeRTOS, SimpleFOC, PlatformIO, BLDC, FOC, SPI/SSI, MT6701, MCP3204, current sensing, PID