Advit Deepak
2 min readFeb 16, 2021


Hi Lucy,

Glad to help!

I'll preface this by saying my Inverted Pendulum never stabilized for more than a few seconds at a time. As a result, I personally would recommend steering away from Lego Mindstorms to build an Inverted Pendulum.

According to the official Lego website, the EV3 Gyro Sensor has an accuracy of +/- 3 degrees. This is rather large considering how sensitive this system is. Using the Mindsensors AbsoluteIMU-ACG will help decrease this variability, with its website stating an accuracy of +/- 1 degree. However, working with controllers and sensors such as Arduino and the Adafruit 9-DOF IMU might be cheaper, easier, and more accurate.

In terms of the physical design. ensure that your chassis is strong and well-connected. Make sure your rod is as sturdy as possible and that your wheels are wide enough to maximize traction. Any wobble or unwanted movement will mess the stabilization. Try to keep the surface consistent between runs (for example, I finetuned on a wooden floor). Additionally, it might help to build a track or groove system for the cart to run on in order to constrain its motion to one dimension.

Regarding the rod, ensure that its center of mass is as far from the hinge as possible (towards the unattached end). Having a longer length results in less torque needed. An example of this can be seen if you try to balance a rod with a mass attached at the end in your palm. If the mass is near your palm, it is a lot harder to balance than if the mass is on the other end.

For the control system, it might help to check out Lego EV3's GyroBoy. This page includes a PDF of the program required to balance a simple robot on its vertical axis. Although its not the exact same as an inverted pendulum, its control system is somewhat similar. Giving it a quick read through might help to program the control system.

Finally, just remember to keep experimenting and pushing forward! It might be challenging, but seeing your cart system finally work is definitely worth it :)

Good luck!