Adding web connectivity (via USB) to remote controlled sockets – Part 1 (hardware)
This project page provides a guide to adding both USB and a Web based User Interface (UI) to remote control socket set. In the process we will unlock even more capabilities than are available when you use the socket set as they were originally intended. Part 1 (this post) deals with the hardware, Part 2 deals with programming the chip and Web UI.
It essentially builds upon this blog by [befinitiv]
Radio controlled sockets are a great way to save power in your home. Devices consuming more power on standby than the sockets do can easily be switched off with a remote. For example my desk lamp from a swedish furniture store consumes 10x more power (in the off state) than a radio controlled socket.
Even if the sockets consume more power in standby than the attached electronic device, they offer the luxury of turning stuff off and on without even moving. In short: They are really handy.
However, if you’ve installed the sockets, one sentence will often reoccur: Where the f*** is my remote?
The goal of this post is to show you a way of adding USB support to remote controlled sockets. This opens up a whole new world to remote controlled sockets. Plug this kind of remote into a computer and you can do amazing things.
This gives a pretty good justification for doing this, plus I wanted a worthwhile project to learn a little about programming standalone AT Megas (most of my experience has been with Arduino and PicAxe to date). The main difference here is that I thought I could improve on the system by adding a Web UI to the mix (now I can control it from any device that has a web browser) and that I use a slightly different model of remote.
The main components are:
- Energy Efficient Remote Control Mains Socket Set
- AT Mega 8
- Nokia CA-42 Data Cable (cheap ones here)
- Arduino (or other AVR-MK2 programmer)
- Web-server (I used a Raspberry pi, but any computer will work if it’s running Apache and PHP)
- Lego (if you want to make a Raspberry pi case)
So you may (or not) have noticed that I have ordered different sockets to those used by [befinitiv] in his guide, the reason for this is that I live in Ireland and the sockets he was using have a European connection. When I opened the remote I noticed that the encoder used was different to the one in [befinitiv]’s guide (SC5262 chip datasheet), my heart sank a little. Thankfully I found the datasheet for the HX2262 (datasheet) and it turns out to be identical, so crisis averted!
As [befinitiv] mentions the CA-42 Cable is used because it contains a serial to USB chip. I was happy to pick a few of these cables cheap from Meritline, but after opening them up I found that they were missing the power line (3 core rather than 4), so I swapped out that cable for a 4 core cable, I then found that the voltage on the on the other end was not as high as would be expected (about 3.2v rather than closer to 5v), this low voltage wouldn’t keep the atmega8 powered. I figured it might be the traces on the PCB were so small they were creating extra resistance. Once I bypassed the PCB traces and went directly from the cable to the USB plug all was fine (see below). You can also see that the TX is hooked up to the green cable and the RX (not really used in this guide) is hooked up to the white cable.
Once that’s sorted it’s time to start wiring things up. There are differences in which pins are used on[befinitiv]’s remote and the ones that I acquired , but after some testing, the relevant pins were identified. It’s handy to have the ATMEGA8 datasheet. So starting with the ATMEGA8 start wiring it up as you see below (I decided to go with some vero board rather than ‘dead bug’ it like [befinitiv]). Don’t solder the USB up just yet, we will wait until last as you will want to feed the cable through a whole in the casing before you solder it to the chip. Note the purple, grey, white and black cable coming from the bottom, this is the cable we will use to program the chip.
Then on the front of the remote board (see below) remove the 5 SMD (surface mount device) components highlighted red and connect up teh wires as shown (the green highlights show no connection on this side).
Similarly on the back of the remote board remove the DIP switch (the big red block in the first images) and wire it up as shown.
Then make a hole (drill or melt) in the casing to pass the USB cable through, make a small knot in the USB cable to put around the small post in the casing (see below) in order to stop any tension on the cable damaging any of your connection, then solder up the USB connection to the ATMEGA8. You can see here the complete assembly before we put it back in the casing (again note the programming cable at the bottom).
So now close it up and it should look something like this…
Bonus picture, in case you thought it was a tidy process all the way through 😛