Home Automation (Cont…)

To carry on with the Lightwave automation work, I’ve made a few other changes.

I’ve now rewritten all the arduino sketch again, this time to remove hard coded transmitter ids, and expect an id for every call, and also to allow for the control of dimmer switches so I can set the dimmer level of a light.

Following on from this, I’ve completely rewritten the PHP, using the php-serial library to bring a bit more stability to the serial comms, and also created a mysql database and a bunch of tables to hold the transmitters, devices, types, paired transmitters, etc.  This allows me to dynamically build the page on the fly now using the database, looking something like:


As I know the types from the DB, I can offer a dimmer setting on those, and you can alter dim by touching/clicking on a region of the gradient fill bar below the on off switches.

The device is still on a breadboard and needs soldering together, but I want to create config pages next that

  • Setup/create the database
  • Allow for addition of a new transmitter
  • Modification of settings, e.g. delay timer for command, serial port location, etc.
  • Modification of rooms/etc
  • Pairing of a transmitter with receiver
  • Implement the ‘all off’ kill switch again, to power off everything in the database
  • Confirm this all works even from a hard reset!


Home Automation

I’ve recently started down the path of home automation.  As well as my alarm which I can control from my mobile app, I’ve recently invested in some Lightwave RF switches and sockets, as well as the mood controller, and a PIR controller, however, I wanted to take this one step further.

You can buy a Lightwave RF wifi link, but this is around £70 and I consider this over priced given the technology within it and I expect this cost is related to the web portal you have to use to go with it, so I took it upon myself to build something similar at a cheaper rate using open source hardware.

I’ve got an arduino and a raspberry Pi, and decided initially that the arduino is better suited to this task.  I purchased a RF 434MHz transmitter and receiver, wired this into the arduino, and sure enough, I now have a method to broadcast the relevant RF signals to the various sockets.

This took a few hours to get working correctly but I’ve now got my arduino paired with all my sockets/switches and a serial connection into the arduino to power on/off each of these, as well as a ‘kill’ all off setting to turn everything off without question.

From there, I’ve paired this to my raspberry pi via serial, and then very quickly created a set of PHP pages and shell scripts that allow me to turn on/off the various switches/sockets!


My next steps are to create a mobile app version of this with more functionality, to enable the dim function on the lights and replicate the mood switches in software.

I also need to build the hardware properly – it’s currently in a breadboard now, with the antenna wire stuck in with blu-tack rather than being soldered in!

I plan to document much of this process here.  The majority of the information is scattered around the internet and freely available, but I plan to document the full process here to pull it all together!

My 434MHz receiver does’t seem to be up to the job either, so I need to invest another few quid into a better one.

To give an idea of cost, the transmitter and receiver together cost less than £3, and an arduino is around £20.  So less than a third of the cost of the wifi link, though admittedly, I’m missing the scheduler UI they have, though CRON does me just fine right now 🙂

Raspberry Pi

As previously posted, I’ve now replaced my ageing NSLU2 with a raspberry pi.


oh my… look at those wires!

Having finally set it all up, and now having a case from ModMyPi, it’s nearly complete.  I’ll be doing a write up of all the set up, much like I did for my NSLU2 Debian installation.  The Pi is already proving a much more powerful beast – heck it’s got much more than 29MB worth of memory!

So much so, that currently my Pi is running:

  • One of either Twonky Special 7 or minidlna (still haven’t decided yet as I’m struggling to get Twonky to work with my Samsung Smart TV whereas minidlna does, but seems unreliable)
  • Apache web server running 3 virtual hosts – one external, one internal, and one for…
  • Subversion
  • My SQL
  • PHP5
  • SSH Server to gain access to my network via the internet (requires a public/private certificate combination but it still doesn’t stop those script kiddies having a go!)
  • Deny Hosts (for the above!)
  • Samba (plus swat for configuration)
  • Tight VNC Server should I need to remote into an X session

On the hardware side – I’ve got the following plugged in:

  • 16GB Micro SD (in adapter)
  • Powered Belkin 4 port USB
  • 280GB Seagate Hard Disk – hosting swap and core OS files not on SD
  • 2TB Data Disk
  • 1.5TB Backup disk
  • 1 * Webcam (still need to get this working!)
  • Connected via HMDI (through DVI converter) into my PC monitor
  • Connected to internet via Ethernet 10/100 through a switch.
  • Optional Keyboard/mouse plugged in for if/when I can’t get in via SSH following a reboot

In the meantime, I think I might go and tidy up all those wires 😉