Real-time control of an Inverted Pendulum using FLEX + ERIKA

At DCS, ESAII, UPC (Distributed Control Systems group, Automatic Control Department, Technical University of Catalonia), Barcelona, Spain, an Inverted Pendulum was controlled using FLEX board with the ERIKA real-time kernel.



The FLEX Base Board and the FLEX Multibus Base Board with a Multibus RS232 module was used for both swinging-up and maintaining the inverted equilibrium.
A real-time periodic control task implemented two controllers. The first controller designed using energy based methods was for swinging-up and the other, designed with standard pole placement, for maintaining the inverted equilibrium. Switching between controllers was decided according to whether the inverted pendulum was in the convergence zone (small rank around the inverted equilibrium). Only two out of four variables were available: cart position and pendulum angle. Hence, cart velocity and angular velocity were obtained from two consecutives positions and angles, respectively.
RS232 communication was used for monitoring the pendulum state using a simple Visual Basic application acting as oscilloscope.


  • Antonio Camacho
  • Manel Velasco
  • Pau Martí


  • Visual Basic


  • FLEX Base Board
  • FLEX Multibus Base Daughter Board
  • FLEX Multibus RS232 module
  • Inverted Pendulum setup




External links

Distributed Control Systems Group

Demo video

Real-time control of an Inverted Pendulum (Front view)

Real-time control of an Inverted Pendulum (Lateral view)