4

enter image description hereI am currently working on Home Automation Project with Raspberry Pi, I am using 8 channel relay board for this, I can control switches over relay easily. But I want to operate them with pre-existing buttons too in my home. So if I want to switch on/off any switch manually, I can do it. Can someone suggest me how to do wiring for that? So I can switch over relay and manual switches.

Ashish Gupta
  • 51
  • 1
  • 1
  • 8

6 Answers6

3

I think I found what you are looking for :

In this exemple, we see that two switches are controlling one lamp, so toggling one of these switch will toggle the lamp.

enter image description here

In your case, you need to consider your relay as the first switch, and your pre-existing switch as the second one.

Image taken from : https://diy.stackexchange.com/questions/31632/wiring-a-double-light-switch

Technico.top
  • 1,426
  • 13
  • 20
3

The double switch method (also called a staircase switch) would be preferable, as it's easier to integrate with existing wiring, but it leaves your Pi without knowledge about the state of the load.

As I see it you have two options:

  1. Make the switch pull an input high or low on the Raspi, which you then use in your code to control the lamp or other load appropriately. This is by far the easiest to code for, but leaves you lamps at the mercy of the Raspi's reliability.

  2. Utilize the double switch arrangement, and use a sensor to detect if the lamp is on. This means you have less wiring to do on the AC side, but you need to handle more possible cases in code. An LDR for example would work great for detecting if the lamp is on or off.

Stuggi
  • 268
  • 1
  • 2
  • 4
0

Waaaay old thread, but if someone stumbles across it...

You could use 3x NO NC relays. First one controlled by the switch, sending the current on to the two other relays. Relay1 open -> Relay2, Relay1 closed -> Relay3. Then you can controll Relay2 and Relay3 with the same GPIO from the rPI. Relay2 sending current to the light when closed, Relay3 sending current when open. I guess you could even send current from Relay1 back to the rPI to detect if R2 or R3 is "active", and know the status of the light from that. The good thing here, is that the lightswitch would still work, even with the rPI being down.

0

If the previous solution isn't feasible because of the lack of wires in your walls, a workaround would be to use some wireless button pusher, instead of your relay.

enter image description here

So both humans and "computers" will physically be able to push your switches.

This method has a backdraw : it seems to need a specific OS to work on the rasberry, as discussed here.

Technico.top
  • 1,426
  • 13
  • 20
0

If I understand your problem, you have to branch the relay and the manual switch in parallel, and both in serial with the bubble. This way either the manual pression or the electrical relay will be able to switch on/off. The question is do you want to do when both switch are in the ON position and a switch off is required? if both manual and relay must commute it is ok, but if you want a single action, you have to use a 'va et vient' switch. look at the animation and wiring here

claudio06
  • 56
  • 4
0

After your comment on Technico.top's answer I think I understand what you want. Normally this would be done with a dual switch setup like the one below, where one of the switches would be your relay.

Switching circuit

From what I understand you want to be able to switch the light to the desired status with your relay at any time. Someone switching the manual switch in this setup, would mess up your knowledge of the lights current status.

The only other setup I can think of is one I have in place myself, but it requires replacing your existing switch from a toggle switch to a momentary switch:

Your relay setup would be the same in the image in your post. The momentary switch would however also need to be connected to a GPIO and GND on the Raspberry Pi. You could use your current (normal) toggle switch as a momentary switch by briefly switching it on and off, but that requires user behavior.

Your program would require a variable to know the status of the relay so you can have multiple ways to toggle it.

88weighed
  • 915
  • 6
  • 17