Let’s develop the simple PLC program for lighting control system
Let’s develop the simple PLC program for lighting control system (on photo: BantamX - Stand-Alone Lighting Control System Built for Almost Any Application; credit:

Lighting control system

A lighting control system is to be developed. The system will be controlled by four switches, SWITCH1, SWITCH2, SWITCH3, and SWITCH4. These switches will control the lighting in a room based on the following criteria:

  1. Any of three of the switches SWITCH1, SWITCH2, and SWITCH3, if turned ON can turn the lighting on, but all three switches must be OFF before the lighting will turn OFF.
  2. The fourth switch SWITCH4 is a Master Control Switch. If this switch is in the ON position, the lights will be OFF and none of the other three switches have any control.

To do: Let’s design the wiring diagram for the controller connections, assign the inputs and outputs and develop the ladder diagram which will accomplish the task.

The wiring diagram //

The first item we may accomplish is the drawing of the controller wiring diagram. All we need do is connect all switches to inputs and the lighting to an output and note the numbers of the inputs and output associated with these connections.

The remainder of the task becomes developing the ladder diagram. The wiring diagram is shown in Figure 1.

PLC Wiring Diagram for Example Problem
Figure 1 – PLC Wiring Diagram for Example Problem

Notice that all four switches are shown as normally open selector switches and the output is connected to a relay coil CR1. We are using the relay CR1 to operate the lights because generally the current required to operate a bank of room lights is higher than the maximum current a PLC output can carry.

Attempting to operate the room lights directly from the PLC output will most likely damage the PLC.

For this wiring configuration, the following definition list is apparent:

  • INPUT IN4 = SWITCH4 (Master Control Switch)
  • OUTPUT OUT1 = Lights control relay coil CR1

This program requires that when SWITCH4 is ON, the lights must be OFF. In order to do this, it would appear that we need a N/C SWITCH4, not a N/O as we have in our wiring diagram. However, keep in mind that once an input signal is brought into a PLC, we may use as many contacts of the input as we need in our program, and the contacts may be either N/O or N/C.

Therefore, we may use a N/O switch for SWITCH4 and then in the program, we will logically invert it by using N/C IN4 contacts.

The ladder diagram to implement this example problem is shown in Figure 2.

Example, Lighting Control Program
Figure 2 – Example, Lighting Control Program

The ladder was printed using graphics characters (extended ASCII characters).

Notice the normally closed contact for IN4. A normally closed contact represents an inversion of the assigned element, in this case IN4, which is defined as SWITCH 4. Remember, SWITCH 4 has to be in the OFF position before any of the other switches can take control. In the OFF position, SWITCH 4 is open.

This means that IN4 will be OFF (de-energized). So, in order for an element assigned to IN4 to be closed with the switch in the OFF position, it must be shown as a normally closed contact. When SWITCH 4 is turned ON, the input, IN4, will become active (energized). If IN4 is ON, a normally closed IN4 contact will open.

With this contact open in the ladder diagram, none of the other switches will be able to control the output.

REMEMBER: A normally closed switch will open when energized and will close when de-energized.

PLC program to control a lighting device

How to create a PLC program to control a lighting device through a button or a SCADA system using the PLC-PROG IDE.

Reference // Programmable Logic Controllers

About Author //


Edvard Csanyi

Edvard - Electrical engineer, programmer and founder of EEP. Highly specialized for design of LV high power busbar trunking (<6300A) in power substations, buildings and industry fascilities. Designing of LV/MV switchgears.Professional in AutoCAD programming and web-design.Present on


  1. Ty
    Oct 11, 2015

    Hi Edvard, I’m still a little puzzled! Could it be that “S1, S2 & S3” is a 3 way switch controlled by S4 when turned on activates a n/o relay contact that provides a path for the lights?

  2. Masitembe
    Sep 08, 2015

    I want to learn plc’s and your website looks fascinating

  3. Lucas
    Aug 27, 2015

    Great job

  4. David
    Aug 24, 2015

    I would like to express my appreciation for all the information you keep sharing to the Engineering (Electrical) Society. Really appreciate that!!!

  5. Takas
    Jul 27, 2015

    The information yu giving is very vital all those in the Electrical Engineering field. Thanks guys

  6. Anonymous
    Jul 16, 2015

    Great ideas I’m gaining.

  7. manasa moharana
    Jul 13, 2015

    Actually, this portal is amazing. Here we are gaining knowledge. This idea is truly great. Thank for it and thanks for its founder.

  8. Mengistu
    Jul 07, 2015

    it is great what a blessed and kind persons you are. i always follow your essential posts as a lesson. i got all the time what my mind ask me. pls keep on doing this. Thanks very much

  9. James Murau Kiburi
    Jul 06, 2015

    That’s greatat. Thanks alot for that innovative ide.

Leave a Comment

Tell us what you're thinking... we care about your opinion!