Intelligent stair lighting
This PLC ladder logic code may work for an automatic stair lights system. The program is supposed to drive a strip of ten lights placed along a stair. Controlled by top and bottom photocells, the lights will turn on and off one at a time; the sequence depends on your walking direction. Due to count instructions, the lights will back dark when there is no one on the stair. For that reason there must be a pair of photocells (distant few centimeters each other) at each end of the stair: depending on the sequence of activation they will generate a positive or negative count signal.
Photocells S1 and S2 drive the instructions RS1, RS2, R1, R2, TC1, TC2, CTU, CTD. Depending on your walking direction, the instructions RS1, R1, TC1 and CTU, otherwise RS2, R2, TC2 and CTD will work.
Photocells S3 and S4 drive the instructions RS3, RS4, R3, R4, TC3, TC4, CTU, CTD. The count is performed by the relays from 1 to 5. It increases due to the instruction CTU and decreases due to the instruction CTD.
Timers from T1 to T10 turn on and off the lights from L1 to L10, through the relays K1 and K4. Lights from L10 to L1 are controlled by the timers from T1A to T10A, through the instructions K2 and K3.
The project has been tested with the free version of this software.
Download the project
Watch on YouTube