PLC control of light from 2 separate switches

plc_heaven

Member
Join Date
Jan 2007
Location
Somewhere out there
Posts
3
Hi. I'm a newbie to PLC's. I need to control a lamp from two separate switches - much like two three-way switches would control a light in the hallway of your house. Any help would be greatly appreciated. Thanks.
 
Welcome to the forum.

While we are usually more than willing to help people new to PLCs, we generally do not do homework assignments here. If you get stuck we will be happy to help however. Here is what you need to do: Describe how you think the problem could be solved, and state that in some way or attach a sketch of what you think you will need for a ladder. Tell us what has you stumped, and you will get lots of help, but you need to show some effort first.

Here is a hint to get you started: When 3 way switches are both in the same state, the light is off, but if they are in different states, then the light is on. Now state that in a boolean statement and convert it to ladder.
 
Hi Alaric. I have tried several ways. I can get the light to turn on from both switches and I make obviously make it turn off from the switch that turned it on. I just can't make it turn off from the opposite switch. I put one EIC switch. Then I do a rung branch and install the other EIC switch. Lastly I installed the Output Energize. I realize that by doing this I have essentially made an "OR" statement allowing power to flow through the switch and to the light through either switch. I think I need an "AND" statement that will require input from both switches before the light will come on. I think this will allow me to turn off the lamp from either switch. How am I doing so far?? Thanks for your help. I'm more used to residential, commercial, and industrial wiring and am having trouble switching to thinking of things in straight line code if you will. Thanks.
 
Hi randylud. I've been perplexed with this one for a while. I've tried everything that I can think of. I'm sure there is something small and easy that I'm overlooking in my thought process.
 
This might help you visualize what you are after.

3wayA.JPG
 
OK, lets write out some boolean equations that may be of some help to mathematically describe what you are tying to do. Let A be one switch, B be the other switch, and C be the light. Lets say that a 1 represents the switch is up, and 0 represents the switch is down. Now remember that when the switches are in the same position, the light is off. We will use a line above each letter to represent it as a NOT, or in the down position, and just the letter without a line to represent it as UP

So
_ _ _
A + B = C //Both switches down - light is off.
_
A + B = C //Both switches up - light is off.
_
A + B = C //A switch down, B switch up - light is ON
_
A + B = C //A switch up, B switch down - light is ON.

We can make a truth table now:
A | B | C
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0



Now transpose this to the PLC, each swith represents and input bit in our logic, imagine that only the up position of the switch will make an input bit true, so we want to solve in logic what would have been hardwired in a 3 way switch. We only need to concern ourselves with the equations that makes the light turn on as the light will turn off if the logic is false.

See if this helps you.
 
Look at the schematic Randylud posted. The states of the two switches have to be opposite (notice that the switches are drawn as mirror images). To implement it in logic, the only relevant entries in the truth table are those which produce a 1 in the output column C. Looking at the truth table, there are two of those, so we get an output when we have (NOT A AND B) or when we have (A AND NOT B).

Admitedly, it would be much easier to just draw the ladder for the answer, but then our PLC newbie would not learn, and getting the fundamentals right from the beginning can make learning PLCs fun, instead of frustrating. Hopefully PLC_Heaven comes back and lets us know how the problem worked out.
 
I think plc_heaven just wanted a quick simple answer. It's good to think this out with boolean logic and then create the ladder logic afterward -however, the fellow seemed to be stuck on a rather simple problem. When he comes across more complex boolean logic he'll have to sit down and bool his problems out properly as Alric demonstrated. Next time I'll do an animated gif -it just looks cool.
 
I imagine that everone except me noticed that Alaric's truth table does not match the Boolean equations: it is jumbled up, out of order, maybe confusing to the students. I am sure Alaric meant this as a challenge!
 
Last edited:
Everyone visualizes logic in their own special and unique way. What may seem obvious to some may be difficult to perceive for others. Writing out Boolean logic may help people to visualize complex logic blocks; other folks use simple tools like calculators. I use windows calculator set to scientific view to quickly check my logic or binary functions. Use what comes naturally to you, maybe your fingers and toes. Eventually it will become second nature and you'll just code it on your controller -straight from an idea in your head right to the keys on your laptop. Alaric’s truth table is the base logic that is taught in elementary school (OK maybe high school for some of us). This is what most of us are use to seeing when we were first taught Boolean in school. Of course back then we might not have seen any practical purpose to all of this. And now -here it is! Aloha folks and happy programming to you all.
 
Last edited:

Similar Topics

For example I have PLC that works with Codesys. Sorry my questions are going to be complete dumb. How do i wire such a lamp to PLC? Directly or...
Replies
8
Views
9,146
Here's my situation, I have a press where the primary safety devices are E-Stops and Light Curtains. All of which are hard-wired according to all...
Replies
5
Views
3,706
I'm a Mech-E. I do HVAC, but flight sims are my hobby. I'm building a F-16 ****pit(pit) and am looking to use a SLC 500 type PLC to do the I/O...
Replies
10
Views
14,029
Hi, I'm thinking about using commands for Melservo J5 controller via HMI without PLC. Have you guys done this kind of control configuration for...
Replies
3
Views
139
Hi, I have a 1500 that controls a station with diferents warehouses, but i also have a 1200 that controls one of those warehouses, i have been...
Replies
9
Views
277
Back
Top Bottom