Let's develop a simple PLC program for the lighting control system
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 control the lighting of a room based on the following criteria:
Let's develop the simple PLC program for the lighting control system (photo credit: hoffman-mfg.com)
- Any of the three switches SWITCH1, SWITCH2, and SWITCH3, if turned on can turn on the light, but all three switches must be off before the light turns off.
- The fourth switch SWITCH4 is the main control switch. If this switch is in the ON position, the lights will be off and none of the other three switches will have control.
Do: Let's design the wiring diagram of the controller connections, assign the inputs and outputs, and develop the ladder diagram that will accomplish the task.
The wiring diagram
The first item we can accomplish is drawing the wiring diagram of the controller. Simply connect all the switches to the inputs and the lighting to output and note the input and output numbers associated with these connections.
The rest of the task becomes the development of the ladder diagram.
Note that the four switches are represented by normally open selectors and the output is connected to a CR1 relay coil. We use the CR1 relay to operate the lights because generally, the current required to operate a group of ambient lights is greater than the maximum current that a PLC output can withstand.
Attempting to use the room lights directly from the PLC output will most likely damage the PLC.
For this wiring configuration, the following list of definitions is apparent:
- INPUT IN1 = SWITCH1
- INPUT IN2 = SWITCH2
- INPUT IN3 = SWITCH3
- INPUT IN4 = SWITCH4 (main control switch)
- OUTPUT OUT1 = CR1 lighting control relay coil
This program requires that, when SWITCH4 is activated, the lights must be turned off. To do this, it would appear that we need a SWITCH4 N / C and not a N / O, as we indicated in our wiring diagram. However, keep in mind that once an input signal is fed into a PLC, we can use as many contacts from the input as needed in our program, and the contacts can be N / O or N / C.
Therefore, we can use an N / O switch for SWITCH4, then in the program, we will logically invert it using N / C IN4 contacts.
The ladder diagram for implementing this example problem is shown in Figure 2.
Figure 2 - Example, lighting control program
The ladder was printed with graphic characters (extended ASCII characters).
Note the normally closed contact for IN4. A normally closed contact represents a reversal of the affected element, in this case, IN4, which is defined as SWITCH 4. Remember that SWITCH 4 must be in the OFF position for the other switches to take control. In the OFF position, SWITCH 4 is open.
This means that IN4 will be deactivated (de-energized). Thus, for an element assigned to IN4 to be closed with the switch in the OFF position, it must be indicated by a normally closed contact. When SWITCH 4 is activated, input IN4 becomes active (activated). If IN4 is activated, 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.