Out and back on a switch: PLC programming exercise
Send one cylinder out, and bring it back when its switch says so.
Each press of Start sends cylinder A out once. It comes back when reed switch A1 shows it has arrived, not after a time.
No card. Nothing to pay. Nothing to cancel.
Official release: 5 December. Top the leaderboard on the day and win 3 months of Pro, plus 2 weeks of Pro to give a friend. 2nd place wins 4 weeks. 3rd place wins 2 weeks. Rules
- Every Coaching lesson, from zero
- Every mission and lesson, as you level up
- A practical test for every title, with a certificate
- Rewind any test, one scan at a time
- Worked solutions when you're stuck
- The code converter, as much as you like
PRO (needs Pro) missionOne press, one full stroke
Test 1 of 4StartGreen Start pushbuttonOFFAirOnDump valve 0V2: ON lets the air in, OFF lets it outONExtendAOutputOFFRunLampOutputOFF- Level
- Applied
- Time
- About 15 min
- Reward
- +250 XP
- Rig
- 3D electro-pneumatics trainer
- Siemens editors
- Ladder (LAD), SCL
- Rockwell editors
- Ladder, Structured Text
- Beckhoff editors
- Structured Text
- Stage
- 33. Pneumatics lab: cylinders, valves and reed switches
Out and back on a switch: what your code must do
Keep AirOn ON, so the trainer has air. When Start is pressed while the air is up (AirOK) and A is fully back (A0), turn ExtendA ON. Keep it ON until A1 comes ON: the piston has reached the end. Then turn ExtendA OFF and the valve's spring brings A back. One press is one stroke: holding Start in, or pressing it while A is moving, must not start another. RunLamp is ON from the press until A is fully back.
- Start
- Needs AirOK and A0. One press, one stroke.
- Out
- ExtendA ON until A1 comes ON.
- Back
- ExtendA OFF: the spring valve returns A.
- How it's checked
- The checks press Start and watch the trainer itself: its reed switches and StrokesA, its count of strokes that reached the end.
Out and back on a switch: inputs and outputs
Your program reads 4 inputs and sets 3 outputs. One more input drives the simulation or shows a reading, for you to test with. The names are the same in every maker’s editor.
Out and back on a switch: what the tests check
- AirOn stays ON, and nothing moves until Start is pressed.
- ExtendA stays ON until A1, however long the stroke takes.
- A comes fully back, and RunLamp goes OFF when it's home.
- One press gives one stroke, even if Start is held in.
- Start does nothing without air, or while A is moving.
- Try it Use the buttons below the model and watch the rig respond.
- Test solution Every check runs on your code in one press.
- Rewind PRO (needs Pro) If one fails, step back through it one scan at a time to see why.
Stuck on this mission? Ask the members in the Locker Room.
Where you’d see this on site
A single cylinder going out and back is half of all pneumatics. An ejector kicks a part off a belt, a stop gate lets one carton through.
A cylinder brought back on a timer works until the air pressure drops or someone adjusts a flow control. Then it turns back before it has done its job, and nothing reports a fault.
Most machines that clamp, push, lift or eject do it with air cylinders. A solenoid valve sends air to one side of the piston and lets it out of the other, and a small switch on the barrel tells the controller when the piston has arrived. Colleges teach it on a board like this one, because the same few parts make up almost every pneumatic machine.
- Air supplyFiltered, set to 6 bar
- ValvesOne 5/2 valve a cylinder
- CylindersOut and back on airYou are here
- Reed switchesProve each stroke
On a real site: places, parts and safety
- Assembly machines that clamp a part, then press or drill it
- Packing lines that push, lift and eject cartons
- College and apprentice training workshops
Compressed air is stored energy. Shut the isolator and let the air out before touching pipework: a hose that comes off under pressure whips.
Letting the air out isn't always the safe state. A cylinder holding a load upright drops when the air goes, so real machines are assessed one cylinder at a time.
The sizes, timings and cutaways are teaching choices, not a drawing of any one real installation.
Next on the road
- One car at a timeRaise the arm for a ticket, lower it once the car is clear.Applied · 20 min · +350 XP
- Tall boxes off the lineRemember a box's height and push it at the right moment.Applied · 25 min · +300 XP
- Both hands, every timeWrite two-hand control for a press, with an interlocked guard.Applied · 30 min · +400 XP
- Stop before the palletOpen and close a door that reverses for obstructions.Applied · 20 min · +400 XP