About Me

I've been taking things to bits, and making things ever since I can remember, starting with dismantling knackered alarm clocks and watches and helping my dad fix the car. Now I have a well-equipped workshop and have aquired lots of new skills, so I can make better stuff. When they first appeared, I became involved with personal computers, and these and developments in electronics have increased the scope of the things that I can do. Just recently retired, so O yes, now I can make all sorts of stuff.....

Tuesday 31 January 2012

Arduino home control - Part3

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 :-)


Wednesday 18 January 2012

Mail waiting alert - update

A quick follow up on this following an investigation today into the power issues and some mods to cure some erratic operation over the past week.

First, the power supply was only dishing up around 9 volts which fell to less than 8 by the time it reached the gatepost. Luckily, its a PSU salvaged from an industrial-strength network switch, and the output is adjustable with a small potentiometer, so a quick twiddle and voila! around 12 volts at the gate.

Still erratic in operation though :-( A bit more research later and I think I've found the cause. The Vellemann kit is designed to run off a couple of 9 volt PP3 batteries, one each for the transmitter and the receiver, and their web site/forum says that its OK to run the whole shebang at 12 volts. However, I discovered that if I drop the power to 9 volts on the receiver and leave it at 12 on the transmitter the instability goes away - no idea why, and finding out is well beyond my electronics knowledge. I've added a simple 9 volt regulator in the box and all seems well.

Just as well, as Mrs Grizzly was getting increasingly ticked off by trekking out to the gate to find the box was empty - a bit ironic, as when I announced I was going to make this gadget I got the standard roll of eyes and 'what on earth for??....' :-)


Friday 13 January 2012

Mail waiting alert

My mailbox is on the gatepost, and the erratic timing of mail deliveries round these parts means sometimes several trips per day out in the pouring rain to check if there is mail. I built a detector from a Velleman kit to let me know when there was mail in the box, and this is how I did it.

The Velleman kit is an MK120 IR light barrier kit, available from Maplins in the UK and a number of other suppliers for around £10. It creates an infra red barrier, and sets off a squawker when the beam is broken. The kit needs to be soldered together, and for my purposes I needed to modify the kit slightly, as follows:-

1. make the infra red LEDs separate from the circuit boards
2. remove the squawker and replace it with a bright LED
3. also make the device send a signal to my Arduino based monitoring system.

First, the easy part - mounting the circuit boards in a weather-proof box. I had a spare aluminium box left over from another project and simply marked out the position of the holes and drilled and tapped them, then mounted the circuit boards on small plastic spacers to ensure that they couldn't touch the box.

The wires all come through the bottom of the box, and I put rubber grommets in the holes to seal them from the weather and stop the cables from chafing against the edges of the holes. Once all the holes were drilled, I sprayed the box and lid with satin black from an aerosol can.

In the picture, the green and yellow cables are the feeds to the IR LEDs, the other loose wires feed the LEDs that are fitted into the lid of the box.

To mount the LEDs remotely from the circuit boards I used a short length of coaxial cable (from and old audio lead) for each one. I tried CAT5 twisted pair cables and they were very prone to false alarms, I think because they picked up noise from each other and from the power cable - the coax solved that problem.

The LED end of these cables is exposed to the weather, so I encapsulated the end of the cables and the soldered connections in epoxy resin.

The 'mail waiting' alert is a bright orange LED that is fixed into the lid of the box (drill a 5mm diameter hole and secure the LED in it with a dab of super glue) with a short length of flexible cable to connect it to the squawker connection on the PCB. Note that a 220 ohm resistor is used to limit the current to the LED, and the LED was selected to give a bright light from around 5 volts - the box sits in direct sunlight most of the day, and a standard brightness LED can't be seen easily. Keep the unused squawker in your spares box for another day :-)

To seal the box from the weather I ran a small bead of silicone sealer around the edge of the lid and screwed it down tight. The sealer gets squeezed out of the joint, so the excess needs to be cleaned off before it dries (scrape most of it off with a screwdriver, then scrub it down with a wet cloth)

I feed the device with power from a central 12 volt power supply fitted in my central Arduino box, and a second (green) LED fitted into the lid of the box shows that power is present. This power supply also feeds the water leak detectors in the house (more on these later). The Velleman kit is designed to run on a 9 volt PP3 battery, but will happily work on 12 volts. When I built the house, I had a duct laid under the driveway to the gatepost and laid both CAT5 cabling and a mains power cable in it, so power is fed to the mailbox via the CAT5. This is not ideal, as the long cable run means that the voltage drops considerably and the 12v at the power supply ends up being around 8v at the mailbox. I plan to modify the power supply to fix that, although the mail detector works fine at this low voltage.

The same CAT5 cable also lets me feed the 'alert' signal back to the Arduino so that I can see on a screen in the house if there is mail in the box. I originally tried just using the raw output from the squawker connections, but could not get the Arduino to reliably read it, then realised that this was because the power supply is separate from the Arduino - instead, I use the squawker output to fire a small 5 volt relay which switches a connection between the Arduino's own 5v power rail and the data pin which monitors the mailbox status. Works a treat, although the low voltage sometimes makes the relay chatter instead of latching solidly.

My mailbox is a simple tin affair with an opening door at the front. I mounted the LEDs into some short plastic tubes glued to an aluminium plate across the back of the box, and angled in towards each other at around 45 degrees. A cheap make-up mirror is fixed to the inside of the door with double sided tape and reflects the beam when the door is closed. Drop a letter into the box and the beam is interrupted and the warning light comes on. Hooray!

It works fine, I just need to jack up the power a little so that the relay latches reliably. No more abortive trips in the rain out to the gatepost for me!