Inverted Pendulum Project with stm32f4

Hello guys,
I would like to introduce you to my homemade project: “Inverted Pendulum“.


This homemade linear cart is a playground for control engineers. One can make a position control or a crane with pendulum control. But the goal is to make an “inverted pendulum“. This project is very time consuming. You need knowledge of control engineering. In addition, the actuators and sensors are very expensive new! Buyer at, for example ebay, there are always surprises. My advice: always buy everything 2 times! Or You will never get done.



  • stm32f4discovery
  • FT2232H
  • EVAL6205N
  • Maxon Motor RE 35 with HEDL 5540 A11
  • HEDM 5500 B13
  • INA Rail linear Guides
  • Power Supply
  • Oszilloskop


  • Waijung Blockset
  • Keil uVision
  • Matlab


Matlab Konfiguration:



  1. This is a ‘real time’ system, so set “blocking mode” as transfer!!!
  2. For the Encoder_Motor set “reset counter”.
  3. Take a motor which is fast enough with a very small gear ratio like 3:1 or better without one.
  4. Which PWM scheme or frequency should I use?

I have three control paths:

  • PI-Controller
  • Crane Pendulum
  • Inverted Pendulum

In a few words I try to explain how you should proceed. The PI Controller I will use to swing up the pendulum.
For example somebody can try to swing up with “Fuzzy Logic“. But nevertheless I will not go into it.

On this site you can find information about modeling.



Fist Start:

This video shows you my advance.


Second Start:


Thanks for watching