This article will discuss the automatic object detection-based door opening system using the XG5000 PLC program. This PLC system will open the door when it detects a human or other object coming. The door will automatically open for a moment to give the object time to pass, and then the door will move to close again. Also, the door can be configured to remain open continuously.
Program Objective

System Sequence:
- Initialization: Upon system startup, the system will initialize all variables and outputs. The door will be in a Closed position.
- Object Detection: The sensor detects an object approaching the door and triggers the system to start opening the door.
- Door Opening: The motor will drive the door until it is fully Open. The limit switch will send a signal to the system when the door is fully Open.
- Door Hold: The door will remain open for 5 seconds to allow the object to pass through.
- Door Closing: After the waiting period, the motor will turn ON again to drive the door to the Closed position. The motor will stop when the limit switch has sent a signal to the system indicating that the door is fully closed.
- Hold Door Mode: The system has a selector switch that will keep the door continuously open when the selector switch is in the HIGH state. The door will close again when the selector switch is set to the LOW state.
- Return to Initial Condition: After the door is closed, the system will return to its initial state, awaiting the detection of the next object.
Door Automation Example Using Ladder Logic

XG5000 PLC Mapping Details
| S.No. | Comment | Input (I) | Output (Q) | Memory Bits | Timer |
|---|---|---|---|---|---|
| 1 | HOLD_DOOR | Â | Â | M0001 | Â |
| 2 | HOLD_SWITCH | P0005 | Â | Â | Â |
| 3 | LS_DOOR_CLOSE | P0004 | Â | Â | Â |
| 4 | LS_DOOR_OPEN | P0003 | Â | Â | Â |
| 5 | MOTOR_SLIDER_CLOSE | Â | P0041 | Â | Â |
| 6 | MOTOR_SLIDER_OPEN | Â | P0040 | Â | Â |
| 7 | OBJECT_SENS | P0002 | Â | Â | Â |
| 8 | START | P0000 | Â | Â | Â |
| 9 | STOP | P0001 | Â | Â | Â |
| 10 | SYSTEM_ON | Â | Â | M0000 | Â |
| 11 | TIMER_OPEN | Â | Â | Â | T000 |
Object Detection Based Door Opening System

RUNG 1 (START SYSTEM)
In this Rung, the memory bit SYSTEM_ON (M0000) will be in the HIGH state when the START (P0000) button is pressed. Because it uses Latching, the memory bit SYSTEM_ON (M0000) will remain in the HIGH state even though the START (P0000) button has been released.
The memory bit SYSTEM_ON (M0000) will be in LOW state if the STOP (P0001) button is pressed.
RUNG 3 (HOLD THE DOOR)
In this Rung, the memory bit HOLD_DOOR (M0001) will be in the HIGH state if the NO contact of the Selector Switch HOLD_SWITCH (P0005) and the memory bit SYSTEM_ON(M0000) are in the HIGH state.

RUNG 10 (OPEN THE DOOR)
In this Rung, when the NO contact of the memory bit SYSTEM_ON (M0000) and the sensor OBJECT_SENS (P0002) become HIGH state, the MOTOR_SLIDER_OPEN (P0040) output will be ON. The MOTOR_SLIDER_OPEN (P0040) output will remain in the ON state even though the NO contact of the sensor OBJECT_SENS (P0002) is in the LOW state, because it uses Latching.
Or, if the NO contact of the memory bit HOLD_DOOR (M0001) is in the HIGH state, then the MOTOR_SLIDER_OPEN (P0040) output will be ON.
The MOTOR_SLIDER_OPEN (P0040) output will be OFF when the NC contact of the limit switch LS_DOOR_OPEN (P0003) is in the HIGH state.
RUNG 17
When the NO contact of the memory bit SYSTEM_ON (M0000) and the limit switch LS_DOOR_OPEN (P0003) are in the HIGH state, the timer TIMER_OPEN (T000) will start counting up to 5 seconds.
The timer TIMER_OPEN (T000) will be OFF if the NC contact of the memory bit HOLD_DOOR (M0001) is in the HIGH state.

RUNG 23 (CLOSE THE DOOR)
When the NO contact of the memory bit SYSTEM_ON (M0000) and the timer TIMER_OPEN (T000) are in the HIGH state, the MOTOR_SLIDER_CLOSE (P0041) output will be ON. The MOTOR_SLIDER_CLOSE (P0041) output will remain in the ON state even though the NO contact of the Timer TIMER_OPEN (T000) is in the LOW state, because it uses Latching.
The MOTOR_SLIDER_CLOSE (P0041) output will be OFFF when the NC contact of the limit switch LS_DOOR_CLOSE (P0041) is in the HIGH state.
Read Next:
- Flood Warning System using PLC Programming
- PLC Programming for Surface Grinding Process
- PLC Bottle Quality Inspection Using Vision Sensor
- Upload Option Disabled in Siemens PLC Tutorial
- PID Controller with Practical Example Explained