Controlling lights from 2 switches-

just wondering if it¨s possible to controll lights from 2 switches. these switches are normaly operated by 230volt ac< (2 way switch).

But can arduino remeber what state ur in? . like when both switches are off, it¨s 0 - 0 volt . But if i switch the switch (turn the light on) it shows 5 volt - 0 volt.

But then if i wanna turn the light off, i switch the second switch to off and it gets 5v-5v. is there anyway way to make this in logic.?
so it always knows what to do..
1.lights on
2.lights off
3.lights on
4.lights off

And so on... Like if something happends with switch 1 or 2 turn lights on.

Is there anyway to controll lights from arduino and still have 2 normaly switches manually controlled. :slight_smile:

thanks.

i meant using 5dc supplying the swithces-'.

Would you please give a little bit more details on your wiring? I do not fully understand your question. Or to be more precise: the answer is "yes". If you need more details on how to achieve it then you need to provide more details of what you actually want to achieve.

Just trying to get it clear what you want to do. Do you want a single light controlled by a regular switch and a relay on the Arduino? If that's the case I just see a regular three way switch setup with one of the switches being a double throw relay controlled by Arduino.

that is correct sir, but if i have 2 normal switches before is it possible to just use them,insted off buying new ones for 80dollar?

Your question is not clear enough to be answered. Please describe what you're trying to achieve in detail.

You have two mains voltage light switches? What type (single pole, twin pole)? If they are already wired up so that both switches control the same lamp(s), they are probably twin pole.

You want the Arduino to replace one of those switches, or both? You want to have the two switches as inputs to the Arduino?

Before you get too far down this route, also try to be clear about how the logic level and mains voltage wiring are physically and electrically organised. Even the faintest remotest most hypothetical possibility of mains voltage being connected to your Arduino hardware is a potentially fatal problem that needs to be addressed. So, if any part of your Arduino is going to be connected to or placed in the same enclosure as any mains voltage hardware or wiring, you have a problem.

It's funny how inaccurate a word like normal can be.

When two switches control a single light (such as at either end of a hallway) electricians, here, call them three way switches. Electronics people call them an SPDT.

I'm from a 120 volt part of the world, a three way switch is only a few dollars.

I'm from a 230V part of the world. Switches here are cheaper than Arduinos. $80 for 3 switches sounds way to much. I think they start at something like €2,50. How come that you pay so much for 3 switches?

im sorry--

im planning on setting up a second switch in the garage. But how will it be possible to use both switches in the garage? ---They needed to be tree way switches.. as jimmy said.

But unfortunet the switch who is in garage now is only one pole.?

will it be possible to use arduino to sort out this problem.? or should i buy tree way switches insted.

Future implanning on setting up a door switch. - Like when u enter, the lights will turn on. Here i will be needed to use relays, but why buy tree way switches when i can just buy one new one pole.?

iguess taxes and the market is high....

Jimmy60:
It's funny how inaccurate a word like normal can be.

When two switches control a single light (such as at either end of a hallway) electricians, here, call them three way switches. Electronics people call them an SPDT.

Not just in the world of electricians does that apply. In the piping world, valves that can route input flow to more then one output port, call them the same way. The piping folks just count the number of port connections that the valve has and if it has 3 it's called a 3 way valve, even though it's designed to have one input that can be routed to either but not both of the two output ports, what electronics call a SPDT switch. It made specifying multi-port solenoid values somewhat tricky for me in my work at a oil refinery, I had to always double check that what I actually required Vs what they named the device were indeed the same thing.

I'm from a 120 volt part of the world, a three way switch is only a few dollars.

I've heard you electrician guys go both ways? Sorry. just an old AC joke. :wink:

sadsad:
will it be possible to use arduino to sort out this problem.?

Bad idea.

sadsad:
or should i buy tree way switches insted.

That. Do you know enough about mains voltage electrics to be sure you can wire them up correctly and safely? If not, consider paying an electrician to do it for you. It's a quick job and therefor not likely to be expensive, and this is the sort of thing that could realistically kill you if you slip up.

To add to what Peter says if you are changing your house wiring you may need to pull a permit in your jurisdiction. Which may mean an inspection to ensure it's all up to code. I would suggest that you ask a local electrician about what you plan to do. Hopefully you know one.

Recently I had an idea for something and my electrician friend told me it would be a no go as the thing I would build wouldn't have been safety approved. Could be a big issue if I burn the place down and hurt someone.

Three way switches are wired differently than a two way. Typically requiring a three conductor wire between the switches at least. Sounds like you'd need to pull some new wire. If you don't know an electrician you may want to start making friends with one.

Electrical wiring is mostly very simple and straightforward but getting it wrong can be tragic. Like fixing your car's brakes, don't do it unless you know what you are doing.

Before you get too deeply into this, you might look into [u]X-10[/u], which is a home-automation standard. You can by all kinds of remote controlled switches, transmitters, and receivers, etc. Some of these replace your existing switches & outlets, and some simply plug-in (or are wireless) so you don't have to "touch" the AC wiring.

There are two important things about AC voltage.
1. You need to isolate the low-voltage from the high voltage (with a relay or opto-isolator, etc.).

2. You need to insulate/isolate humans from the AC voltage.

These two are related because if you don't isolate the low-voltage Arduino, not only can you damage the Arduino, you can damage yourself when you touch the Arduino (or the USB connector, etc.).

I'm not too worried about burning down the house... Yes a fire can happen, but in most cases (if something is miswired or something) you'll blow the circuit breaker before too much heat is generated. But, the circuit breaker will NOT protect you from electrocution.

The simplest way to isolate the Arduino (and yourself) from the AC is with a solid state relay ([u]example[/u]). A mechanical relay can work and it's cheaper, but most high-power mechanical relays can't run directly off the Arduino, so they need some sort of coil driver circuit.

But can arduino remeber what state ur in?

Of course! Every computer/microcontroller has memory.

You can read and write variables (see the [u]Language Reference[/u]). So for example, you can create a variable named LightState and set it's value to 1 when the light is on, and set the value to 0 when it's off. Or, if it seems more logical to you, you can make a type [u]boolean[/u] variable with a name like LightOn and make the variable true when the light is on and false when the light is off.

You'll also need to understand [u]if[/u] statements as well as logical [u]"and" & "or"[/u] logic.

And with a TW523... it has a new part number: X10 Pro PCS05. There is a small library and some sample sketches in the playgroungdto operate the power line modems I mentioned and apparently they (mine) work both ways, they can accept feedback too. there is another X10 modem that is TX only. Simple method to control the lighting. The only issue that I see is that I've never seen 220VAC versions... But I haven't looked either. I've used the devices in my homes over the years and found them to be good, UL approved devices.
[edit Doc]
Doc