Hooking up a Microcontroller to HomeEasy home automation devices.

Tuesday 24th November 2009

...and making an awesome alarm clock

Rencently I bought two wireless light bulb switches. The package consists of a bulb holder and a seperate switch. The switch sends a low power signal over the radio waves to turn the light on and off. It allows me to have an extra lightswitch in my room without my landlord going 'mental.

However, having a simple switch is quite dull...

By hooking up a microcontroller on my Arduino to communicate on the same radio waves, suddenly the possibilites are a bit more interesting. Below is a circuit diagram, and a photo of the prototype setup on a breadboard.

Parts

  • An Arduino (a prototype board featuring an ATMega328 microcontroller
  • A 433.92 Mhz transmitter (and receiver for reverse engineering the protocol in the first place)

The photo on the right looks more complicated because it also shows the receiver connected

Code

There was existing work in the Arduino commmunity playground here. with a demo transmitter. I tidied up the code and have re-released it as a re-usable class for various projects. My new class is available in the wiki.

If anyone wants a full description of how the protocol works, drop me an email.

The project I built

Using the microcontroller to control the light bulb I decided I would two two things:

  • Make an alarm clock
  • Add a web front-end

The plan for the alarm clock was to make a device to turn my main light on a few minutes before the conventional alarm on my phone wakes me up. Waking up to a pre-lit room is considerably less miserable in the winter months.

The latter was a result of my bizarre desire to add a web front end to any electrical device I see, it also serves as a convenient mechanism to set the clock and times for the alarm. Without this I would have had to spend ages connected buttons, an LCD and the whole thing would take up more space.

The web frontend comes in two parts. Some code that sits on my PC hosting pretty images and CSS, and a very small web server written in C on the Arduino which performs all the actions.

The web server code is pretty lightweight, and has a pretty robust platform for parsing the requested URL. Is a good reference if you are building your own web projects.

Downloads

  • The Arduino code, PHP front end proxy, and a small python script to sync the alarm clock to PC time.
  • Future

    The next immediate plan is to rebuild the entire circuit from scratch on some stripboard, using a bare ATMega328 and get my Arduino back for more development.

    Make use of interrupts, and sleep the processor to save power

    Move all the webserver code onto the microcontroller.

    I would also like to make the alarm slighlty more complicated - and perhaps parse a vcal feed to know when to turn on...which in 1K of RAM will be a challenge.

    Add in some kind of photoresitor to the mix.

    Comments

    test2

    test2


    Add a comment

    I'm Listening To

    The Holloways - What's The Difference?

    1 days ago

    Recent Changes

    • Page about me
    • Added comments on blog pages
    • Input form on comments
    • Added kdaemonmanager page
    • Draft of kdaemonmanager homepage