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


Apache Lucene Adds Similarity Vector Searches
27/02/2024

Apache Lucene 9.10 has been released with support for similarity-based vector searches. Other improvements include block join compatible index sorting, and several improvements to ensure the software  [ ... ]



Google Donates $1M To Rust
26/02/2024

Google has made a donation of $1 million to The Rust Foundation. The contribution has been earmarked to underwrite the Interop Initiative: a new C++/Rust interoperability effort.


More News

raspberry pi books

 

Comments




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

 

 

 

Last Updated ( Monday, 04 June 2018 )