There are a zillion RF remote controlled outlets available but one of the most popular appears to be those from Etekcity. I was able to pick up, at regular price, a set of five and two remote controls for less than $30 on Amazon. I wasn’t sure what I was going to do with them but I figured it was a prime opportunity to do some hacking.
One thing to keep in mind is that these are only controllable with the included remote, and not via the internet. But we will fix that. Also, they are normally off when plugged in and go back to that state if power is lost. I don’t know about you, but I have some applications where I want the outlet to be normally on instead. We will fix that as well. Just keep in mind that these hacks require some knowledge of electronics and basic soldering skills.
Making Normally On Outlets
Changing one of these outlets from normally off to normally on would seem to be a simple task because they use a pretty standard relay which should have pins for both states. As it turns out the relay may or may not have the normally on pin, but it is not accessible on the circuit board. That complicates our task but it’s probably a smart safety move by the manufacturer. What that means, then, is that we need to find a way to reverse the on/off logic.
There are two pieces to reversing the logic. The first is to change the polarity of the LED. The solder pads for the LED are shown in the first picture. Once the LED is removed, we need to make two cuts to the circuit traces as shown in the second picture. The right hand cut separates the LED solder pad from ground. We do that so that after the LED is reversed, we can solder that pad to +5 volts. The left hand cut separates the base of the relay driver transistor from the 4700 ohm resistor. That will allow the second logic polarity reversal to be installed. Double check with an ohmmeter to make sure that the cuts are successful. In the third picture we have reinstalled the LED with the anode now connected to the cut pad and to +5 volts. The leads were just long enough on my unit so that I could bend it over to the +5 volt output of the 78L05 voltage regulator.
The fourth picture shows the method used to reverse the logic for driving the relay. I used a common 2N3904 NPN transistor (an equivalent would be ok) as an inverter. The emitter is soldered to ground, the base is soldered to the on-board 4700 ohm resistor, and the collector is soldered to the base of the relay driver transistor. In order to ensure that the relay driver transistor is normally switched on, I had to add a 4700 ohm resistor from its base to +5 volts. Now, when the logic output is high, it will turn on the new transistor which will turn off the relay driver transistor.
If you want to take an extra step you can cross-wire the appropriate buttons in the remote so that the left button will turn on the modified outlet and the right button turn in off. Basically you need to cut the circuit traces that go to the switch contacts that are closest to the middle of the board and then add jumper wires as shown in the picture
There are two methods possible for controlling the RF outlets from the Internet. Both require the use of a cheap module like the ESP8266. One method would be to wire into one of the remote controls and use a microcontroller to simulate the button presses. The other less messy method is to use a microcontroller to take the place of the remote control. That is what is described here. The microcontroller will receive commands via the ESP8266, translate them into the proper RF bit pattern, and then send that bit pattern to an RF transmitter. It sounds complicated but the only hard part is figuring out what the proper control codes are for your set of RF outlets.
There are many posts online that use an RF receiver and the audio input to a PC to figure out the codes. I have the luxury of having a decent oscilloscope so it is easy for me to capture them. I also have an RF sniffer circuit (detailed in one of my other electronics projects on my website) that allows me to capture RF transmissions using a terminal program on my PC.
The frequency for communicating with the RF outlets is 433.92-MHz and the commands are comprised of a long sync bit, 24 data bits, and 1 stop bit. The data encoding method used is On-Off-Keying (OOK) which means that data bits are differentiated by the on/off times. There are no requirements in OOK for number of bits or period length. That’s why there are so many variations out there for different devices. I have seen that first hand by decoding security sensors and weather sensors. The waveform looks similar to what is shown in the picture here.
The schematic shown here is almost identical to the one I used in the one of the earlier Wi-Fi projects listed on my website. The main difference is that the final version doesn’t have the USB interface but does have an interface to an RF transmitter module. The transmitter module I used is labeled FS1000A and transmits at 433.92-MHz. I have not tried other models of RF transmitters but most should work as long as they have similar characteristics. The RF module is run from the +5 volt input and readily accepts the 3.3-volt logic level for the serial data bit stream from the PIC.
Some ESP8266 modules have their own 3.3 volt regulator onboard so the input to it would be 5 volts. I have included a 3.3 volt regulator in my schematic for the PIC and it can also be used for the ESP module if it doesn’t have its own voltage regulator. This allows the PIC and the ESP to communicate at the same logic levels without the need for converters.
You could simplify the ESP hardware by using the ESP-01 module and the adapter (shown here). The adapter takes +5 volts and has an onboard 3.3 volt regulator. If you go this route I also recommend that you buy the USB interface that is specifically made for the ESP-01. It will make the setup of the ESP-01 much easier.
The software listing is available below. It is an extension of the software I wrote for a previous Wi-Fi project. I chose that because I wanted to have the status response from the PIC displayed as simple graphics instead of text. I also added code to output the single-pin serial bit stream to the RF transmitter. Like the earlier version, I used HTML commands to draw circles that represent the status of each of the five remote switches. Red=off, green=on, and white=unknown. The important thing to remember is that there is no feedback from the remote switches themselves so the software can only maintain the status of the last command sent for each switch. That means that every time there is a power up of the controller hardware the switch statuses are all unknown. That’s it for this post. Check out my other electronics projects at: http://www.boomerrules.com