3D-Printed Self-Balancing Robot Brings Control Theory To Life

A DIY self-balancing robot

Stabilizing an inverted pendulum is a classic problem in control theory, and if you’ve ever taken a control systems class you might remember seeing pages full of differential equations and bode diagrams just to describe its basic operation. Although this might make such a system seem terribly complicated, actually implementing all of that theory doesn’t have to be difficult at all, as [Limenitis Reducta] demonstrates in his latest project. All you need is a 3D printer, some basic electronic skills and knowledge of Python.

The components needed are a body, two wheels, motors to drive those wheels and some electronics. [Limenitis] demonstrates the design process in the video below (in Turkish, with English subtitles available) in which he draws the entire system in Fusion 360 and then proceeds to manufacture it. The body and wheels are 3D-printed, with rubber bands providing some traction to the wheels which would otherwise have difficulty on slippery surfaces.

A PCB driving two stepper motors
The PCB has just a few components, with most of the complexity handled by plug-in modules.

Two stepper motors drive the wheels, controlled by a DRV8825 motor driver, while an MPU-9250 accelerometer and gyroscope unit measures the angle and acceleration of the system. The loop is closed by a Raspberry Pi Pico that implements a PID controller: another control theory classic, in which the proportional, integral and derivative parameters are tuned to adapt the control loop to the physical system in question. External inputs can be provided through a Bluetooth connection, which makes it possible to control the robot from a PC or smartphone and guide it around your living room.

All design files and software are available on [Limenitis]’s GitHub page, and make for an excellent starting point if you want to put some of that control theory into practice. Self-balancing robots are a favourite among robotics hackers, so there’s no shortage of examples if you need some more inspiration before making your own: you can build them from off-the-shelf parts, from bits of wood, or even from a solderless breadboard.

8 thoughts on “3D-Printed Self-Balancing Robot Brings Control Theory To Life

  1. When the tank on top gets empty the balance behavior has to change? How do they do it? With lower voltage the PID gets a different value ? Just kidding… nice project. But do batteries change their weight when they get empty ? :P

  2. That steppermotor diagram @01:52 is horribly distorted and I was wondering how that would ever work with a bipolar motor. At the end of the video ( @16:05 ) you can see two pretty much standardized (Stepstick?) stepper motor drivers.

    Apart from that the video looks quite good.

    Now next step a double pendulum and then a “triple pendulum on a cart” ?

  3. The inverted pendulum is one of the typical cases where a fuzzy logic controller should outperform the more common PID controller.
    Might be interesting to see a comparison of the two for this device.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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