Posts | Comments

Planet Arduino

Archive for the ‘Inverted Pendulum’ Category

Graduate students Ben Wiener and Philip Zucker have been working on a classic controls problem for quite some time called an “inverted pendulum.” This type of device balances a stick on an axis, and in this implementation, a motor pulls the axis assembly that the pendulum—a paint stirrer—is sitting on to keep it stable.

Control is handled by an Arduino Uno, which measures the angle of the stirrer as well as the position of the axis via a pair of encoders.

The inverted pendulum or cart pole is a classic problem in control theory. It’s in OpenAI Gym of course, but we wanted to see it work in real life, not some lame simulation. 

It took a few iterations, but we eventually found a system that works well. Our cart is 3D printed PLA driven by a DC motor via a toothed belt. The pole itself is a paint stirrer. One of the longer type, about 24″. A rotary encoder opposite the motor acts as a pulley for the belt and allows us to track the motion of the cart, while a second rotary encoder on the cart is a pivot for the pole and measures its angle. The motor is controlled by a 32 amp Sabertooth motor controller. It’s overkill, and pretty expensive at about $120, but we already had it for another project. We monitored the encoders with an Arduino. The foundation of the system is a piece of extruded aluminum rail called V-Slot, on which the cart slides and the motor and encoder are mounted. Our rail is 1.5 m long, from a company called  .

Code for the setup can be found on GitHub and be sure to see it in action in the video below, as it swings the wooden stick from rest into a vertical position.



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook