Skip to content

ferrolho/rotary-inverted-pendulum

Repository files navigation

Rotary Inverted Pendulum

Watch the build video

A DIY rotary inverted pendulum you can print, solder, and train at home — for about £20 in parts. It's an open, hackable take on the rigs you'd usually buy from a lab-equipment vendor (Quanser's QUBE Servo 2 lists at around £4,500). The pendulum balances itself with a reinforcement-learning policy trained in simulation, fine-tuned on the real hardware, and quantised to run on an Arduino Nano.

What's in this repo

Directory Contents
meshes/, urdf/ 3D-printable STLs and the URDF model (single source of truth for pendulum geometry)
diagrams/ Wiring diagrams and component photos
RotaryInvertedPendulum-arduino/ Firmware — low-level server, hand-tuned PID, on-device RL controller
RotaryInvertedPendulum-python/ Sim env, SAC training, system identification, real-hardware bridge, distillation and int8 export
RotaryInvertedPendulum-julia/ MPC/LQR exploration and MeshCat visualisation
docs/ Build runbook, BOM, electronics design, RL stack documentation

Where to start

Prefer to buy rather than build?

DIY kits run $100–$200 on AliExpress; the Quanser QUBE Servo 2 mentioned above is around £4,500.

Related work

Acknowledgments

I would like to thank the following people for their contributions to this project:

  • Joe for suggesting I try reinforcement learning with Stable Baselines 3, which kicked off the learned-control parts of this project.
  • Mykha for early discussions about this project over a beer in the park.
  • André, Rafael, and Vlad for technical discussions, feedback, and support.
  • Vivek for his invaluable help and feedback on the electronics of the system.
  • 心诺 (Xinnuo) for her company and support while working on this project.

Finally, I would like to thank the open-source community in general for providing the tools and resources that have also helped make this project possible.

About

A low-cost, open-source rotary inverted pendulum.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors