← Back to Portfolio

Ghost Rider – Self-Balancing Unicycle

Skills: Control Systems, PID Tuning, Sensor Fusion, Embedded Systems, Real-Time Systems, Mechanical Design, Sensor Fusion, CAD (Solidworks), 3D Printing, Machining, Structural Mounting, Hardware Debugging

Project Overview

The Ghost Rider is a self-balancing unicycle developed as part of Northwestern’s EE 327 course. Its aim was to autonomously stabilize in both sagittal (front–back) and coronal (side-to-side) planes using a DC Motor Driven Wheel and a servo-driven counterweight. Orientation feedback comes from an IMU running a tuned Madgwick filter, with separate PID controllers for each axis.

While the final prototype could not balance entirely unaided, it demonstrated clear self-stabilizing responses to disturbances. Future improvements would involve nonlinear iLQR control rather than PID for better trajectory tracking and realistic unicycle dynamics.

Lessons Learned

This project didn’t go exactly as planned, but it provided valuable growth opportunities. Below are key lessons we learned throughout the quarter:

Design Constraints and Requirements

Since self-balancing unicycles are uncommon, we defined key project parameters, including budget and motor specs. Some of our core calculations are outlined below.

Torque in front plane Torque in side plane

Mechanical Design

The design was my primary focus. Starting from an existing unicycle, we adapted and modified it extensively. Below is an overview of the design elements:

Assembly Counterweight motor and coupling Wheel motor and coupling Seat and mounting

System Architecture

Control is handled by an ESP32 microcontroller running FreeRTOS, with tasks for motor control, IMU reading, servo actuation, and web-server monitoring. Synchronization uses semaphores and mutexes to ensure real-time safe operation.

System block diagram

IMU Sensor Fusion

The Madgwick filter fuses accelerometer and gyroscope data into quaternion orientation estimates:

\[ q(t+\Delta t) = q(t) + \frac{1}{2} q(t) \otimes \omega(t)\Delta t - \beta \cdot \nabla f(q) \]

We customized \(\beta\) dynamically using RMS accelerometer magnitude to reduce noise during motion.

Performance & Limitations

Wheel Motor: Stable against pitch disturbances, but prone to overshoot and oscillations.

Counterweight Motor: Not robust; jitter from noisy IMU signals led to mechanical wear.

Limitations: Mechanical fragility, loosening fasteners from vibration, lack of full autonomous balance.

Challenges

Next Steps