mark :: blog :: ha

<< prev [ 1 | 2 ]

Earlier this year I finally got around to buying a replacement TV, and settled on a Hitachi PD7200 plasma. First thing I noticed was a port on the back labelled 'service use only' which sounded like a fun challenge.

service use only

Turns out that on the Hitachi PD7200 plasma this is a serial port that is enabled by default, so you just need to know the right protocol and you can talk to the plasma. I don't have a PC close to the plasma, but last year I did buy some Lantronix MSS100 devices which have a 10/100 ethernet connection at one end, and a serial RS232 port at the other. I was't quite sure what I'd use them for, but for under 50 pounds each they seemed like a bargain at the time.

serial to parallel converter

Hitachi technical support replied to my query within hours and sent me a couple of PDF documents outlining the protocol, so this was going to be much easier than guesswork.

Knowing the filename, google found this online version, Hitachi control protocol, pdf

A small amount of perl later, and I had script that could query the TV to find out various things (settings, channel, and interestingly the number of hours the TV has been on since it started life). The script can also get the TV to do various things like turn itself on and off and select channels.

Download Hitachi Plasma control (perl, 2k)

So now I have to think of a use for this. I guess I could get the TV to change channels when some event occurs (like one of the motion sensors triggering) or perhaps daily grab the TV panel lifetime to see how many hours of TV we watch a day (and perhaps what channels). Perhaps I could automatically dim the lights and select cinema mode if the channel is changed to DVD (although I could do that just using a programmable remote). I'm sure I'll think of a use for this eventually, but it was a fun diversion for a cold and wet Scottish weekend.

We didn't think much about lighting when our house was being built, so it ended up being fitted out by the builder just like every other new home with standard white plate light switches. The lights themselves however were all the recessed R50 spotlight types. We went through a variety of different ideas for lighting control before settling on using "Intelliswitch" switches for the majority of the house.

When thinking about home automation most people assume that this includes having all your lighting under direct control of some computer system. You can then control everything from a central point, do cunning scene lighting, and magically turn on and off lights during the day. Since our house was already wired up and we didn't fancy rewiring to install any of the number of lighting solutions available this left us with a difficult problem.

X10 lighting

X10 devices are commonly used to control things like lighting and lamps because they don't require any rewriting. You can simply use plug adaptors or light switch replacements and the devices communicate over the power lines. So our first experiment was using X10 for lighting control.

LW10 UK light switch

The switch most commonly used for this is the LW10 which can turn lights on and off, dim them, and be controlled by the X10 protocol from other things. We didn't much like the look of the LW10; it's chunky, sticks out of the wall, and according to folks on various X10 forums constantly blows fuses. Perhaps the biggest problem with the LW10 is that you can't remotely tell it to go to a discrete dim level. You can't say "Dim to 50% brightness", only "Dim by X steps". Since we wanted to do scene lighting this was far from ideal. Also in the UK these things are quite expensive; you don't get much change out of UKP30 per unit.

On the continent the X10 light switches are much better, having the ability to dim to a discrete level and looking a lot more classy. They do need to have a neutral wire at each switch socket to function though, which is not common in the UK. Fortunately when our house was built the electricial wired a neutral to every socket. We think this was to save having to use connectors inside the ceiling as spotlights were being used, but we'll probably never know for sure. Anyway this was good news for us:

LW11 German light switch

So we bought one from Laser and put it in the living room, controlling 10 25W R50 spotlight bulbs. We can't fault the function of this switch, it works reliably and we can set the level remotely, or using a remote control with a IR X10 receiver in the same room. However these things are designed to be fitted to continental backboxes and it never really looked in place. See a picture of the lw11 in the living room. We couldn't put the right switch rocker in because the switch is slightly twisted and it just constantly catches on the edges stopping it from working reliably. Also these switches are a bit more expensive than the UK LW10.

Just dim it

Another problem we had in the house was over-voltage which dramatically cut the life of the expensive spotlight bulbs. Actually the only place where the life of the bulbs was not affected was in the en-suite bathrooms which we had fitted with touch switches we'd bought from somewhere like Argos. These touch switches were white, had a LED in the centre, and allowed you to turn lights on and off (and critically for the ensuite allowed the lights to turn themselves off after some number of minutes). These switches also had a soft start which we figured was mostly responsible for the increased lamp life.

Touch switches in the ensuites

So we decided that dimmers were the solution for rooms where we didn't need automatic control of lighting. The big blocky white switches from Argos were not really approriate for the look of the house. We looked around and found some amazingly nice looking dimmers that also were able to be controlled by infrared. We bought a few of these from TLC and installed them in the kitchen and bedrooms.

Cute IR touchswitches

Unfortunately it wasn't long before the first switch stopped working with a burning smell from inside it. A month or so later the second switch stopped working in an identical way. We gave up and sent the switches back, perhaps they didn't like the high voltage in the house, they certainly were not overloaded.

So by now we'd figured out that we didn't really need to be able to control every light in the house and in fact just the main living room lights made sense to control and dim for watching movies and so on. We also figured out that we really needed to use dimmers with a soft-start function to help prolong the life of the bulbs.

Back to where we started

I don't know how we found it, but the touch switches we had installed in the ensuite bathrooms were made by a company called "Touch'n'glo" in the UK. Hunting around google we found a web site for them, selling a range of "Intelliswitch" dimmers. The basic dimmer allowed you to touch the light switch to turn the light on and off and hold it down to dim. They were available in some lovely brushed metal finishes, had switchable colour covers to blend into the decor of the rooms, were not too expensive, and just looked perfect.

We chatted to their sales director and found out that the switches were designed and built in the UK and that they would soon also be available with slaves (for two or three way lighting like on our landings) and as multiple gang switches where you want to control more than one light from the same place. Perfect! We promised to write up a review of the switches and ordered about 10 of them with a slimline brushed stainless steel plate.

Brushed slimline stainless steel dimmers

Mini review: Intelliswitch dimmers

The web site does a good job of explaining how these work and it's really as simple as it looks - replacing all ten of the light switches took only an hour or two and it took us longer to decide what colour inserts to use in each switch I think. The only difficulty during installation is making sure that you have the load and supply leads correct - the way our switches had been installed it was impossible to tell from inspection and we had to rely on a voltage meter (and careful fingers!).

We've been using them now for around nine months without a single incident, including dimming of some mains halogen GU10 fittings. The switches just work, look great, and visitors always admire them. Some of the switches have a slight humming noise when they are on which you can hear when very close to the switches, but that is something you'd find with any dimmer working in the same way.

So what are the downsides? to me the only real downside is that they're not computer or even infrared controllable. The geek in me wants to be able to control them remotely. If these things were X10 compatible those horrible white expensive X10 switches would be left on the shelves forever. You can now get RF switches that don't require rewiring that give you computer control, but they can cost five to ten times the price, per switch, so it's not very economical. These intelliswitches are around the same price as you'd buy a standard metal wall switch from some large DIY chain.

Okay, there is one more downside that I wasn't expecting. I was waiting for the Intelliswitch folks to release their 2-gang and slave versions of the switch so I could finish converting all the switches in the house. At the moment you walk in and see a hallway with two nice brushed stainless steel switches, and one horrible white place hall light switch. About half the switches in the house need the 2-gang or slave versions. Originally I was expecting these to be available in Spring 2004, but we're not into October and they are not available. Intelliswitch didn't reply to my mails, or phone calls with expected dates, and their web site has been broken now for a number of months. Companies house still shows Touch'n'glo as as existing. I do hope the company underneath is okay, these switches simply rock.

Intelliswitch in the office

I've just realised that I never finish anything that I do in my spare time. I tend to keep getting distracted by new and exciting projects so everything sits about 80% complete:

Spare time over the last few weeks has been a bit limited what with the OpenSSH and Sendmail issues, and I guess I need to finish off my talk for ApacheCon.

Protocol: Jabber

I toyed with several ways of dealing with the home automation system. Misterhouse looked very impressive and was written in Perl so easy to extend, but it also liked to take control directly itself of any hardware. I wanted each bit of home automation hardware to have its own intelligence, it's own bot, allowing the hardware to exist on separate machines and architectures. So I started out writing bits of custom perl for each of the bits of hardware (with some C for things like serial interfacing which was hard for me to get to work perfectly with Perl). I then heard about the XAP project which looked quite interesting but seemed to have a number of weaknesses - it mostly relied on udp broadcast packets for the components to talk together (I wanted components on different network segments, some on wireless, some on links I share with video traffic - udp broadcast packets just are not reliable enough), the other problem was that the components already written were under a license that prohibited commercial use at all. Not that I intend to sell this, but if I'm going to work on software I want that sofware under a BSD-style license or failing that GPL. So my requirements were to have a lightweight messaging system ideally using XML that could run over a security layer (for the wireless network) that I could extend and easily write a custom client for. The answer of course was Jabber. With the Net::Jabber module I can easily write bots and clients in Perl for speed, and with the Perl Tk interface writing user interfaces takes no time at all and they work across platform: Linux or even Windows.

The nice thing about Jabber is that clients for Jabber exist for just about every platform. It's simply to take the source code for a Jabber client and add some buttons and things to make it control any aspect of the home automation system. And if no source exists you can simply chat to the lighting bot and tell it "lights living 18". The plan is to be able to control this all from a wireless PDA too.

Controller: Fujitsu Point

The big test; would Perl and Tk and a Net::Jabber client run okay on a AMD 100MHz processor running in 800x600 256 colour mode? The startup time is about a minute, but then once it's done it happily refreshes the screen with no real visible delays and sends and receives (and parses) messages without a hitch. Here are some pics from the initial interface written over Christmas vacation 2002.

Figure 1: Lighting interface (a Jabber x10 bot)

Figure 2: TiVo interface (a Jabber TiVo bot communicating with a custom tivoweb module that returns XML status information)

Figure 3: Heating interface (a Jabber to one-wire bot that talks to the one-wire temperature sensors, logs data using rrdtool, and talks to the one-wire heating switch)

Figure 4: Misc stuff interface (the DSL bot talking to the cable modem and the UPS bot talking to the UPS device. Alerts also come in here)

Figure 5: Caller ID interface (a Meteor caller id bot with pop-up pics for most of the people we know)

Figure 6: Interface to front door camera (rear only goes into the MV1000 so far)

Each hardware component has it's own bot that can be queried for status and can also be made to broadcast status information either when something changes or every minute. The client simply parses every message it receives and displays it in the right place. Software will be here soon.

I wanted to be able to mount the Fujitsu Point 510 on the wall. I looked for the official cradle but many months went by without one appearing on ebay. A couple of sites show how they mounted their Fujitsu Point into the wall, but I wanted to be able to lift it off and use it as a tablet from time to time too.

Inspiration hit when looking at the back of the Fujitsu and finding a large number of circular sticky covers - covering really nice screw points. So a couple of drywall fixings into the wall and custom brackets later and here is the result. The custom brackets were made from spare PC expansion card slot covers, nice and thin but quite strong)


NetworkLightingHeatingAVThe rest

Plans (as time and money permits)

My paper on "Security Response and Vendor Accountability for Open Source Software" was accepted for Linux World 2003 in San Francisco and I'm giving a similar talk at Linux for Business in London on the 10th June. The role of the open source vendor is often neglected when folks talk about the security of open source software.

House modifications are coming along well, with updates to the Home Automation security software (a few suprises for any intruder), and some large black marble balls on a rockery out the front. Tracy has been spending a few days pressure-washing the driveway which is fun apart from the occasional lump of sand that gets blasted at random parts of your body. Sand in your nose is quite annoying.

Back to work on Monday, but this holiday I've managed to avoid getting into doing real work by playing with the home automation system. I've now finished the conversion of all the components to Jabber bots, written a control client, and got all the one-wire Dallas switches and sensors up and running. some screenshots are available

A hope Google extends the shopping idea to the UK; I've wasted too many days this holiday looking for stuff for the house - just trying to find the right table for our kitchen took two days - I just want to search for a round glass 90-110cm table plus four chairs for under 400 pounds and click on 'buy me'.

So I've been spending some time trying to work out what to do with the home automation components - they're a mess of C and Perl that have no real way of communicating with each other. I found this thing called xAP which is designed for home automation components to talk to each other, but it's based mainly on UDP broadcast datagrams - not something I'd trust to make sure things happened when my alarm was triggered. Plus some of the components already written are under a non-GPL, non-BSD license that prohibits commercial use, yuk.

Anyway the idea was to look for something that would use standard components, where frameworks existed in Perl and C for me to write simple code, and to work on the principle of messaging - the UPS for example would respond to status requests and give you things like the temperature and voltage; with a heartbeat notification with the status included every minute; but with urgent alarms to anyone who registers an interest in getting them. Whats the solution? Jabber! In about an hour I had a jabber server running and a test Perl client doing just that; this thing will rock :)

Several hours later and I manage to find out the extended commands for the LW11G dimmer unit. Can't find these anywhere else mentioned on the web, so for future generations:

# Extended X10 control of LW11G dimmer
# Unlike other L*11* modules the LW11G
# seems to only respond to code 53.  Set the data to
# 0 = immediate off
# 255 = immediate on
# 1-254 = slowly dim or bright to that level, turns on if
not already

<< prev [ 1 | 2 ]

Hi! I'm Mark Cox. This blog gives my thoughts and opinions on my security work, open source, fedora, home automation, and other topics.