PDA

View Full Version : PLC control of light from 2 separate switches


plc_heaven
January 15th, 2007, 06:21 PM
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.

TConnolly
January 15th, 2007, 06:46 PM
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.

randylud
January 15th, 2007, 07:49 PM
This one is so easy it has to be a class assignment. More thinking and less asking will get you to the solution.

plc_heaven
January 15th, 2007, 07:54 PM
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.

plc_heaven
January 15th, 2007, 07:57 PM
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.

randylud
January 15th, 2007, 08:13 PM
This might help you visualize what you are after.

http://www.plctalk.net/qanda/uploads/3wayA.JPG

TConnolly
January 15th, 2007, 09:51 PM
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.

boxofrelays
January 15th, 2007, 11:48 PM
Like this...
http://www.plctalk.net/qanda/uploads/two_in_one_out.png

brucechase
January 16th, 2007, 06:06 AM
Actually "boxofrelays" that logic is the opposite of what the truth table describes. A 1 and a 1 is should equal a logic 0.

boxofrelays
January 16th, 2007, 10:47 AM
You are correct sir! The truth table version should look like this:
http://www.plctalk.net/qanda/uploads/two_i_one_outc.png

TConnolly
January 16th, 2007, 11:28 AM
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.

Jimmie_Ohio
January 16th, 2007, 11:36 AM
Admitedly, it would be much easier to just draw the ladder for the answer, but then our PLC newbie would not learn.Looks like a way to get a new engineering manager trained!

boxofrelays
January 16th, 2007, 03:25 PM
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.

Lancie1
January 16th, 2007, 10:41 PM
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!

boxofrelays
January 17th, 2007, 02:45 AM
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.