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, 21 February 2012

Arduino home control part 4

Made some good progress with this over the past couple of days.

I experimented with getting the Arduino to read the time and date from the PC, but its too 'ard, mum. Instead, I bought a real time clock module (RTC) from a nice man in China for around four quid and hard wired it to the arduino. Searched the 'web for a simple bit of code to set the clock up, and eventually found this -


its dead simple, even I can understand it. All the other stuff I found was far too complex for my purposes (and I'm too stoopid to understand most of it).

Then comes the programming. I have to say that software is not one of my core skills, but perseverance wins out over my lack of talent. It ain't pretty, but it works.

What it does is the following:-

- reads the time and date off the RTC
- calculates today's dusk and dawn times based on the current month - it will only update these times once a month, but that's near enough for my purposes
- sets up a series of times to switch things on and off. These are either 'real' times, eg 23:30, or a time which is based on the calculated dusk or dawn times. Some lights come on at dusk, others have a delay to turn them on later.
- reports current state back to the server - at the moment, this is a simple VB application which just displays the data on screen, but in future this will find its way into a web page which will run on an Ameo either in the kitchen or by the front door.
- information displayed at the moment is: internal and external temperatures; lock status of external doors; whether there is mail in the box, and which home easy devices are on and off.

The next stage of the plan is to make the arduino control the central ventilation system based on internal and external temperatures (turn it off on a cold night, etc.), and to run a pair of water leak detectors in the kitchen and utility room - these will be automatic, and shut off the water using solenoid operated valves if there is a leak, but the arduino will tell the PC that a leak has occurred and the PC will wind up a bloody great siren. Looking forward to that part :-)

Some interesting times during the development process, where the software kept running in an endless loop, switching things on and off at random, so much so that Mrs G had to retire to the kitchen as the flashing lights in the rest of the house were giving her a headache. There was also a report that the pulsing of the lights on the deck had encouraged a Sea King helicopter to try a landing, but I don't believe that.

It seems to be working OK, its so far managed to turn all the lights on at the right times without any major malfunction, although I will have to fine tune the post-dusk delay a bit on a couple of the lights. Some alarm from MRs G along the lines of 'what happens if it goes wrong and you're not here? Do I have to sit in the dark?', but I still have a spare remote which can be used to turn things on and off, and all of the important bits have their own switches in the room where they live.

More stuff to come, watch this space.

No comments:

Post a Comment