how to design a relay switch using arduino

i have a problem. i want to design a two-way switch to control home appliances (example light or air conditional system).i can either use a normal home switch and using arduino board to control it.suppose i need to combine both feature together. So,how to design the 2 way switch?

There are lots of relay boards available, use one of those. Make sure contacts are rated for the voltage/current you want to switch. Or use a solid state relay.

What do you mean by 2-way? 2 different sources to turn the appliance on/off? Have arduino read momentary contact from either source; open relay if closed, close relay if open.

sorry for my bad english. well,from the picture i uploaded,i can turn off the light by turning off the switch,relay will open the link between source and the light.for arduino board,i want to implement a wireless system(using internet,let say computer from different location) to tell arduino to close the relay link between source and light in order to turn on the the basic equipments i need are arduino uno,wifi shield/ethernet shield,and a power, where i can find the relay,can you show me the webpage.(my voltage supply is rated at 240v)thank you.


I believe that the switch you are looking for is a SPDT switch. That stands for "single pull double throw." SPDTs are also referred to as "1 Form C" in technical applications, or "three way" switches in the United States (not sure about elsewhere). They are called three ways (even though you''d only use two switches in this application) becasue power to the device can either be cut off completely (state 1), through an upper set of contacts (state 2), or a lower set of contacts (state 3).

This is a great picture showing two of these switches doing what (I think) you want your circuit to do: (original source

Notice how ground and neutral wires are always connected, and only the hot wire is switched. Each of the two switches has one "pole," which can be "thrown" either up or down (again: single pole, double throw). If both poles are up, the circuit is complete and the light goes on. If both poles are down, the same thing happens. But if one is up and the other is down, then the circuit is broken and no power flows.

In order for an Arduino to take the place of one of these high voltage, high current switches, you have the option of using a mechanical relay, or a TRIAC (the "AC" in TRIAC stands for alternating current, which is very important). The relay will be easier to build, safer, and provides it's own measure of isolation from the Arduino. The TRIAC in this application would need an optoisolator to separate the low voltage Arduino from your high voltage source, and various other components to make it work correctly. The mechanical relay uses a small, built-in electromagnet that runs on low current and low voltage to make the connection on the high current, high voltage line.

Either way, you should have enough information to go and do some research for your particular setup, once I warn you that the power you are running into that lamp, often called "mains voltage," can kill you, blow up all of your stuff, or burn your building down. If you are not sure of what you are doing, seek additional help. Personally, I had years of experience with mains voltage before I ever knew there were off the shelf MCUs like the Arduino so I had (and still have) a lot to learn about interfacing the two, but I know how to deal with mains voltage safely. Please know your own limits and be safe.

Good luck! -Jason