Modeling
We use Lagrange's method to model the system.
Find total potential energy
According to the reference frame above, the cart has zero potential energy. Therefore, the total potential energy is:
Find total kinetic energy
Translational kinetic energy of the cart is:
Translational kinetic energy of the pendulum is:
Rotational kinect energy of the pendulum is:
Ignore the translational kinetic energy of the air cylinder, the total kinetic energy is:
Lagrange's equation
The Lagrangian is:
In this model, we ignore the force that pendulum acts on the cart, and we ignore friction on the cart, ignore friction on the shaft of the rotational encoder. So, the Lagrange's equations are:
Which will result in:
eq(1) |
Model the proportional valve
Denote "a" the area of pneumatic cylinder's piston, "p" the air pressure. From physics, we know that the total force acts on piston is:
Also, from datasheet of the proportional valve, one could learn that the relationship between input voltage and output pressure is:
Here "-" in "-Pmax" indicates different output ports, it doesn't mean a negative value (for more detail, please refer to VIDEO 3). So, we have
Insert the above equation into eq(1), solve for
We will have the state space representation of the pneumatic inverted pendulum:
So, the result is:
Select states as below:
Therefore,
Use Taylor's approximation to linearize the system at the following equilibrium point
So our linear time invariant state space model is:
Where

Note that
I used software "Wolfram Mathematica 8" to solve the above equations. The Mathematica file is available in DOWNLOAD section.
The input voltage is:
Note that in hardware, for aesthetic reasons, port 2 of the proportional valve is connected to the head port of the air cylinder, and port 4 to the base port; respectively. But according to our mathematical model, these connections should be revised. So, I made a software change and flipped the control input. Since the proportional valve is originally controlled by 0-10V, the flipped input will be:
So, this is the input voltage for the proportional valve. The Arduino should output the control signal to the DAC circuit to generate this voltage for proportional valve.