0
0
FreertosHow-ToBeginner · 4 min read

PLC Project for Elevator Control: Basic Guide and Example

A PLC project for elevator control uses ladder logic to manage floor selection, motor direction, and door control. It typically includes inputs for floor buttons and sensors, outputs for motor and door actuators, and logic to handle requests safely and efficiently.
📐

Syntax

The basic syntax for an elevator control PLC program uses ladder logic elements like contacts and coils.

  • Inputs: Represent buttons and sensors (e.g., floor call buttons, door sensors).
  • Outputs: Control actuators like motor direction and door open/close.
  • Timers: Manage delays such as door open time.
  • Memory bits: Store states like current floor or request pending.

Example ladder logic elements:

--[ ]--( )--
|    |    |
|    |    +-- Coil (Output)
|    +------- Contact (Input or Memory Bit)
ladder_logic
(* Ladder logic syntax example for elevator motor control *)
(* I0.0 = Up button pressed *)
(* I0.1 = Down button pressed *)
(* I1.0 = Top floor sensor *)
(* I1.1 = Bottom floor sensor *)
(* Q0.0 = Motor Up *)
(* Q0.1 = Motor Down *)

(* If Up button pressed and not at top floor, run motor up *)
|--[ I0.0 ]--[ NOT I1.0 ]--( Q0.0 )--|

(* If Down button pressed and not at bottom floor, run motor down *)
|--[ I0.1 ]--[ NOT I1.1 ]--( Q0.1 )--|
💻

Example

This example shows a simple elevator control logic in structured text (ST) for a PLC. It controls motor direction based on floor requests and stops at floors.

structured_text
(* Elevator Control Example in Structured Text *)
VAR
  CurrentFloor : INT := 0;
  RequestedFloor : INT := -1;
  MotorUp : BOOL := FALSE;
  MotorDown : BOOL := FALSE;
  DoorOpen : BOOL := FALSE;
END_VAR

(* Input simulation *)
IF RequestedFloor > CurrentFloor THEN
  MotorUp := TRUE;
  MotorDown := FALSE;
ELSIF RequestedFloor < CurrentFloor THEN
  MotorUp := FALSE;
  MotorDown := TRUE;
ELSE
  MotorUp := FALSE;
  MotorDown := FALSE;
  DoorOpen := TRUE; (* Open door at requested floor *)
END_IF;
Output
When RequestedFloor is higher than CurrentFloor, MotorUp is TRUE and MotorDown is FALSE. When RequestedFloor is lower, MotorDown is TRUE and MotorUp is FALSE. When at RequestedFloor, both motors stop and DoorOpen is TRUE.
⚠️

Common Pitfalls

  • Not handling simultaneous floor requests properly can cause the elevator to skip floors.
  • Failing to stop the motor exactly at the floor sensor leads to overshoot or jerky stops.
  • Ignoring door safety sensors can cause doors to close on passengers.
  • Not using timers for door open delays can make the door close too quickly.

Always test inputs and outputs carefully and simulate all edge cases.

ladder_logic
(* Wrong: Motor runs without checking floor sensor *)
|--[ I0.0 ]--( Q0.0 )--|

(* Right: Motor runs only if not at top floor *)
|--[ I0.0 ]--[ NOT I1.0 ]--( Q0.0 )--|
📊

Quick Reference

ElementPurposeExample
InputDetect button press or sensorI0.0 = Floor 1 button
OutputControl motor or doorQ0.0 = Motor Up
TimerDelay door closingTON Timer for door open time
Memory BitStore stateM0.0 = Request pending
ContactCheck input or memory[ I0.0 ] or [ M0.0 ]
CoilActivate output or memory( Q0.0 ) or ( M0.0 )

Key Takeaways

Use inputs for floor buttons and sensors to detect elevator status.
Control motor direction outputs based on requested and current floors.
Include timers to manage door open delays safely.
Test all logic paths to avoid skipping floors or unsafe door operations.
Use memory bits to track requests and elevator states efficiently.