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.....

Friday, 28 October 2011

Arduino home control

I've been playing with the Arduino micro for some time, and after a lot of research I have decided that its time to make that little rascal earn its keep.

It presently lives in a purpose made enclosure in the engine room, with a separate 12 volt switch mode power supply in the same box (see picture). All of the various Arduino pins are hard wired inside the box to a row of six RJ45 sockets on the front panel, so that I can connect a variety of devices using modified CAT5 patch leads. I tried using PCB mount RJ45 sockets, but my PCB etching skills were not able to cope with the close pin spacing, so I used a block of sockets cannibalised out of a spare patch panel.

At the moment, all it does is monitor the door status LEDs and the internal and external temperatures - this information is collected by the PC that it is connected to and displayed on a simple pop-up window on the PC. I also have some water leak sensors with solenoid water valves partly built that will be powered from this box, and a bloody great siren to go off if a leak is detected. The longer term plan is to put this information into a web page that can be accessed from any PC in the house, including an old touch screen Ameo. So far, so good, but now its time for some more adventurous stuff.

I use a number of Home Easy devices to switch lights on and off at pre-set times, and these have been a great success, except that the remote that controls the timing is not clever enough to change the time when summer time starts and ends, and it has no facility to track the changes in daylight hours. The unit also eats batteries, and its touch screen drifts out of alignment. Home Easy is good, but could be a lot better.

I have been trying to find ways to control my whole house ventilation system by some more intelligent means than that of me walking up the stairs and pressing a button. I'd like to automatically turn it off when the external temperature drops below a pre-set threshold to prevent the house sucking in a ton of freezing air overnight in the winter and then having to burn a bundle of currency to heat it up again. In the summer, I'd want the unit to turn off when the external temperature was too high, and then turn back on overnight to draw cool air in. I can do the off/on thing with a simple Home Easy unit, just need to synch it with the Arduino temperature sensors and/or timer.

My plan is to control all of the Home Easy units using the Arduino, hooked up to a radio transmitter and receiver modules (less than four quid from China for the pair). If it works as I hope, I should be able to take over the simple light switching that the existing remote does, but with the addition of automatically tracking daylight hours and adjusting the switch on times to suit. The ventilation switching can be geared to the temperatures that the box already monitors

I already have the radio modules and a suitable piece of breadboard; the Arduino is sitting powered up in its box waiting to be told what to do, and I have a wedge of code to drive the radio modules collected from the web that I plan to try out - check out this link. This is likely to be a fairly long drawn out project, as I'm going to have to adapt the generic Arduino code to suit my requirements and hardware, and incorporate the necessary timers and temperature monitoring. I will also need to create a user interface in Visual Basic to allow a simple way to change time and temperature settings.

Watch this space, I'll document the progress in chunks on here. At the moment, I can see the following stages:-

- connect up the radio modules and try them out with the Arduino code and my Home Easy devices. I should start this in the next couple of days, if you see a blinding flash in the sky to the south, you know its not going well
- find a way to track daylight, either by means of a light sensor or an algorithm
- decide whether to write the code that controls the switching on the PC or on the Arduino, VB on the PC is probably easier for me, and the PC already has a real time clock
- write an easy to use user interface to allow time settings and temperature thresholds to be changed - consider doing this as an interactive web page so that it can be accessed from anywhere.


Friday, 21 October 2011

Broken nose avoidance

This is a simple device to warn that a door is open. There are three doors in my house that open outwards into walking spaces, and I have personal painful experience of how easy it is to walk into the edge of one of them in the dark. This post describes a device for providing a flashing LED embedded in the edge of the door to warn you that it is open.

The circuit comes from an old issue of Elektor magazine, shown below:-

I etched the circuit board myself and soldered the parts to it. I used BC107 transistors for TR1 and TR2, and a 2N3906 pnp transistor for TR3, but pretty much any npn transistors will do for the first pair, and any pnp for the third one. The LEDs I used are 5 volt types, but I’m not sure that they need to be, and I suspect any standard LED (and any colour you like) would work just fine.

The LED leads are left long and the LED itself is glued into an alloy plate that is recessed into the edge of the door so that the circuit board just hangs off the LED leads. A space chiseled out of the door behind the plate houses the circuit and battery, there is just enough room to fit a standard C type torch battery.

The unit works by charging a capacitor very slowly, then releasing the charge momentarily to light a LED. Since the LED is only ’on’ for a small fraction of the time, the power consumption is minimal and the unit will comfortably run on a single 1.5 volt torch battery for a long period of time.

The original unit that I built used a single C type Duracell battery and did not have a switch – its been flashing 24/7 for over 5 years at the time of writing this, and shows no sign of slowing down yet. When the battery starts to die, the LED shines less brightly apparently.

The power consumption can be reduced even more if the circuit is switched on and off by means of a pin switch (like the ones used on car bonnet to trigger the alarm) embedded in the hinge edge of the door so that when the door is closed the flasher is turned off and uses no juice at all. Sounds easy, but most internal doors are reinforced internally with strips of card or similar, so you will need to find a long enough implement to poke or drill a hole across through all of these, and then use a long piece of wire to fish the wires through the hole.


The first one has worked so well, and for so long, that I am building two more for the other two doors.

Tuesday, 18 October 2011

Electric sliding door

My house is mostly open plan, so the lounge, dining room, hallway and the first floor landing/study areas are all open to each other. This is fine most of the time, but music played in one room is heard all over the house whether you like it or not, and it can get chilly on a winter’s night so I needed to be able to close off part of the space.

I built a partition across the end of the dining room, with a sliding door to cover the last metre or so. To allow plenty of light into the hall, the partition was built with a wooden frame and large glass panels – great, except that the sliding door weighed a ton and was hard to both move and stop as a result, and I was concerned that my small grandchildren might squash fingers and/or other body parts in it. I decided to motorise it, and this is a description of how I did this. I havn’t included any details of the construction of the partition itself, if you are interested in knowing how this was done, let me know

I started with hanging the door on a standard sliding door gear, a simple track at the top with trolley wheels attached to the door, and a plastic block screwed into the floor to guide it. The bottom of the door had a slot machined with a router, and a length of aluminium channel screwed in it to allow the plastic block to slide smoothly. This picture shows the door initially hung on the door gear and before the glass went in - it would have been too heavy to move around if the glass had been installed first:-

I originally planned a fully automated solution where the door opens automatically when a warm body approaches, but quickly realised that this kind of sophisticated solution would be pretty complex – for even the most basic automatic operation the door would need a variety of safety features to stop it at the end of its travel and detect obstacles in the way. I wanted the operation to be simple and foolproof, so opted for a more manual approach using readily available parts.

First, the drive motor. This needs to be fairly powerful to shift the weight, with a high starting torque, but it doesn’t need to run fast. A rummage in my junk box produced a 12 volt electric car window winder motor which is ideal, and a bit more digging produced a set of electric window switches out of a Renault 25. The motor runs in either direction simply by reversing the power, and the switches are designed to do the reversing of the power connections. I obviously needed a switch on either side of the door, and I also used the ‘window lock’ switch mounted high up so that I could turn the whole gubbins off to stop the children (and some of the grown-ups) playing with it.

I needed a robust mounting for the motor so I welded up a small frame from steel tubing and screwed it rigidly into place onto the framework in the space above the partition. The motor is mounted on an aluminium plate which has a short alloy tube fixed into the corner angle with short screws and epoxy glue (I know, it sounds like a lash-up, but it works fine). The tube has a pair of ball bearings pressed in and a short spindle which carried the cable drive at one end and a coupling to the motor at the other. See picture at right

Connecting the motor to drive the door was achieved by means of a length of thin steel cable which runs in a loop along the top of the door – I used a gearchange cable from a mountain bike, but you can buy cable like this by the metre from a DIY store. To drive the cable, the motor was fitted with a drum (mine came from a long forgotten photocopier, but it would be easy to make one on a small lathe) which the cable was wound round several times. The same copier produced a set of small guide pulleys to steer the cable.

Both of the cable ends are clamped to a plate screwed to the door using the ‘bolts-with-holes-in’ used on the brakes on bikes, these allow a neat fixing and also allow you to pull all the slack out of the cable so that it remains tight at all times – if there’s any slack in it, the drive pulley will slip and the door won’t move.

The initial trial run proved that this system worked, but the motor ran much too fast and the big heavy door took off like a tank with a baboon at the wheel, a bit unnerving to say the least. I bought a cheap motor speed controller kit from Jaycar and used this with trial and error to get the speed to a point where the door moved at a sensible speed and the weight was properly controlled, with major benefits to both my blood pressure and the structural safety of the house.

The last thing was a fail-safe method of stopping the door at both ends of its travel, even if the operator keeps their finger on the button. A simple micro switch is mounted at each end of the sliding door track, with an adjustable plate screwed to the ends of the door, so that the power to the relays is shut off when either of the switches operates - see picture at left.

The operating switches are not man enough to handle the power on their own, so they need relays to do the heavy duty switching for them. These are standard 12 volt car relays which you can pick up from a junk yard or buy new from a shop like Halfords (in the UK). Because of the need to reverse the power to run the motor both forwards and backwards, and to be able to operate the door from two switches (one either side of the partition), I ended up with four relays - I had plenty in the junk box, but it may be feasible to use less.

The switches have built-in tiny bulbs, but on mine most of these were blown, and they use too much current anyway so I carefully prised the switches apart and replaced them with 3mm LEDs. Remember that my house is very dark at night, so these show you where the switches are. Once all the wooden cappings were fitted around the partition, I added a pair of decorative alloy plates to the switches to give a neat finish.

Then I started to think about how it should all operate safely. Obviously the door should only work when one of the switches is held down, and second it must not trap the occupants if the room if either the power or the mechanism should fail. I tackled these issues in multiple ways to give a belt and braces solution.

To solve the power failure problem, I opted for driving the system with a small sealed lead acid battery of the type used in burglar alarms. This drives the motor, speed controller, and LEDs using 12 volts DC without the need for a mains transformer, and it keeps the door working for days without any mains power. To keep the battery topped up at all times, I installed a battery charger which is permanently connected to a power socket installed in the space above the door.

Other occupants of the house were understandably nervous that not just the power but the whole contraption might fail, leaving them trapped for ever behind the door – a valid point, as we’ve had one such failure when a poorly attached battery terminal came unhitched. The metal plate that clamps the ends of the cables is attached to the door with a pair of 10 mm diameter threaded rods that extend right through the door, with a slot cut in both ends so that they can be removed from either side of the door. When the screwed rods are removed, the plate is left hanging loose on the cables and the door is free to slide on the track. In the room 'inside' the partition, the space above the door has a couple of lift up flaps supported on short gas struts and contains a panic box containing a screwdriver for removing these screws as probably not many people watch TV with a toolkit in their pocket.

The panic box also contains a spare motor and a set of spare switches as insurance in case any of the parts fails and I can't remember where I put the spare bits, as I rather doubt that you can still buy window switches from a 1991 Renault 25. As a last resort there is also a spare door key so that if everything jams up and none of the emergency systems work you can always bale out of a window and get back in the house by more traditional means.

There is a small control panel above the door with LEDs to show that power is present, and although this was not its original purpose this has the massive advantage of shining a dim light down on the face of the door at night to save you the inevitable broken nose caused by walking into the closed door in the dark.

I originally thought it would be neat to shine LEDs into the edge of the glass panels to give them a greenish glow and spent an awful lot of time drilling holes and running wires to achieve this, but the end result is that the glow is very dim and only visible when all the lights are off, so I never switch them on. Brighter LEDs would work better, but if I was doing it all again I wouldn’t bother. These LEDs are operated by a switch on the panel above the door, with another small LED to show when they are on or off.


The door mechanism works really well, in spite of being made almost entirely from junk. Anyone can operate it, even when carrying an armful of stuff as the switches can be operated with an elbow, a nose, or any other sticky-out bit. It keeps working during the regular power failures that we get, and so far we havn’t managed to squash anybody, small or otherwise.

Friday, 14 October 2011

Door lock indicators

The first project to be described here is my door lock indicators. I have the euro style door locks rather than the more standard Yale type, and these require you to either turn a key (from the outside) or a knob (inside) to lock the door. They don't slam lock like a Yale and can't lock you out if the door blows shut while you are outside. They work great, but its impossible to tell if the door is locked or not without trying the knob. When locking the house it is therefore necessary to physically check each door, a bit of a pain especially when all the lights are out. The garage is attached to the house and has a remote-controlled door, and again the only way to check if the door is closed is to go and look. I needed a way to easily check the status of the doors, so I ended up fitting a set of LED lights to each door, operated by a micro-switch hidden in the lock plate.

These are simple LEDs that light up red or green to show if the door is locked (green) or not (red). The lights let me see at a glance if the doors are locked before going out or going to bed.

The switch is a standard micro switch, mounted on to an aluminium plate which is screwed to the inside of the opening in the door frame where the lock tongue goes in. The plate has slots to allow the switch to be adjusted back and forth so that it engages properly with the lock tongue - too close and the tongue fouls on the switch and the door won't lock - too far away and the switch fails to operate. The wooden doors and frame expand and contract with the weather, and the lock mechanism is not very precise, so trial and error is the only way to get the adjustment right. I fitted a small piece of thin rubber over the switch operating button with super glue to cushion the switch a bit.

The switches have to be the type that have three connections, common (COM), normally open (NO) and normally closed (NC) and a single plastic button that operates it. Mine came from some of the many photocopiers and printers that I've cannibalized for parts over the years, but they are readily available and cheap to buy. There are all sorts of lever attachments for these switches which would make the adjustment less critical, but there isn't room inside the hole

The lights are fed from CAT5 which carries power from a central 12v power supply located in the central 'engine room' in the house where the server and network stuff lives. Although CAT5 has 8 wires, I only used 4 of them and stripped away the spares to save space. I wanted to be able to mimic the lights to some central point, so the connections that operate the LEDs at the door are also carried back to the engine room.

The CAT5 terminates on a wall plate close to the door, then the cable is run behind the skirting to the base of the door frame. I routed a slot in the frame of the door and fed the wires up through that, then glued a strip of wood back into the slot to conceal them. The LEDs are mounted to a small piece of aluminium angle, recessed into the door frame, this also conceals the screws that hold the switch and the hole that the wires come through. The LEDs are standard 5mm types, so I drilled 5 mm holes in the plate and super-glued the LEDs

into the holes, then fixed the plate into the frame using a couple of dabs of 'No More Nails'. There's very little space in the hole, so it was necessary to chisel out a bit of the frame to fit the switch and make room for the wires.

The switches and LEDs are wired as follows:-

· +12v connects to 'COM' on the switch

· Oone leg of the red LED connects to NC

· Oone leg of the green LED connects to NO

· Tthe remaining legs of both LEDs are connected together, then to a 150 ohm resistor, and then to the 0v wire

· TTo be able to mimic the lights elsewhere in the house, I also connected wires to the NO and NC connections

The switches will allow for push-on connectors, but there's not much space so I soldered them all. The LEDs will only work when wired one way round, if they don't light up, just reverse the connections. Because only one LED is live at any one time, only a single resistor is needed. The LEDs can be run from from 5v, but they will be less bright and harder to see in daylight, and I had a spare 12v power supply. You could use a bi-coloured single LED, but I used bits from my junk boxes and didn't have any of these.

The garage door has a similar arrangement, but because there's no need to conceal the switch its just mounted on an aluminium bracket screwed to the door frame. The door itself carries another bracket with a rod which engages with the switch, the rod is threaded to allow for adjustment

Conclusion - This is one of the most useful and least expensive features in the house. When going to bed, just walking through the house I can see instantly if the doors are locked and with all the house lights off the LEDs provide just enough light to navigate around without tripping over things. It was easy to do, cost nothing (already had the parts in my junk box) and works exceptionally well.

The next step is to connect the outputs from the door switches into my server where a small application will monitor them and display their status on a web page. The same web page will also display the image from the camera that covers the front door. A spare pocket PC mounted centrally in the house will view the web page over wi-fi. Watch this space for details