Making an Inverted Pendulum using LEGO MINDSTORMS EV3

Introduction

  1. A physical, programmable cart equipped with the necessary sensors and motors
  2. The usage of control theory to move the cart based on the sensor input

Significance

The Physical System

Physical Components

EV3 Intelligent Brick [2]

  • Arm 9 + Linux OS
  • Four input ports with sampling rate of 1000 samples/sec
  • Four output ports (motor control)

Large Motor [3]

  • One degree of accuracy
  • 160–170 RPM
  • Running torque* of 20 N cm
  • Stalling torque** of 40 N cm

Medium Motor [4]

  • One degree of accuracy
  • 240–250 RPM
  • Running torque* of 8 N cm
  • Staling torque** of 12 N cm

Gyroscopic Sensor [5]

  • 3 degrees of accuracy
  • Maximum angular velocity reading of 440 degrees/second
  • 1 kHz sampling rate

Multi-functional MindSensor [6]

  • Accelerometer accuracy within 10 milli-g
  • Gyroscopic rate accuracy within 8.75 milli-degrees/sec
  • Used to measure acceleration of cart

EV3 Cables [7]

  • Come in varying lengths

Physical Changes

Motor Placement

Gear Ratio

Rod Sturdiness

Rod Center of Mass

Rod Length

Usage of Medium Motor/Encoder

Mounting of Gyroscope

Final Cart and Pendulum

  1. Red accelerometer (placed above the front two wheels)
  2. EV3 Programmable Brick (mounted towards the rear of the robot)
  3. Large motors (the white drum-shaped piece visible in [D] between the two wheels)
  4. Cables used to connect these components together (both grey and black)

Derivation of the Equations of Motion

Analysis of the Obtained Equations

Using Proportional-Integral-Derivative (PID) Control

Introduction to PID Control

  1. ε — the current error (proportional)
  2. Δε — the summation of error (integral)
  3. dε — the rate of change of error (derivative)
  1. Sum = (kP ✕ ε ) + (kI ✕ Δε ) + (kD ✕ dε )

Implementing PID Control using LEGO Mindstorms EV3 Software

Tuning the System

  1. Rise time (this factor bears no significance for the LEGO pendulum since it its starting position is upright as the motors simply lack the torque for a swing up)
  2. Overshoot (swinging the rod past the target angle of 0 degrees)
  3. Settling time (time taken for the rod to stabilize at the target angle)
  4. Steady State Error (the movement of the cart at the rod’s stable position)

Conclusion and Applications

References

  1. Kafetzis, Ioannis, and Lazaros Moysis. Inverted Pendulum: A System with Innumerable Applications. School of Mathematical Sciences, Aristotle University of Thessaloniki, Mar. 2017.
  2. “EV3 Intelligent Brick 45500: MINDSTORMS®: Buy Online at the Official LEGO® Shop US.” 45500 | MINDSTORMS® | Buy Online at the Official LEGO® Shop US, 18 Aug. 2019, www.lego.com/en-us/product/ev3-intelligent-brick-45500.
  3. “EV3 Large Servo Motor 45502: MINDSTORMS®: Buy Online at the Official LEGO® Shop US.” 45502 | MINDSTORMS® | Buy Online at the Official LEGO® Shop US, 28 Aug. 2019, www.lego.com/en-us/product/ev3-large-servo-motor-45502.
  4. “EV3 Medium Servo Motor 45503: MINDSTORMS®: Buy Online at the Official LEGO® Shop US.” 45503 | MINDSTORMS® | Buy Online at the Official LEGO® Shop US, 6 Sept. 2019, www.lego.com/en-us/product/ev3-medium-servo-motor-45503.
  5. “EV3 Gyro Sensor 45505: MINDSTORMS®: Buy Online at the Official LEGO® Shop US.” 45505 | MINDSTORMS® | Buy Online at the Official LEGO® Shop US, 19 Oct. 2019, www.lego.com/en-us/product/ev3-gyro-sensor-45505.
  6. “Gyro, MultiSensitivity Accelerometer and Compass for NXT or EV3.” Mindsensors.com, www.mindsensors.com/ev3-and-nxt/15-gyro-multisensitivity-accelerometer-and-compass-for-nxt-or-ev3.
  7. “EV3 Cable Pack 45514: MINDSTORMS®: Buy Online at the Official LEGO® Shop US.” 45514 | MINDSTORMS® | Buy Online at the Official LEGO® Shop US, www.lego.com/en-us/product/ev3-cable-pack-45514.
  8. Takasaki, Bruce. “The Basics of Torque Testing.” Quality Magazine RSS, Quality Magazine, 14 Sept. 2012, www.qualitymag.com/articles/87967-the-basics-of-torque-testing.
  9. Coller, Brianno, director. Classic Inverted Pendulum — Equations of Motion . YouTube, YouTube, 18 Mar. 2015, www.youtube.com/watch?v=5qJY-ZaKSic.
  10. Controlling the Inverted Pendulum. Example of a Digital Feedback Control System., daviddeley.com/pendulum/pendulum.htm#page1a.
  11. “Inverted Pendulum: System Modeling.” Control Tutorials for MATLAB and Simulink — Inverted Pendulum: System Modeling, ctms.engin.umich.edu/CTMS/index.php?example=InvertedPendulum§ion=SystemModeling.
  12. Zhong, Jinghua. PDF Controller Tuning: A Short Tutorial. Purdue University, 2006.
  13. Witzand, Steven J. Coordinate LEGO Segways. The University of New South Wales , Nov. 2009.
  14. Masakakatsukawata, director. Inverted Pendulum on a Cart (LEGO MINDSTORMS EV3). Youtube , Dec. 2014, www.youtube.com/watch?v=vQ607X6Rid4.
  15. Xu, Xu, et al. Case Studies on Nonlinear Control Theory of the Inverted Pendulum.
  16. Mbuthia, M., and P. Musau. Design and Implementation of a Digital Controller for a Walking Robot Using LEGO Components . University of Nairobi, 24 Apr. 2015.

--

--

Just having some fun :) https://linktr.ee/advitdeepak

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store