Target behavior
Extend the rod with the Push button and retract it with the Pull button
What you will learn
Next, let's practice ladder logic using an air cylinder, a device used in the moving parts of machines.
Here we explain how an air cylinder works and how to control it.
An air cylinder is driven by air. By supplying and exhausting air, it pushes and pulls the rod inside the tube.
For example, it is used to push workpieces off a belt conveyor in a sorting system.
The figure shows how an air cylinder is driven. High-pressure air generated by a compressor drives the cylinder.
First, let's watch a video of an air cylinder in action.
(The video is by SMC, the world's largest maker of pneumatic equipment. SMC pneumatic devices are found in almost every machine.)
When an air cylinder is used in a machine, the PLC must control when the rod extends and retracts.
The device used for this is a solenoid valve. By switching the air path with the solenoid valve, the rod is pushed and pulled.
SMC's video explains this very clearly too. The explanation of how the solenoid valve works starts at about 30 seconds.
We now know the solenoid valve can extend and retract the cylinder. But control is difficult if we cannot tell whether the rod has finished extending or retracting.
In other words, the PLC needs to know where the rod is. For this we use auto switches.
The rod of an air cylinder has a magnet, and a sensor that detects magnetism is mounted on the cylinder to detect the rod position. This sensor is called an auto switch.
That covers the air cylinder and how it is driven.
Now for this model.
Reproduce the motion where pressing the Push button extends the rod and pressing the Pull button retracts it!
In other words, turn the solenoid valve ON when the Push button is pressed and OFF when the Pull button is pressed!
For wiring, you need to wire the solenoid valve and the auto switches for detecting the retracted end and the extended end of the rod.
Based on this approach, try writing the ladder yourself first.
In the simulator, you can create the wiring and ladder and actually run the 3D equipment model.
| Device | Comment |
|---|---|
| Inputs | |
X0 | Auto switch (extended) |
X1 | Auto switch (retracted) |
X2 | Push button |
X3 | Pull button |
| Outputs | |
Y0 | Cylinder solenoid valve |
The row numbers in the figures match the row numbers in the simulator's ladder window.
X2 (Push button) is ON and X1 (retracted-end auto switch) is ON, SET Y0 (solenoid valve)X3 (Pull button) is ON and X0 (extended-end auto switch) is ON, RES Y0SET turns the device ON when the condition is satisfied and keeps it ON even after the condition is no longer met. RES turns the device OFF.
The auto switches are included in the conditions so that the rod extends only after it has fully retracted, and retracts only after it has fully extended. A condition like this that prevents an opposite command during a motion is called an interlock.
The sample wiring and ladder data can be downloaded fromGitHuband loaded with "Load wiring" and "Load ladder" in the simulator.
Key points