3

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.

  • 1
    Please provide a diagram showing what you want to do. – joan Nov 1 '17 at 7:49
  • I want to add a physical switch between relay circuit so that I can control my machines over raspberry pi & with manually too. – Ashish Gupta Nov 2 '17 at 9:20
  • It looks like your relays have three terminals each... probably a normally open (NO), normally closed (NC), and common (C)... is this correct? – RubberStamp Nov 9 '17 at 0:23
3
+100

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.

  • But this method is only applicable to a very small group of devices which emits light, we can not use this into other things like Fan, Air Conditioner etc. So there is a solution for this, we can use current sensor in the circuit, which will tell us how much current is flowing, so we can set a range in which anything turns on like 220V/110V. – Ashish Gupta Nov 10 '17 at 10:40
  • Yes, that would be a more general method. Though most generally it’s mainly lights that need to be controlled by humans and home automation at the same time. – Stuggi Nov 11 '17 at 11:15
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

  • 1
    This is the answer I would've given and a standard implementation of double switches. This is often use around stairs for example. You have a switch on both end of the stairs to switch the light upstairs. – 88weighed Nov 7 '17 at 15:31
  • The manual switch then dominate over relay, if the manual switch is on, relay will not be able to on/off the lamp. As you are using both 2 way switches. for your kind information, Relay acts as one way switch. – Ashish Gupta Nov 8 '17 at 8:10
  • So basically you want to control your manual switch? I don't think there is a way to do such a thing. I'll elaborate in an answer. – 88weighed Nov 8 '17 at 8:59
  • @AshishGupta: If your relays have three terminals, NO, NC, and C... you can hook the Hot side to C and the NC and NO to a three way switch as pictured above. This setup will allow you to operate the light independently from either the manual switch or the relay. However, things get a little more complex if you want to maintain the status of the light using the relay board.... you'll need to add a current sensing circuit which determines if there is current flowing in the Hot line connected to the relay common. – RubberStamp Nov 9 '17 at 0:28
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.

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.