Watch An Inverted Pendulum - Arduino-Driven
Written by Mike James   
Saturday, 02 June 2018

If you have never seen an inverted pendulum in action - it's fun. What is even more fun is implementing one. Is it IoT? Is it control theory? Is it AI? It can be any and all - and did I mention it's fun?

What is an inverted pendulum?

Well if you pick up a stick and try and balance it on your finger you have the right idea. Most inverted pendulums are implemented as a small driven cart with a lever pivoted at a hinge on the cart. The cart can move left and right and by doing so it can apply an acceleration  - or if you like a force - to the end of the pendulum:

invetedpen

 

There are a number of variations on the basic idea - the one in the video, for example, has a 360 degree pivot and so starts from a hanging down position. 

This is a classic problem in control theory and it was one of the first problems I solved using reinforcement learning - but it was only a simulated inverted pendulum, the real thing is so much better.

Ben Wiener and Philip Zucker built ZIPY - Zippy Inverted Pendulum Yakshave -  after taking a course in under-actuated robots and wanted something that wasn't just a "lame simulation".

The real world also has a way of making things more difficult than a simulation. The hardware is a 3D printed cart with a DC motor and belt drive. The pendulum, a paint stirrer, is hinged on a rotary encoder which measures the angle. A second rotary encoder is attached to the belt and gives the position of the cart. The controller is an Arduino Uno, which limited the precision to 600 positions per revolution.

The software implements two controllers - one to get the pole swung up into position and another to keep it there. The balancing controller is based on a linear quadratic regulator (LQR) implemented in Python.

You can see the results:

 

So far it is interesting to discover what didn't work. Monitoring the position using markers and OpenCV vision system sort of worked, but was more difficult than expected due to spurious objects in the frame and the processing delay. So far they haven't implemented a reinforcement learning algorithm.

If you fancy trying your hand all of the code and the 3D printer files are available. It is worth doing projects like this just to find out what the world is really like.

More Information

ZIPY — A Homebrew Inverted Pendulum and Control System

Related Articles

Worm Balances A Pole On Its Tail

The Amazing Dr Guero And His Walking Robots

Cubli - A Reaction Wheel Drive Robot

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


Google Demands Dev Identity For All Android Apps
27/08/2025

As one door opens another closes. Just as we start to see some opening of the Android and Apple walled gardens Google is making a move to restrict who can create code for Android. 



One Thousand Wooden Block Display
31/08/2025

Would that be 1K woodels? This is a crazy project that almost demands that someone tries to implement an alternative. Of course, you could do it. But first read something about the difficulties.


More News

pico book

 

Comments




or email your comment to: comments@i-programmer.info

 

 

 

Last Updated ( Monday, 04 June 2018 )