How-to
Program a garage shutter open and close in ladder logic
Short answer
Seal the Motor up output on the Open pushbutton and the Motor down output on the Close pushbutton, break each latch on the Stop pushbutton and on its own limit — LS1 false at fully open, LS2 true at fully closed — then derive the Open, AJAR and Shut LEDs from LS1 and LS2 alone. The 1.5 kW, 2800 rpm example motor needs an ideal 2.35:1 gear ratio for the 100 kg shutter.

On this page
Program the shutter as two sealed rungs — the Motor up output and the Motor down output, each latch broken by the Stop pushbutton and by its own limit switch — and derive all three position LEDs from the two limit inputs alone. The polarity of the limits decides every contact type: LS1 reads false at fully open, so the up rung examines it for true and loses continuity at the top; LS2 reads true at fully closed, so the down rung examines it for false and loses continuity at the bottom. The drive sizing sits behind those rungs: the example shutter needs 12 N·m at its 1.2 cm drum, the 1.5 kW, 2800 rpm motor delivers 5.118 N·m, and the ideal gear ratio is 2.35:1 before gearbox efficiency.
Assign the I/O and pin the limit polarity #
The example cabinet stays small: an 8-point input module and an 8-point output module carry the five inputs and five outputs with room to spare, with the CPU in slot 0, the input module in slot 1 and the output module in slot 2. Addresses follow slot and terminal, so the upper limit at slot 1, terminal 3 is written I:1/3, and the AJAR LED at slot 2, terminal 2 is O:2/2.
| Address | Device | Field behavior |
|---|---|---|
| I:1/0 | Open pushbutton | normally open, true while pressed |
| I:1/1 | Close pushbutton | normally open, true while pressed |
| I:1/2 | Stop pushbutton | normally closed, false while pressed |
| I:1/3 | LS1, upper limit | false only at fully open |
| I:1/4 | LS2, lower limit | true only at fully closed |
| O:2/0 | Motor up output | commands opening |
| O:2/1 | Motor down output | commands closing |
| O:2/2 | AJAR LED | on between the limits |
| O:2/3 | Open LED | on at fully open |
| O:2/4 | Shut LED | on at fully closed |
Assume high-true inputs throughout: a field contact that closes its circuit drives its input bit to 1. The words normally open and normally closed in this article describe ladder contact instructions — a normally open instruction passes when its bit is 1, a normally closed instruction passes when its bit is 0 — not the field devices in the table.
The two limits do not share a polarity, and this is the trap in the design. LS1 is made everywhere except at the fully open position, where it releases to false; LS2 sits false everywhere except at fully closed, where it makes to true. Same physical job, opposite bit behavior. Replace LS1 with a switch that makes at the top — the ordinary habit — and the up rung cannot hold the moment the shutter leaves the bottom while the Open LED glows mid-travel: the wiring is wrong, not the logic.
Size the drum torque, motor torque and gear ratio #
Work the mechanics before the logic, because the ratio decides the gearbox order. The example takes the shutter's weight acting at the drum surface, with gravity rounded to 10 m/s²:
- Pull force: 100 kg × 10 m/s² = 1000 N.
- Drum radius: a 2.4 cm diameter shaft gives 1.2 cm = 0.012 m.
- Drum torque: 1000 N × 0.012 m = 12 N·m.
- Motor torque: (1.5 kW × 60000) ÷ (2 × 3.14 × 2800 rpm) = 90000 ÷ 17584 = 5.118 N·m.
- Ideal gear ratio: drum torque ÷ motor torque = 2.35:1.
The rule behind the last line is motor torque × gear ratio = drum torque. That 2.35:1 assumes a lossless stage; gearbox efficiency scales the delivered torque by η, so the ratio becomes drum torque ÷ (motor torque × η): 12 ÷ (5.118 × 0.70) = 12 ÷ 3.58 ≈ 3.35:1. The example leaves guide friction, drum inertia and any counterbalance out, and each of those pushes the drum torque up.
Decide on the stage type: order about 2.35:1 for a near-lossless spur or planetary stage, about 3.35:1 for a worm stage around 70 percent efficient, and always round the ordered ratio upward — a shortfall shows up as a stalled drum, not as a slow shutter.
Program the five rungs #
Build the rungs in order; every contact type below follows from the polarity table.
- Rung 000 — open the shutter. A normally open contact on the Open pushbutton input feeds a series chain: normally open on the Stop input, normally closed on the Close pushbutton input, normally open on the LS1 input. The chain drives the Motor up coil. Branch a normally open contact steered by the Motor up output around the Open pushbutton contact to seal the rung once the button releases.
- Rung 001 — close the shutter. Mirror the skeleton: normally open on the Close pushbutton input, normally open on the Stop input, normally closed on the Open pushbutton input, normally closed on the LS2 input, driving the Motor down coil, sealed around the Close contact.
- Rung 002 — Open LED. A normally closed contact on the LS1 input alone drives the Open LED: it passes only while LS1 reads false, which happens only at fully open.
- Rung 003 — Shut LED. A normally open contact on the LS2 input alone drives the Shut LED: it passes only while LS2 reads true, which happens only at fully closed.
- Rung 004 — AJAR LED. A normally open contact on the LS1 input in series with a normally closed contact on the LS2 input drives the AJAR LED: on only when LS1 is true and LS2 is false, which is every position between the limits.
The two limit contacts are deliberately not mirror images. The up rung examines LS1 for true because the shutter travels under a true LS1 and drops it at the top; the down rung examines LS2 for false because the shutter travels under a false LS2 and gains it at the bottom. Copy both rungs with exactly these instruction types, or one direction loses its cutoff.
The opposite pushbutton sits in each chain as a break contact, so pressing Close while the shutter is opening drops the up latch on the scan that follows — the one-direction-at-a-time rule that the article on PLC motor interlock logic for three one-at-a-time motors extends to three motors. The seal branch is the standard start-and-hold — pushbutton makes the coil, output contact holds it, a process input breaks it — the same pattern used to latch two level inputs for pump start and stop control, with the limits playing the level role.
One hardware rule sits above all five rungs: this is control logic, not a safety function. Keep the Stop pushbutton breaking motor power directly in hardware, hold the two reversing contactors mechanically interlocked so a welded contact or a failed output point cannot drive both directions at once, and prove the top cutoff before the first full-stroke test.
Commission both ends and refuse the impossible state #
Stroke the shutter once under each direction and hold every result against this table; the input bits and the LEDs must agree row by row.
| Shutter position | LS1 at I:1/3 | LS2 at I:1/4 | Open LED | AJAR LED | Shut LED |
|---|---|---|---|---|---|
| Fully open | false | false | on | off | off |
| Between the limits | true | false | off | on | off |
| Fully closed | true | true | off | off | on |
| Impossible — fault | false | true | on | off | on |
Read the fourth row as a fault, not a state: a shutter cannot be fully open and fully closed at once, so LS1 false with LS2 true means a wiring, cam-adjustment or failed-input condition. The rungs block both directions in that state and both endpoint LEDs glow — safe but dead. Command no motion until the two bits match the shutter again.
Before the first full-stroke run, inch the shutter to the top and confirm the Motor up output drops in the same scan LS1 goes false, then inch to the bottom and confirm the Motor down output drops when LS2 goes true. A stuck-true LS1 leaves the up rung with no top cutoff at all, so this test is not optional.
Everything above drives the shutter on two discrete outputs. If the machine later runs the shutter on a motion axis, the limit bits stop being the whole story: the article on RSLogix 5000 shutter event logic covers how event logic supervises that travel beyond a position window alone.
Commit the commissioning in one line: the LED pattern matches the table at both ends, Stop drops whichever latch is set from any position, the opposite pushbutton reverses the command mid-travel, and no motion leaves the panel while both endpoint LEDs read on. The rungs, the contact types and the efficiency-corrected ratio all follow from three things — the limit polarity, the drum torque and the motor torque — and none of them is a guess.
Questions asked
What gear ratio do I order once gearbox efficiency is counted?
Divide the drum requirement by motor torque and efficiency together. The example needs 12 N·m at the drum and the motor makes 5.118 N·m, so a 70 percent efficient worm stage gives 12 ÷ (5.118 × 0.70) ≈ 3.35:1, and a 95 percent efficient spur or planetary stage gives 12 ÷ (5.118 × 0.95) ≈ 2.47:1. Round the ordered ratio upward; a shortfall stalls the drum instead of slowing it.
Both endpoint LEDs are on and the shutter will not move — what do I check?
That state — LS1 false with LS2 true — cannot exist on a moving shutter, so one input lies. Compare each input bit against the real shutter position at the module first, then re-adjust the limit cams at both ends, then check the field wiring on the suspect input. Both motion rungs are blocked in this state, which is safe but dead: restore two bits that agree with the shutter's real position before running motion again.
Can the two PLC outputs wire straight to the reversing motor?
No. Feed a reversing contactor pair instead, one coil per direction, mechanically or auxiliary-interlocked so both cannot pull in together, and size the contactors for the motor's full-load current. The scan cannot rule out both outputs conducting through a fault or a mid-scan transition, and one welded contact defeats every interlock in the logic. Two outputs onto a single coil is a separate wiring fault on its own.
Does this program transfer to a different PLC unchanged?
The rung structure transfers; the addresses do not. Keep five inputs and five outputs and map them to your own rack — this example puts the CPU in slot 0, inputs in slot 1 and outputs in slot 2 — and keep the field polarities: LS1 released at fully open, LS2 made at fully closed. If your input modules read the opposite polarity, invert every contact type in all five rungs or the shutter loses its cutoffs.

