Inverted Pendulum For The Control Enthusiast

Once you step into the world of controls, you quickly realize that controlling even simple systems isn’t as easy as applying voltage to a servo. Before you start working on your own bipedal robot or scratch-built drone, though, you might want to get some practice with this intricate field of engineering. A classic problem in this area is the inverted pendulum, and [Philip] has created a great model of this which helps illustrate the basics of controls, with some AI mixed in.

Called the ZIPY, the project is a “Cart Pole” design that uses a movable cart on a trolley to balance a pendulum above. The pendulum is attached at one point to the cart. By moving the cart back and forth, the pendulum can be kept in a vertical position. The control uses the OpenAI Gym toolkit which is a way to easily use reinforcement learning algorithms in your own projects. With some Python, some 3D printed parts, and the toolkit, [Philip] was able to get his project to successfully balance the pendulum on the cart.

Of course, the OpenAI Gym toolkit is useful for many more projects where you might want some sort of machine learning to help out. If you want to play around with machine learning without having to build anything, though, you can also explore it in your browser.

21 thoughts on “Inverted Pendulum For The Control Enthusiast

  1. Ok… help me out. Application? Writing upside down, in space? (Almost an oxymoron, eh?) So.. we did thus, w a pencil, as kids. Now, try to find a pencil… Now we will be able to entertain Martians via Virtual Presence? (See also, K. Dean Stephens.) C’mon… before I have to look for a pencil sharpener. (Pentel no longer produces the one I loved.) Yes… a fInger 🙄 of speech. I use a knife. If in ‘Frisco, see the nice big one that runs a tallll clock at the Exploritorium. Take the kids. (Robot jugglers? Will they semi-commit “errors” as they tell jokes which are simoultaneously PG and PG17 rated.?)

  2. Hackaday folks, please stop using animated GIFs and use HTML5 video instead. Real video looks better, compresses better (that GIF is 1.6 MB, a low-resolution three-second video would be super tiny by comparison), and can be paused. Surely WordPress supports it, since HTML5 video has been around for several years.

      1. There are plenty of problems with using GIFs for video other than loading time, some of which I outlined above. Heck, thee are problems with file size other than loading time: not everyone can afford an unlimited data plan. Also, there are hackers in less privileged areas where high speeds aren’t available.

      2. I am terribly sorry for living in a country without real mobile flatrates. There are many occasions where two megabgtes over my 4G-connection is a lot. Therefore I hate webpages with “mandatory” animated GIFs.

    1. Unlimited data plans are expensive, and a lot of people use phones on the bus.

      “We don’t need to optimize this software because hardware is getting better all the time” is usually not all that true.

  3. I saw an inverted pendulum done in 1978 with just four op-amps, two potentiometers and a plane-jane DC brushed motor. No computer, no encoders, DACs, ADCs, or code. No simulations. Just a controls engineer guy who knew what he was doing. I was blown away. I’ve been trying to do it off-and-on ever since, but I can’t replicate that wizard’s feat. I did it digitally with a 25 MHz ‘486 around 1993, but that’s cheating. I think throwing even an Arduino at the problem is still cheating.

    I’m still trying to figure out how to do it with only 4 opamps. Maybe now that the Great Google is here I should look there for some inspiration.

    1. I think you can control one with nested PID loops or similar. If you need non-zero I and D terms then that’s about 3 op-amps without even applying some cleverness; I expect you could do it with two.

  4. My college roommate could balance just about anything on his nose.
    While waiting in line at the grocery we’d ask him to balance random stuff. Umbrellas, VHS tapes, etc. It was a hoot.
    It was an interesting talent. I wonder why and how his brain and body were able to do that?

    1. It’s probably a human skill from prehistory that hasn’t been lost. It’s common still for africans to carry water pots on their heads for long distances. I guess keeping the spine straight is important to avoid back injury which could occur by carrying with one hand.

  5. Now do this with a trombone and you will have musicians mesmerized for huge amounts of time … then you can pick their pockets … “Bender: (Just a head; his body is gone) It’s me bender. I’m being entertaining. [Sings] La la la. Look at my head. It’s okay to look at my head. I’ve got big old head and hey hoo. (Bender’s body steals Amy’s wallet) Okay show’s over I’m tired.” :-) 🦊

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.