Note: the flow control valve is unused.
Control circuit board
Note that the “black green red yellow” in linear encoder diagram are just merely the color of wires. You might have different ones, but after watching VIDEO 3, it should be clear on how to use a linear encoder–the connection and programming are similar to rotational encoder. The operational amplifier should be connected to the +12 and -12 power supplies (not depicted). As noted above, if using separate power supplies, they must share a common ground.
Visit arduino.cc to learn more.
The rotational encoder used in this project is S1-1250-250-I-N-D (more detail available in TABLE 1).
This encoder has 1250 counts per 360 degree (2*pi radians). Therefore, we have:
How to read an encoder:
When you rotate the encoder’s shaft, there will be signals from Channels A and B. Channels A and B are square waves with the same amplitude and frequency, but offset by 90 degrees. Note that when rotating in a different direction at the rising edge of channel A, channel B signal will be different–say, if rotating clockwise results a low valve of channel B at the rising edge of channel A; then when rotating counterclockwise, at the rising edge of channel A, channel B will give a high valve.
Inside the black box of the linear encoder, there is a rotational encoder. The black box travels along a track. Therefore, linear encoder and rotational encoder are the same thing–there are also channel A and B in linear encoder, and their signals are the same as rotational encoder. The stroke of air cylinder is 0.1512m, and the linear encoder results 2993 counts travelling that distance. So, we have:
The DAC in used is DAC0808, and the operational amplifier in used is LM324. Basically what Digital Analog Converter (DAC) does is: given a digital signal from Arduino, DAC outputs an analog signal, which is used to control proportional valve. But because the DAC’s output is current and has very little power, we need an amplifier to drive the proportional valve. DAC0808 is an 8-bit DAC, and we give VREF = 12V. If we want a 6.6V output, here is how to calculate the digital value for it:
For more detail: Pneumatic Inverted Pendulum