Success at last!
Well, I've lost count of the days I have wasted trying to get this to work using my Chinese radio modules and code off the 'net. Some of the code that I downloaded had errors, but I suspect that I could have made it all work if I'd had a bigger brain and an understanding of C++. Can't be arsed to learn C++, so I looked around for an alternative.
The best one I stumbled over is a chap on Instructables who had hacked one of the Home Easy HE100 remote controls so that pulses on the arduino switched opto-couplers to operate the on
and off buttons - brilliant! Original source for this is here -
I searched for a HE100 to butcher, but could only find them bundled with more HE modules that I didn't need. However, my son Sean had a HE200 spare, so I scrounged it and set to work with my little hatchet.
The HE100 is a simple remote with four pairs of buttons to switch a maximum of four devices on and off. The HE200 is a more complex remote with a small display panel and the ability to run timers and to control up to 16 devices on the same house code. However, to select a specific device, you need to press the 'unit' button until the number of the device you want comes up on the display, then hit the 'on' or 'off' button. Like most of these devices, the buttons simply momentarily short out contacts and it is easy to mimic a series of button presses using the arduino.
First step was to dismember the beast and see what's inside. There are two screws in the battery compartment which hold the two halves of the case together, you will need to gently prise the two halves apart with a thin screwdriver to release the clips. The PCB is held in with another two screws and clips at the top end which force the contacts on the PCB against the rubbery terminals for the display screen. With a bit of care, the board pops out leaving the display and the switches in the case half. PCB looks like this from the switch side:-
...and like this from the back. The wires are not part of the remote, I soldered them on to do some testing.
The PCB is double sided, and luckily the connections needed for the switches also appear on the back side of the board. Even better, the copper tracks have small bare copper pads, probably for testing, and ideal for soldering fine wires. Best of all, these pads are numbered, so pad 65 on the switch side appears on the back and labelled 65 as well.
This remote has two batteries, there is a 3 volt button cell which runs the timers and the switches etc, and a beefier 12 volt cell to power the radio transmitter - it will probably work off a lower voltage, but 12v gives maximum range. My arduino is in a box which also contains a 12 volt power supply, so I left the battery out and connected the terminals to the CAT5 fly lead which also feeds signals back to the arduino. I left the button cell in place, they last a long time and I didn't want to mess about dropping the 12 v down to 3.
You can't just connect the arduino outputs to the circuit board. I didn't try it but I imagine a small puff of acrid smoke and another visit to Mr Credit Card to replace the burnt bits. Instead, I used opto-isolators - these are small chips that connect to the arduino pins on one side and to the HE200 switch terminals on the other, a high signal from the arduino causes the terminals on the other side to be connected.
I wanted a neat job, so I fitted the opto-isolators inside the case of the remote - as you can see in the picture below, I just glued the back of the chips to the PCB with a dab of superglue, and then soldered the wires from the CAT5 fly lead to the various solder pads and the legs of the isolators. With some careful bending and trimming of the isolator legs, I managed to get the whole setup low enough to fit inside the case.
I screwed the case back together again, inserted the button cell and - amazing! - the display fired up fine, and all the buttons worked. Connected up the fly lead to the arduino box, no blinding flash or puffs of smoke, always a good sign. Finally I set a HE receiver into 'learn' mode and pressed the 'on' button on the remote, and the receiver did the usual reassuring clicking and turned on and off when I pressed the buttons on the remote.
I wrote a simple bit of code for the arduino to test it - basically, I 'learned' the receiver to be unit 10, then wrote some code that pulsed the unit button 10 times, then pulsed the 'on' button once. It worked! There is no way for the remote to tell the arduino which unit it has stopped at, so I set the remote to unit 1 using the buttons, then amended the code so that it counts up to unit 10, does the switching, then counts back to unit 1 again. This will be fine as long as the unit button doesn't get pressed accidentally, I need to find out how to prevent this - maybe a dollop of Mr Super Glue in the button
Too pleased with myself to do any more tonight, but a good day's work. I need to modify the code so that it reads the time and date from the PC when the code first starts up (the arduino has no internal real time clock) and I can then either write code that calculates when its dark or use a light sensor to tell it. Turning lights on and off at set times is one of the key functions of this box, and once this is working reliably I will add the rest of the stuff - switching the vent system with temperature; monitoring door lock status; watching the mailbox and the water leak sensors. Then tomorrow, we take over the world!
Thanks to all those who have helped with supplying me with information of this project, a pity that I am too stoopid to make the radio modules work - however, this hacked remote will do what I want it to with minimal effort, so I can spend more time doing other stuff :-)