STABILIZED Sliding Inverted Pendulum
I have designed, built, and tested a sliding inverted pendulum display for the purpose of S.T.E.M outreach. This project took a year and a half to complete in weekends and after work hours. The path from concept to functioning hardware required learning new skills such as printed circuit board (PCB) design, proto-threaded software development, and cable design. This project also served as an exercise and refresher in the areas of circuit design, mechanical design, dynamics, and linear controls.
Electrical Design
The controller box for this display is responsible for inputing wall power, optical encoder signals, serial communication over USB, and user interface inputs while outputting controlled motor power. Wall power is transformed and rectified to 12V DC for driving H-bridge mosfets and a cooling fan. From there, the 12V power is regulated to 5V DC for powering optical encoders, status lights, limit switch, and an Arduino Mega microcontroller. A custom printed circuit board facilitates this DC power stepping as well as housing surface mounted pull-down resistors and cable sockets.
Mechanical Design
The mechanical design consists of cut and drilled aluminum plate (red), extruded aluminum rails, and off the shelf components. A cart is positioned on-top of the track and is propelled by a belt and pulley system. Three pulleys interface with the belt. One free rotating, one driving an optical encoder (green), and one driven by a motor (grey).
On-top of the cart is the fulcrum assembly. The fulcrum assembly houses an eye bolt which transmits pendulum angular position through two gears (grey and gold), to a second optical encoder (purple). Through the eye of the eye bolt mounts a long all threaded rod which serves as the pendulum.
Software Design
The control software for this project runs on an Arduino Mega and is written in C++. A series of routines are written as proto-threads and are repeatedly checked by the main loop. These routines include:
System diagnostics including checks for limit switch collisions, motor stall, actuator out of bounds, and CPU overuse
User interface command parsing
Control law calculations
Measurement filtering
Motor switching
The protothreads are scheduled relative to the previous execution allowing for execution times to shift into computational lulls. Late thread executions are tracked and a warning is issued if the system falls critically behind. Outside of the protothreads, Interrupt routines are utilized for tallying optical encoder pulses and tracking angular positions.
Control Law Design
The basic control law for this display includes a PID outer loop targeting a cart position and commanding a pendulum angle combined with an inner loop targeting the angle command and commanding motor power.