Putting a Sonoff in your wall switch box

So here’s how I wired up a 3 way (US) 2 way (UK) light using a single sonoff.
It assumes that your 3 way light was setup in a specific way. The following things need to all be coming into one wall box

  • Power from breaker box
  • dedicated wire to light

additionally your traveler wire needs to do NOTHING but run between the two wall boxes

  • dedicated traveler wire to the second switch

Modifications to sonoff:

  • 2 conductor 26awg wire soldered onto GPIO 14 & ground pins
  • 4.7k resister connecting 3.3v to the TX pin, along with another 2 conductor 26awg wire with 1 conductor connected to TX (along with the leg of the resistor) and the other connector going to ground.

It’s very important that you verify that your wiring configuration is setup identically to this, or things will probably go up in smoke. An inductive voltage tester is pretty handy to help make these determinations.

So we are going to call Box1 the main box, with power in from breaker box, wiring up to light, and one end of the traveler wire.

Box 2 will be the wall box that has a switch and the other end of the traveler wire in it

Box1:

  • Connect the black & white wires from the breaker box to the input of your sonoff.
  • Connect the black & white wires going to the light to the output side of the sonoff.
  • Connect the switch to GPIO 14 & ground of the sonoff (I find that tinning about 2 inches of the end of the 26awg wire makes using the switch screw terminals, which were designed to accept 12-14awg solid wire much easier to use)
  • Using a couple of wirenuts connect the second pair of 26awg wire to the red & black wires of the traveler wire. Again, about 2 inches of twisted and tinned ends make wirenutting 26awg wire to 14/16 solid wire much easier.

Box2:
*Connect the red/black wires to the switch

Setup the sonoff

  • GPIO14 is set to “09 Switch1”
  • GPIO1 Serial Out is set to 10 “Switch2”

Now, make sure both switches are in the “off” position and turn on power at the breaker. Changing either switch from on to off or off to on will result in the light toggling state. Basically we set it up like we would a normal sonoff, then use the existing traveler wire, that previously carried the high voltage, into another low vlotage GPIO switch.

Here is a pretty basic diagram showing what I did, along with the modifications to the sonoff.

1 Like