3 Way Switches

The ESP8266 devices make excellent replacements for 3 way switches.

The first step is to determine your 3 way switch configuration. Find the side with line in (power) and install a powered wifi switch there (see Wemo 3 Ways).

IMPORTANT NOTE when using an ESP8266 the line (electrical) power is used only to power the ESP8266 (sonoff) or separate power supplies or through the relays, they're not otherwise connected to the ESP8266 inputs!

Powered Side

At least one of the switches must be powered to operate properly.

A belkin wemo or TP link are good choices for simplicity. Follow the instructions for Wemo 3 Ways wiring.

Configured as an MppSwitch, a Wemos mini with a relay shield or a Sonoff by repurposing its button (handy because it already has a power supply) will work. Power the wemos mini with a line voltage to USB power adapter. Wire the relay to control power to the lights/load.

Remote Side

As mentioned in Wemo 3 Ways, the easiest solution is a second smart switch if power can be fed to the remote side of the switch, or a low end dedicated android phone is a great choice as well.

An inexpensive alternative is a powered ESP8266 (any of the choices will do, a relay is not required). Configured as an MppSensor use an AutomationManager toggle rule to toggle the power switch whenever the remote changes (note that power is not physically switched by this remote device).

If the remote is unpowered or you do not want to use an non-certified power supply behind the wall a battery powered device configured as an MppSleeper will work well. The response time to a switch change is about 1-3 seconds depending on your router.

Separate pushbuttons can be added using an MppAlert, perhaps based on a wemos mini with a button shield.

An MppSleeper or MppReporter can be used anywhere (within range of your wifi!) as additional remote switches.

An MppMaker can be used as a switched toggle. Use the relay to switch the load, and the sensor as a toggle button.

MppSensor Wiring

Use a standard 2 way light switch. One side to ground on the ESP8266, the other side to the sensor pin. If used the relay will follow the sensor state.

MppSleeper Wiring

You need a standard electrical 3 way switch, a 1/4 watt 100k resistor, and an inexpensive NPN transitor like a 2n2222. The wemos mini a good device choice for a USB powered version.

An ESP01 board draws < 50uA if it does not have (or you remove) the power LED. At that power draw it should work on a pair of AA batteries for a year or two.

  1. Connect the USB connector, flash and configure the firmware to an MppSleeper

  2. Complete the wiring

    1. Transistor collector (C) to ESP8266 RESET

    2. Transistor emitter (E) to ESP8266 GROUND

    3. Resistor to ESP8266 3V3

    4. Resistor (other side) to Transistor base (B)

    5. Jumper CH_PD to 3V3

    6. 3 way switch output connected together

    7. 3 way switch output connectors to Transistor base (B)

    8. 3 way switch common connector to Transistor collector (C)

    9. Optional - if you have a second sensor you can wire it using RX pin 3 after loading the firmware and use it to report the sensor state.

  3. Setup your AM Server and add a rule to trigger from the MppSleeper event to toggle the powered light switch, and a rule to notify a low battery condition.

  4. Connect the USB connector to test operation. Use AutomationManager to confirm your toggle and battery rules are working.

    • Note that the battery report is only sent in sleep mode when the switch is toggled.

  1. Disconnect the USB, wire the battery between GND and the 3V3 pin and install.

This configuration will also work with a momentary on switch - configure the switch to be open when touched and ground when released. Note the ESP8266 will wake up when the switch is released.

MppReporter Wiring

MppReporter will be based on the ESP-12 as more pins are required. The difference from an MppSleeper is the alert will also wake up occasionally to check in with AM to report battery status but it can also be used for a watchdog to detect it going offline.