Learn PLCs free
Intermediate1 hourVehicle detectionSafety photoeyeTimed gate cycleAnti-pinch

Parking Gate Controller

Parking gate controllers combine vehicle detection (inductive loops or photoeyes), gate actuator timing, and critical safety logic — the gate must NEVER close on a vehicle. This example shows the standard pattern with photoeye safety.

Sequence overview showing inputs flowing into PLC logic and outputs driving actuators, with this example named Parking Gate Controller.Process flow: inputs → logic → outputsInputsLoop_Approach, Loop_Exit, Photoeye_Safety6 signalsPLC LogicVehicle detection · Safety photoeyeIntermediate · 1 hourOutputsGate_Open, Gate_Close2 signals

I/O list

TagTypeDescription
Loop_ApproachDIInductive loop in approach lane
Loop_ExitDIInductive loop in exit lane (under gate)
Photoeye_SafetyDILight beam across gate (TRUE = clear)
ValidPassDIValid RFID/ticket from reader
Gate_OpenDOOpen gate motor command
Gate_CloseDOClose gate motor command
GateOpenLimitDIGate fully open limit switch
GateClosedLimitDIGate fully closed limit switch

Structured Text code

PROGRAM main
VAR
    State     : INT := 0;
    HoldTimer : TON;
END_VAR

Gate_Open := FALSE;
Gate_Close := FALSE;

CASE State OF
    0:  (* CLOSED IDLE *)
        IF Loop_Approach AND ValidPass THEN State := 10; END_IF;

    10: (* OPENING *)
        Gate_Open := TRUE;
        IF GateOpenLimit THEN State := 20; END_IF;

    20: (* OPEN — wait for vehicle to clear *)
        HoldTimer(IN := NOT Loop_Exit AND Photoeye_Safety, PT := T#3s);
        IF HoldTimer.Q THEN
            HoldTimer(IN := FALSE);
            State := 30;
        END_IF;

    30: (* CLOSING — but only if photoeye clear and no vehicle in loop *)
        IF Photoeye_Safety AND NOT Loop_Exit THEN
            Gate_Close := TRUE;
            IF GateClosedLimit THEN State := 0; END_IF;
        ELSE
            (* Photoeye blocked or vehicle in loop — open gate again *)
            State := 10;
        END_IF;
END_CASE;

How it works

Approach loop + valid pass: gate opens only when both a vehicle is approaching AND a valid RFID/ticket has been presented.

Hold-open time: gate stays open for 3 seconds AFTER the vehicle clears the exit loop. Prevents the gate from closing too quickly behind a slow vehicle.

Photoeye safety override: in step 30 (closing), if the photoeye is broken or a vehicle is detected in the exit loop, the gate immediately reverses to step 10 (opening). This is the anti-pinch safety.

Production system: would add tailgating detection (loop + photoeye combination), backup safety contact strip on the gate arm, and emergency-open input from facility security.

More examples