Free
30 min

Garage Door PLC Ladder Logic Program (Run It Free Online)

A garage door controller is one of the best intermediate PLC projects: it combines SET/RESET latches for direction memory, a hard interlock to prevent both contactors firing together, a safety auto-reverse on obstacle detection, and a flashing warning lamp — all in a compact program. Below is the full ladder diagram, the I/O table and the timing sequence for the obstacle-reversal case, with a live scenario you can write and run in your browser without installing anything.

sequencesafetyreversing
Garage Door Controller scenario preview

Ready to build this?

Sign up free — no credit card required. This scenario is included in the free tier.

Sign up to play this scenario →

Already have an account? Log in

Briefing

A residential overhead garage door driven by a reversing motor. Pressing OPEN starts the UP contactor until the UP_LIMIT switch is made; pressing CLOSE starts the DOWN contactor until DOWN_LIMIT. While the door is closing, a photo-eye mounted near the floor monitors for obstructions — if OBSTACLE_PE trips during a close, the motor must immediately reverse and drive the door back up to the fully-open position. A warning lamp flashes whenever the door is in motion. UP and DOWN contactors must NEVER be energised at the same time; a mechanical interlock is also present, but your ladder logic must enforce it as well.

Objectives

  • OPEN push-button starts the UP contactor; it latches until UP_LIMIT trips
  • CLOSE push-button starts the DOWN contactor; it latches until DOWN_LIMIT trips
  • OBSTACLE_PE during a close reverses the motion — UP runs until UP_LIMIT
  • WARNING_LAMP flashes at ~2 Hz while either contactor is energised
  • UP_CONTACTOR and DOWN_CONTACTOR must never both be on in the same scan

Hints

  • Use internal OPENING/CLOSING state bits. SET on the appropriate PB rising edge, RESET on the limit
  • UP_CONTACTOR := OPENING AND NOT CLOSING; DOWN_CONTACTOR := CLOSING AND NOT OPENING — the SET/RESET logic keeps them mutually exclusive
  • Detect the obstacle as a rising edge on OBSTACLE_PE while CLOSING is active: RESET CLOSING, then SET OPENING
  • Flash WARNING_LAMP with two linked TONs (250 ms each) driven by an OPENING OR CLOSING "motion" bit

I/O Table

Inputs

OPEN_PB

Open push-button (momentary)

BOOL · %I0.0

CLOSE_PB

Close push-button (momentary)

BOOL · %I0.1

OBSTACLE_PE

Obstruction photo-eye near the floor

BOOL · %I0.2

UP_LIMIT

Upper travel limit switch (door fully open)

BOOL · %I0.3

DOWN_LIMIT

Lower travel limit switch (door fully closed)

BOOL · %I0.4

Outputs

UP_CONTACTOR

Motor up-direction contactor

BOOL · %Q0.0

DOWN_CONTACTOR

Motor down-direction contactor

BOOL · %Q0.1

WARNING_LAMP

Motion warning lamp (flashes while moving)

BOOL · %Q0.2

Your program will be tested against:

All test cases run automatically when you submit. Assertions are hidden until you pass.

  1. #1Open from closed drives UP until UP_LIMIT

    Press OPEN -> UP on; door travels up; UP_LIMIT trips -> UP off

  2. #2Close from fully open drives DOWN until DOWN_LIMIT

    First open the door, then press CLOSE -> DOWN on; DOWN_LIMIT trips -> DOWN off

  3. #3Obstacle during close reverses motion back to UP_LIMIT

    Open, close, mid-close trip OBSTACLE_PE -> DOWN off + UP on until UP_LIMIT

  4. #4Warning lamp flashes while either contactor is energised

    Start opening; sample WARNING_LAMP twice during motion to observe a state toggle

  5. #5UP and DOWN contactors are never simultaneously energised

    Exercise open -> close -> obstacle-reverse; assert interlock invariant was never violated

Garage door PLC I/O assignments

A residential overhead garage door needs five digital inputs and three digital outputs. The inputs are two push-buttons (OPEN, CLOSE), two travel limit switches (UP_LIMIT when the door is fully open, DOWN_LIMIT when fully closed) and a photo-eye safety sensor (OBSTACLE_PE) mounted near the floor.

The outputs are two motor contactors (UP_CONTACTOR drives the door upward, DOWN_CONTACTOR drives it downward) and a WARNING_LAMP that flashes at approximately 2 Hz whenever the door is in motion. A key constraint: UP_CONTACTOR and DOWN_CONTACTOR must never be energised in the same scan — the program must enforce this interlock even though a mechanical interlock is also wired.

garage door PLC I/O table inputs outputs limit switches obstacle sensor
Garage door I/O: five inputs (OPEN_PB %I0.0, CLOSE_PB %I0.1, OBSTACLE_PE %I0.2, UP_LIMIT %I0.3, DOWN_LIMIT %I0.4) and three outputs (UP_CONTACTOR %Q0.0, DOWN_CONTACTOR %Q0.1, WARNING_LAMP %Q0.2).

SET/RESET direction latches — the core of the garage door ladder logic

The cleanest way to program a garage door in ladder logic is with two internal state bits — OPENING and CLOSING — controlled by SET and RESET coils. When the OPEN push-button fires a rising edge, SET OPENING. When UP_LIMIT trips, RESET OPENING. The same mirror pattern applies to CLOSING: SET on the CLOSE push-button edge, RESET when DOWN_LIMIT trips.

The actual motor outputs are then derived from the state bits in a single rung each: UP_CONTACTOR energises when OPENING is true AND CLOSING is false; DOWN_CONTACTOR energises when CLOSING is true AND OPENING is false. Because OPENING and CLOSING are never both set at the same time by the latch logic, the interlock is structural rather than a patch-up.

garage door PLC ladder logic SET RESET latch rung direction control interlock
The direction-control rung: OPENING AND NOT CLOSING drives UP_CONTACTOR. The mutual-exclusion interlock is baked in — not bolted on.

Obstacle auto-reverse ladder rung

The safety requirement is: if OBSTACLE_PE trips on a rising edge while the door is closing, immediately switch from closing to opening and run the motor back up to UP_LIMIT. In ladder logic this is two extra SET/RESET rungs triggered by the edge of OBSTACLE_PE:

• RESET CLOSING — stops the downward travel immediately. • SET OPENING — starts upward travel toward UP_LIMIT.

Both rungs are gated on the rising-edge bit of OBSTACLE_PE AND CLOSING, so the obstacle sensor only triggers reversal when the door is actually moving downward. A photo-eye beam-break at any other time (door fully open or stopped) is ignored.

garage door PLC auto-reverse ladder rung obstacle photo-eye safety
Obstacle auto-reverse: OBSTACLE_PE rising edge while CLOSING resets CLOSING and sets OPENING — the door immediately reverses to the fully-open position.

Timing diagram: close, obstacle, auto-reverse

The timing diagram shows the three-event sequence that the obstacle-reversal test case exercises. First, CLOSE_PB fires a momentary pulse — DOWN_CONTACTOR and WARNING_LAMP both turn on. About two seconds later OBSTACLE_PE trips for one scan — DOWN_CONTACTOR drops immediately, UP_CONTACTOR picks up and WARNING_LAMP remains on (the door is still in motion, just upward now). When the door reaches UP_LIMIT, UP_CONTACTOR drops and WARNING_LAMP goes off.

Note that DOWN_CONTACTOR and UP_CONTACTOR never overlap — the gap between them is enforced in the same scan by the SET/RESET order in the program.

garage door PLC ladder logic timing diagram close obstacle auto-reverse
Close-to-obstacle-to-open timing: DOWN drops in the same scan OBSTACLE_PE trips; UP picks up immediately. Both contactors are never simultaneously energised.

How to program a garage door PLC step by step

Writing a garage door PLC ladder logic program from scratch follows a clear sequence. Start by declaring the five inputs and three outputs in the variable block, then add the edge-detection function blocks (R_TRIG on OPEN_PB, CLOSE_PB and OBSTACLE_PE).

Next, write the OPENING latch rungs: SET on OPEN_PB rising edge (when not already closing), and also SET on OBSTACLE_PE rising edge while closing — that single rung handles the entire auto-reverse. Then RESET OPENING on UP_LIMIT. Mirror the pattern for CLOSING. Add the contactor rungs (OPENING AND NOT CLOSING → UP_CONTACTOR; CLOSING AND NOT OPENING → DOWN_CONTACTOR), derive the MOTION bit, and finally build the 2 Hz flasher from two cross-linked 250 ms TON timers.

This is a live runnable scenario on this page — write the logic, press Run, and the simulated door will open, close and auto-reverse in real time. The built-in test suite checks all five behaviours automatically.

how to build a garage door PLC ladder logic program step by step flowchart
Step-by-step build flow: from edge detectors and state latches to contactors, interlock and the 2 Hz warning lamp flasher.

Automatic door PLC ladder diagram — the reusable open/close pattern

The garage door program is really a general automatic door PLC ladder diagram: the same OPENING/CLOSING latch-plus-interlock structure drives any motorised door — overhead garage doors, sliding factory gates, automatic sliding entrances and roller shutters. Two SET/RESET state bits hold the direction memory after the momentary button is released, the two contactor rungs (OPENING AND NOT CLOSING → UP; CLOSING AND NOT OPENING → DOWN) make the interlock structural, and the obstacle photo-eye gives the safety auto-reverse that every automatic door needs. Swap the OPEN/CLOSE push-buttons for a motion sensor or a remote and the logic is unchanged.

That reusability is why this is one of the most-searched garage door PLC ladder logic patterns — learn it once and it ports straight to any door. The whole program is runnable and auto-graded in your browser — and to keep a copy of this garage door / automatic door PLC ladder diagram (I/O table plus every rung) beside you while you build, press Ctrl/Cmd+P on this page and choose Save as PDF.

Frequently asked questions

What PLC instructions are used in a garage door ladder logic program?

The core instructions are R_TRIG (rising-edge detector on the push-buttons and obstacle sensor), SET and RESET coils (to control the OPENING and CLOSING state bits), standard output coils for the contactors and warning lamp, and two TON timers cross-linked to build the 2 Hz flasher. No counters or complex math are needed.

Why use SET/RESET latches instead of seal-in rungs for a garage door?

A seal-in rung loses state the moment its enabling contact goes false. A SET/RESET latch retains its state across scans, which is exactly what a garage door needs: the motor must keep running after the momentary push-button is released, and stop only when the limit switch trips.

How do I stop UP_CONTACTOR and DOWN_CONTACTOR from both energising at the same time?

Drive each contactor rung with OPENING AND NOT CLOSING (for UP) and CLOSING AND NOT OPENING (for DOWN). Because OPENING and CLOSING are never both set by the latch logic, the interlock is structural. As a belt-and-suspenders measure, also add a normally-closed cross-interlock contact — NC DOWN_CONTACTOR in series on the UP rung and NC UP_CONTACTOR in series on the DOWN rung.

How does the obstacle auto-reverse work in ladder logic?

Detect a rising edge on OBSTACLE_PE. If CLOSING is also true in the same scan, issue a RESET CLOSING and a SET OPENING. The RESET drops the DOWN contactor immediately; the SET starts the UP contactor. The door then travels upward until UP_LIMIT trips and RESET OPENING fires.

How do I make the warning lamp flash at 2 Hz in PLC ladder logic?

Use two cross-linked TON timers, each preset to 250 ms. T_A runs while MOTION is true AND T_B.Q is false. When T_A.Q fires it starts T_B; when T_B.Q fires it resets T_A and T_B resets itself. WARNING_LAMP is driven by T_A.Q AND NOT T_B.Q — the 250 ms window between the two done bits gives a 50% duty-cycle 2 Hz flash.

Can I run a garage door PLC program without a real PLC?

Yes — this page is a live browser scenario. Write the ladder logic (or structured text), press Run, and a simulated garage door responds in real time. The built-in test suite checks all five behaviours: open to limit, close to limit, obstacle auto-reverse, warning lamp flash, and the interlock invariant. No hardware, no software install, no licence.

What does a garage door PLC ladder logic program look like?

It has three rung groups: edge detectors (R_TRIG on OPEN_PB, CLOSE_PB and OBSTACLE_PE), two direction-state latches (SET/RESET on OPENING and CLOSING, including the obstacle auto-reverse that SETs OPENING while CLOSING), and the output rungs — UP_CONTACTOR := OPENING AND NOT CLOSING, DOWN_CONTACTOR := CLOSING AND NOT OPENING, plus a 2 Hz WARNING_LAMP flasher from two cross-linked 250 ms TON timers. To keep a copy of this exact ladder logic, press Ctrl/Cmd+P on this page and choose Save as PDF.

How do you write a garage door PLC program?

Declare the five inputs and three outputs, add R_TRIG edge detectors on the buttons and obstacle sensor, then write the OPENING latch (SET on the OPEN edge or on an obstacle while closing, RESET on UP_LIMIT) and the mirror-image CLOSING latch. Derive the contactor outputs from the state bits so the interlock is built in, then add the flashing warning lamp. You can write and run exactly this garage door PLC program in the browser scenario on this page and have it graded automatically.

Can I use this as an automatic door PLC ladder diagram?

Yes — the OPENING/CLOSING latch, structural motor interlock and obstacle auto-reverse are a generic automatic door PLC ladder diagram. The same rungs drive sliding gates, roller shutters and automatic sliding entrances; you only swap the OPEN/CLOSE push-buttons for a motion sensor or remote trigger and re-label the contactors. The control logic — direction memory, mutual-exclusion interlock and safety reversal — stays identical.

Ready to build this?

Sign up free — no credit card required. This scenario is included in the free tier.

Sign up to play this scenario →

Already have an account? Log in