For years I have been using a hacked Belkin Wemo smart plug to control various things around the house (box fan, 3D printer, Christmas tree, etc). A friend gave me this Wemo when he found out how many security vulnerabilities Belkin had left open in these devices. I had no interest in using a cloud controlled power outlet, but was interested in self-hosted home automation, so I replaced its firmware with a build of OpenWRT that supports the Ralink RT5350F SoC in this Wemo. That worked great for many years, providing a simple web interface to twiddle the GPIO pin connected to the outlet's relay.
Fast forward to a few days ago when we were setting up the Christmas tree. I plugged the Wemo in, it booted up, joined the WiFi network and worked for a few minutes, then stopped responding. I tore it apart, connected to the serial terminal I had previously soldered debug breakout wires to, and everything seemed to be fine, but it was experiencing massive packet loss and frequently would not grab an IP address. Not wanting to waste a bunch of time troubleshooting what was wrong, I decided to rip out the Ralink SoC logic board and massively simplify the device.
Thankfully, the logic board in this Wemo is completely separated from the AC bits by a 3 wire connector. A ground wire (black), a 5v DC supply wire (red), and a 3.3v logic level relay control wire (white). That modularity made this hack extremely simple. I grabbed a spare Moteino microcontroller I had sitting around which operates at a 3.3v logic level and accepts a 5v input. The Moteino is an Arduino compatible Atmega328 + RFM69 transceiver radio developer board. You can read more about Moteino's here: (https://lowpowerlab.com/guide/moteino/). I have several other SwitchMotes and Moteino powered devices around my house, including a Raspberry Pi powered Moteino Gateway (https://lowpowerlab.com/guide/gateway/), so this was a perfect addition to that ecosystem.
I programmed this Moteino with the stock firmware designed for LowPowerLab's SwitchMote (https://lowpowerlab.com/guide/switchmote/). I wired up a momentary push button behind the Wemo's front button, connected between ground and the Moteino's digital pin 5. I wired up a resistor and a green LED (pointed at the front button's light pipe) between ground and digital pin 18 (AKA analog pin 4). I connected the relay trigger wire up to digital pin 7. These are the exact same pins used in the SwitchMote kit, allowing me to use the unmodified SwitchMoteR2 firmware (https://github.com/LowPowerLab/RFM69/blob/master/Examples/SwitchMote/SwitchMoteR2.ino) on this Moteino. A couple hideous blobs of hot glue and a piece of popsicle stick helped keep everything in place, with the momentary switch glued to the back of the popsicle stick to hover above the front button. After a few parameters were configured over the Moteino's serial interface (Network ID, Node ID, Encryption string, etc), I reassembled the Wemo case and tested everything. It worked great! The "WeMote" was born!
There were a few huge benefits to this conversion. The first is that the device now boots to an operational state instantly, instead of having to wait for OpenWRT to boot up, join the WiFi network, get an IP and start running all the scripts that configure and manage GPIO states and the Web UI. The second advantage is that it now interfaces seamlessly with my Moteino gateway, allowing easy remote control, monitoring, and custom events to manage the state of the relay. It also made it extremely simple to sync / pair with another SwitchMotes I already had installed, allowing me to make use of an un-used button on one of them to control the remote WeMote outlet. This also provided a very important bonus, boosting the Wife acceptance factor to acceptable levels 😉