I would like to use a raspberry PI to turn lights on remotely from a raspberry PI.

Wiring Diagram http://imstarboard.com/grachen.png

In this diagram, I am proposing 2 paths for completing the AC circuit and therefore turning the lights on: 1) the lightswitch, and 2) the relay controlled by the raspberry pi (orange wiring).

I know that this isn't a true 3-way switch, meaning that if you turn the lights on using one method you can't turn them off using the other method, but it does allow me to turn them on using either method when the lights are off.

Are there any concern with doing this?

  • Is the question really - can I have a redundant hot feed to a switch? The same breaker will be supplying the switch and the relay right? Jan 23, 2015 at 3:43
  • 3
    Have you considered off the shelf home automation products (insteon or z wave)? Achieves the same capabilities (actually it gets you true three way) without major permanent modifications. One of the problems with a modification like this is resale later. At best if you do a really good job it's some strange wiring; at worst it's a complete mess of the electrical system that could affect the sale when found during inspection.
    – gregmac
    Jan 23, 2015 at 6:50

2 Answers 2


I'm not sure what type of relay you're using, but most relays have at least five terminals. two coil terminals, used to power the coil. One common (C) terminal, where the circuit to be controlled will connect. One normally closed (NC) terminal; which is as it sounds, the side of the switch that is closed when no power is supplied to the coil. And one normally open (NO) terminal, the side of the switch that is open when no power is supplied to the coil.

When power is supplied to the coil, the relay is toggled. The NC contact will now be open, and the NO contact will be closed. This is fairly similar to how 3-way switches work, except that with a 3-way you are the coil (sort of) and determine which way the switch is.

Because of this, you could wire up a circuit like this...

Raspberry pi connected to 3-way switch

However, this setup isn't going to be very smart, since the Raspberry pi is simply going to be switching the current state of the load. So whether the lights go on or off, will depend on the state of the 3-way.

To make this system smarter, you can add in a current transformer (CT), and connect the leads from the CT back to the pi.

Raspberry pi connected to 3-way switch with CT

With this setup, the pi can use the output of the CT to determine the state of the lights. So the pi could either toggle the relay to turn the lights on/off, or not toggle the relay to leave the lights on/off. In any event, the 3-way switch would still work properly.

I don't know much about the Raspberry pi, so I'm not sure it has the ability to work in this way. I also don't know exactly what equipment you're using. I'm simply suggesting a possible solution.

  • 2
    the CT can be on the travelers combined or the live feed to the relay. Jan 23, 2015 at 18:47
  • I didn't realize that about the relay! I also think the CT solution would be easy to integrate into the PI. Thank you.
    – Tim Thomas
    Jan 26, 2015 at 19:12
  • You'll need a small bit of electronics to interface the CT (it produces an AC voltage proportional to the current through its core) to the Pi's low-voltage DC inputs, and provide enough drive for the relay as the Pi's outputs aren't stout enough to do it directly. Conceptually speaking, though, this is how I'd do it! Mar 24, 2015 at 22:32

I would be concerned if the switchboard isn't rated for the voltage/current. You can circumvent this by having the pi control another relay that is rated for the job. This relay can be either near the pi or near the switch.

Some relays have 2 switched outputs (one being the inverted of the other) (single pole double throw). This allows for a proper 3-way setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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