Segfault at MITERS


SEGFAULT is an attempt at implementing in hardware principles visited by the control theory and feedback control courses I have taken. The goal is to create a rideable, self-balancing (Segway-like) vehicle whose controller is implemented in continuous-time using “linear time invariant” components and operational amplifiers. Successful completion of the project constitutes demonstrating a connection between the theoretical models presented in classwork and physical hardware with its nonlinearities and nonidealities. Also, custom Segway.


A Segway-type vehicle is a classic inverted pendulum control problem that is solvable in two degrees of freedom for the simplest models. The vehicle attempts to correct for an induced lean angle by moving forward or backwards, and the goal is to return itself to vertical. Or at least not fall over. A more advanced model introduces ground position control (X and Y) as two more degrees of freedom and allows the vehicle to stand still on hills, or react to disturbances substantially better.

SEGFAULT uses a complementary filter [Lilienkamp pp. 295-311] to gather information about its orientation from two sensors, a rate gyroscope and accelerometer. The rate gyro handles sudden movements and high frequency disturbances, and the accelerometer is only used for long term (low frequency) correction of gyroscope drift. This complementary (not a Kalman filter) sensor setup has historically been used for dead-reckoning and inertial navigation systems.

The output of the filter is an angle value, which acts as the input to a PI compensator. The desired setpoint is always zero angle. The  PI compensator drives a bidirectional DC motor amplifier to control the linear force applied by the vehicle at the ground, which not only moves the vehicle but also counters the user’s lean.

Segfault’s second Fall 2010 build report contains much of the detailed theory behind the filter.


SEGFAULT’s controller, the Adaptive Face-Forward Compensator, is implemented using twelve LMC6484 rail-to-rail I/O op amps (three quad packages). The sensor signals are first made symmetric about 0 volts by subtracting their DC offsets. The signals are then complementary filtered and summed to produce an angle value. The angle is the input to a user-tunable PI compensator, whose output comprises two square waves of constant frequency and varying duty cycle which command DC motor H-bridge amplifiers using the Class D amplifier architecture.

Figure 1: The Adaptive Face-Forward Compensator

Figure 2: The Class-D amplifiers which drive the H-bridges

The gains of the PI compensator are user-adjustable via knobs on the control panel. There is also a K knob which controls the overall system gain to sweep a small section of a root locus.

which means

SEGFAULT is a statically (and dynamically) unstable system that a closed-loop controller attempts to hold in a stable regime. THAT YOU RIDE ON.

Like this.

Work on SEGFAULT is ongoing and the build reports are being continually updated. The epic tale of my sensor-reading journeys may be found in the build report category. Please note that the circuits above are strictly for reference and are not usable as-is due to the number of hacks I had to make during completion. They are detailed in the build reports.


Vehicle 2 wheeled Segway-like
Drivetrain 27:1 spur gearbox

9″ scooter wheels

Mechanical 6061 and 2024 Aluminum structure
Motor 2 x Banebots P80 27:1
Controller Custom dual H-bridges
Battery 10AH 24v Lithium iron phosphate
Instrumentation A cool DEGREES gauge

P, I, K gain knobs

Sweet-ass 7-bar LED battery gauge

Top Speed i MPH
Range Untested
Curb Weight 42 pounds