Could not download file: This paper is available to authorised users only.


T. Alvarez, S. Gonzalez, J. Romo, J. Gómez

University of Valladolid (SPAIN)
Who has not tried to keep a pen balanced on its point? How much time would it take to fall over? This is one of the simplest examples of an inverted pendulum, which is a very appealing and challenging control problem, because the system is unstable. The enticement, the attraction is that we know that the pen will, eventually, tumble, but we want to delay this moment as much as we can.
Engineers study subjects such as Robotics, Real Time Systems, Instrumentation, Automatic Control and Programming Languages. We were looking for a real system where knowledge acquired in different areas could be applied. The inverted pendulum seemed a good candidate.
First a two-wheeled inverted pendulum robot was designed and built. The robot behaves like nBot ( The closer commercial version would be Segway (
The robot has been called TWIP (Two Wheeled Inverted Pendulum). Let’s describe TWIP’s basic components. There are two wheels at the base and a body of two shafts or rods (1 meter long). The sensors and batteries can slide up and down the bars. So, stability test can be easily carried out. The microcontroller is also attached to the shafts. Its hardware and software has been designed using the Arduino platform. The instrumentation consists of a distance sensor (GP2Y0A21YK, Sharp), an accelerometer (ADXL203, ANALOG DEVICES) and a gyroscope (ADXRS150, ANALOG DEVICES). To obtain the data that will be transferred to the controller, we can use the distance sensor (the default option) or the pair accelerometer- gyroscope (this option incorporates sensor fusion).

The balancing robot can be used in the classroom and laboratory in different ways. These are some examples:
a) Robotics, Instrumentation and Real Time Systems. A document describing the steps towards the constructions of TWIP is provided. All the elements are described. Students learn about the relevant elements and how to connect them. Items such as an accelerometer or a gyroscope are seen in their context. A practical demonstration can follow.
b) Basic Automatic Control. The PID controller is one of the most widespread controllers used both in academia and industry. It is basic that future engineers know how to tune it and the importance of the three basic parameters that determine its behavior. Our robot has been equipped, by default, with a PID controller, it can be tuned and/or adjusted with three potentiometers. It is recommended that students test, first, the controller in simulation (the tool is also provided) and then applied to the real system. This way they learn the differences between simulation and real world. Students have been very enthusiastic and they had a great time comparing different tunings: some were really good and the robot balanced very well and others were not so good and the robot hit the floor rather fast!
c) Advanced Control, Real Time Systems and Programming. Advanced students can program their own controller (it should be any type: lead, lag, predictive, robust …). Test it in simulation. And finally transfer it to the microcontroller (they learn about the Arduino platform).