Modeling

We use Lagrange's method to model the system.

inverted_pendulum

Find total potential energy

According to the reference frame above, the cart has zero potential energy. Therefore, the total potential energy is:

eq3

Find total kinetic energy

Translational kinetic energy of the cart is:

eq4

Translational kinetic energy of the pendulum is:

eq5

Rotational kinect energy of the pendulum is:

eq6

Ignore the translational kinetic energy of the air cylinder, the total kinetic energy is:

eq7

Lagrange's equation

The Lagrangian is:

eq8

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:

eq9

Which will result in:

eq10 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:

eq11

Also, from datasheet of the proportional valve, one could learn that the relationship between input voltage and output pressure is:

input_pressure

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

eq12

Insert the above equation into eq(1), solve for

eq13

We will have the state space representation of the pneumatic inverted pendulum:

eq14

So, the result is:

14_result

Select states as below:

eq15

Therefore,

eq15_derivative

Use Taylor's approximation to linearize the system at the following equilibrium point

eq16

So our linear time invariant state space model is:

eq17

Where

eq18

Note that

18_dfdx

I used software "Wolfram Mathematica 8" to solve the above equations. The Mathematica file is available in DOWNLOAD section.

The input voltage is:

eq19

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:

eq20

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.