Manual and Relay dual control switch

Hi, I am new to Arduino world, so apologies if anything sounds absurd. Here is my idea -

I will connect a Light in a 3-way switch fashion. One of the 3 way switches will be replaced by relay controlled by arduino. I am able to do successfully so far. But knowing status of light is a problem. To know the status I have to have a control on the manual switch also, which is where I am struck. After doing some reading I find the following idea which may or may not be possible.

Can I connect the switch to arudino while it is still connected to mains? If so how can I do it.

Any other Ideas also welcome. The only thing is I do not want to replace the manual switch.

Thanks in Advance :)

raghavendra3790: I will connect a Light in a 3-way switch fashion. One of the 3 way switches will be replaced by relay controlled by arduino. I am able to do successfully so far. But knowing status of light is a problem. To know the status I have to have a control on the manual switch also, which is where I am struck.

I can't visualise how the '3-way switch' would be used. This would probably be easier to understand if you described the overall behaviour you're trying to achieve i.e. how the manual switch and Arduino will be used together to switch something on and off.

You need second relay , but with 230V ( 110V ? ) coil . Connect it's coil to your light - so when you manually turn the light on, coil will be powered an relay will make a contact. Connect one of the relay's contact to GND of arduino and second one to one of digital pins on arduino. The, in you code put a boolean flag :

boolean light_on ;
const byte status_pin =  2 ;   // change the number to whatever pin you connected relay to 

void setup()
{
pinMode( status_pin, INPUT_PULLUP);

}

void loop()
{

  if ( ! digitalRead(status_pin) )
  {
    light_on = true ;
   }
  else
 {
    light_on = false;
  }

}

Then you can use light_on flag to determine what is the state of light :

if ( you_press_a_button && light_on ==  true )
{
  turn_the_light_off ;
}

if ( you_press_a_button && light_on ==  false )
{
  turn_the_light_on ;
}

Instead of relay, you could use something like this : https://www.sparkfun.com/products/11005 and connect it to analog input . If light is off, there is no current measured. If it's on - you'll get some value on analog pin .

@waski, thank you very much that was informative.

@Peter H :

The exact problem statement is like this: Automate a light, but the manual switch will still work as usual. This can be achieved just like a 3 way switch, but the tough part is knowing the status of light. That is where I am struck. I should have full knowledge of light, no matter if it is operated from manual or automated.

By convention, a "two-way light switch" arrangement is where there are two switch locations and a "three-way light switch" is where there are three. Apparently the American principle of aggrandisement applies here, incrementing each number for use in that particular country. :D

Clearly in a hybrid arrangement, to determine whether the light is switched on, you need to sense this directly with an opto-coupler across the lamp connections. The "cheating" method of placing the opto-coupler between the two "traveller" lines (indicating when the light is not switched on) is inadvisable as the opto-coupler is then leaking current into the light when it is off.

raghavendra3790: @waski, thank you very much that was informative.

@Peter H :

The exact problem statement is like this: Automate a light, but the manual switch will still work as usual. This can be achieved just like a 3 way switch, but the tough part is knowing the status of light. That is where I am struck. I should have full knowledge of light, no matter if it is operated from manual or automated.

how did your prohect turn out?

i am working on the exact same problem. the only apparent difference is that i dont only want to know if the light fixture is energized, i want to know the state of the light itself. for my project i do not need to determine level of light (no dimmers) i just need a binary response, light is on or light is off. i can monitor state of my wireless relay, i can monitor the state of a wired relay or optocoupler to determine if the manual switch is on, what if the bulb is burnt? what if i dont want an entire arduino board at every light? i have found tiny bluetooth relays to do the remote controlling, i cannot find cicuits to wirelessly monitor the state of a relay manually tripped or wirelessly monitor an octocoupler, or wirelessly report the status of a photocell. any ideas/help?

L