PC or Embedded Control or Both?

nslu.jpgGiven my background in embedded systems design, I’ve always felt more comfortable with home automation systems based on embedded controllers than those based on PCs. Home Automation doesn’t require huge amounts of processing power and embedded controllers tend to use simpler control programs sometimes giving you more reliability. PCs seemed like overkill and it’ll be a cold day in hell before I rely on Windows to control anything in my house. Of course, there is always Linux, which I trust to run many things more complex than home automation. Many users use Mister House or other custom Linux solutions for their automation. But it still seemed crazy to run a 250W PC 24 hours a day to send X-10 commands or bit bang an RS-485 port.

These days, the concept of a PC has begun to change significantly. VIA’s mini-ITX and nano-ITX platforms have significantly shrunk the size of a full blown PC. You can have a complete Linux based PC running home automation tasks drawing less than 100W. Closer. But the ITX boards are expensive. You’ll spend well over $400 for a case, board, hard drive, and memory. Too expensive for a home automation controller that I still have to write software for!

The advent of ‘disks in a box’ NAS devices and wireless access points that run Linux cores on embedded processors have spawned some vibrant user communities dedicated to expanding their functionality. Users have created custom Linux distributions to run on all sorts of consumer network devices. Linksys has released a number of devices that run Linux and they haven’t discouraged people from experimenting. There are numerous firmware variants for the Linksys WRT54G access points. I use DD-WRT firmware in all of my access points. A $50 piece of hardware can be turned into a powerful multifunction device that does much more than just wireless networking.

A similar effort has evolved around another Linksys device - the NSLU2 Network Storage Link, which is affectionately called the Slug. Originally designed to easily attach USB hard drives to your network, users found they could easily run all sorts of Linux applications on it. Using open source firmware (there are many: SlugOS variants or Unslung to name a few), users use their Slugs for all sorts of things. Running a web server, Perl, sending email - all easily done, on a piece of hardware that will set you back about $75.

Suddenly, a ‘PC based’ home automation setup doesn’t seem like such overkill. At the very least it is interesting. Some Google searching finds some users who use Slugs for X-10 control. Others found that it wasn’t quite powerful enough to run Mister House. But it sure seems like it could do some neat stuff in between.

Just thinking off the top of my head, it seems like you could take a NSLU2, maybe a CM15A or INSTEON USB Smartlinc, and a USB-RS-485 interface and do all SORTS of things. Users have written various Linux drivers for most of these devices. Run the entire setup off a 2GB flash drive or small USB hard drive. You can get multi port USB to RS-485 interfaces so you can easily control incompatible RS-485 devices on their own isolated RS-485 networks. The possibilities are endless.

Neil Cherry has an excellent site dedicated to Linux based Home Automation. Programming in C, Perl, even PHP, or (I’m not kidding) Ruby on Rails. You get very mature libraries and development tools for free. No expensive development kits to buy. Even the Insteon has a Linux driver! Numerous ultra lightweight web servers exist (lighttpd, etc), tiny DB drivers, and more. Suddenly creating a web enabled HA controller for under $100 with a database backend can be done using established tools with tons of libraries available for them. Now we’re talking.

So for someone who swore he’d never do home automation on a PC, even an old used one, the advent of inexpensive embedded Linux computers may change my mind. It sure will be fun to find out! I’ll keep you posted once my Slug arrives and I’ve had some time to play. Obviously if I did this, there would be support for the CC Concepts RS-485 devices!

14 Responses to “PC or Embedded Control or Both?”


  1. 1 Vince Sumoski Feb 12th, 2007 at 10:38 am

    Welcome Back!
    Thank You for the informative article. I wonder if any of these devices use a Z80 based processor? Wouldn’t it be fabulous to have one based on the new eZ80 acclaim ‘91! Guess I’ll have to do some digging in all my ’spare time.’ My HCSII (with your upgrade kit) is still plugging along, but I worry about it’s age.
    Thanks again.
    Vince

  2. 2 CC Concepts Feb 12th, 2007 at 10:49 am

    I haven’t heard of any, but haven’t looked. Many of these devices and up with ARM or MIPS based CPUs because Linux runs on them so they have extensive libraries and development environments available for free.

  3. 3 CC Concepts Feb 22nd, 2007 at 1:35 pm

    I just got two of them setup running the OpenSlug/BE firmware. We’ll see what happens when I try to get lighttpd installed with some PHP :) Could make for an interesting box. Everything will run off a reasonably fast (16MB/s Read) flash drive.

  4. 4 Lou Emmelot Feb 23rd, 2007 at 7:52 am

    Hello,

    This is nice to hear after such a time. I just prepare for HV-pro but I still use HCS-II which is running well…
    Now, This upgrade is it for my system? I have a Z8018010VSC XPRESS version 3.63.
    Can I continue using my actual software?
    I cannot find any information about this upgrade but I’am very intersted.
    Thanks and regards,
    Lou Emmelot.

  5. 5 CC Concepts Feb 23rd, 2007 at 8:26 am

    This post is just talking about some potential new stuff that can be done with off the shelf hardware.

    The HCS-II upgrade information is at:

    http://www.cc-concepts.com/hcsii/cpu-upgrade/

    It will run your existing XPRESS Software - just faster.

  6. 6 Neil Cherry Feb 28th, 2007 at 10:18 am

    I have no problem with using Linux, at the very least it keeps me from writing the beginnings of file systems, databases … you get the idea. It’s already written for me, by people who know this stuff better than I do. But I’m torn between embedded controllers and PC based servers. Maybe the solution is kind of both. If you’re looking for just a small server then the tiny embedded server is an excellent solution. But what if you start integrating other services into your HA system. I’m seeing a big push into the home entertainment side of HA. I now have Asterisk PBX, a UPnP Media Server and other IP services in addition to my Mr. House. At some point that little embedded server isn’t going to hold up. Actually the full size PC/Server is having a little trouble with things like MythTV and HD. It requires a high speed CPU. And if that’s the case then you need both an embedded system and a PC server. Is anyone following my logic? :-)

    I love using Mr. House (MH), Perl is great for quick and dirty scripts. But on tiny embedded systems there just isn’t enough memory to properly support MH. I’ve been thinking of creating an XPRESS interpreter for my embedded system. I’ve got several examples of simple byte code interpreters. That looks like the easy part. The hard part is a standard I/O library so that XPRESS can be used on any OS. I’d also like to see XPRESS extended to support system calls and network nodes over an IP network. Of course it would be nice to also have the time to do this but work and school has really slowed this down.

    For those wondering, I currently have MH, Asterisk, Twonky, DHCP, DNS, Samba, CUPS, sendmail, Slim Server, telnet, SSH, tftpd and ftpd running on my server. It’s also my development box which makes things a little interesting. My emebedded boxes include the NSLU2 running Samba, ftpd, SSH, and Twonky or Media Tomb. My other embedded system is a TS7250 board by Embedded ARM. Of course I have my HCS II and SpectraSense 2000 also. :-)

  7. 7 Fulvio P. Mar 1st, 2007 at 3:45 pm

    Talking about INSTEON PowerLINC V2 USB…
    I’m not sure it is the best choice as a LINUX Home Automation solution. Does anybody know where to get a driver that works 100%. Niel Cherry one is good and somehow works, but code needs to be adapted to new kernels and beside being a a C/C and a USB and a Kernel Module Programming and an INSTEON protocol “black belt” (which I’m not in almost all of the above) it’s a very, very difficult task. Bruce Perens one it’s a proof of concept, as he said: “for the moment it just sits there and dump the X10/INSTEON traffic …”, he claims he will do more but so far … I have seen nothing …

    Any idea ? Should I buy a CM11A serial …

  8. 8 CC Concepts Mar 2nd, 2007 at 9:35 am

    I agree 100% with Neil that any embedded solution won’t be the whole ‘home server’ concept. I’ve always been of the mind that I like my HA stuff to be on it’s own, communicating with other systems, mostly for stability reasons (KISS). I have a hulking server for file streaming, storage, MythTV serving, etc. But I doubt I’d put my HA stuff on it just because it’s more likely to go down than something embedded, though still rare.

    It’s definitely whatever works. My goal for something like this is control and monitoring If the embedded thing ran a web server - it would likely be a simple interface and also support some machine to machine protocols. If I had a need for a snazzy web interface to my house - THAT would run on the hulking server and link to the embedded box. But the box would be stand alone doing it’s thing. Talking with the HA devices out there and controlling things.

    But whatever fits your needs I guess. lighttpd and friends can help make things fairly lightweight in terms of memory usage. We’ll see.

  9. 9 CC Concepts Mar 2nd, 2007 at 9:39 am

    Fulvio,

    I thought the PowerLINC was basically an HID device, meaning it shouldn’t require much of a ‘driver’ to interface to it. Then the protocol work can be done in a application abstraction. That was my understanding about Bruce’s proof of concept. At the very least, using it for X-10 shouldn’t be too hard, but I’ll admit not having looked into it that deeply yet.

  10. 10 Neil Cherry Mar 2nd, 2007 at 12:19 pm

    Mike, it still needs a ‘driver’. The HID just supplies a method for communicating with the device, like a serial port device driver. You still need to know the protocol used by the device to communicate.

    Bruce’s HID interface is the correct way to attack the problem. It doesn’t require that you rebuild the device driver code if you upgrade your kernel. Something that is a real problem with my device drivers.

    Fulvio, I’m not sure what the best solution is at this time. I’m tied up with school (mid-term at the moment) but I need to attack the Linux HA problem too. I’m going to use the HID method (no kernel compiles!) and I’m going to work with the daemon code I have so I will have a quick solution. I’m a little ticked off at Insteon as they’ve raise the price of their dev kit to $200. That’s a pretty expensive solution for the non-Windows folks as that’s the only way you’ll get the dev details.

    Right now I think that UPB *might* be a solution. Mr. House has UPB code in it but I don’t remember if that’s a windows only solution.

  11. 11 CC Concepts Mar 2nd, 2007 at 12:23 pm

    Neil - right. I guess it’s when is meant by a driver and what level of abstraction you require (well and what your definition of a driver is) The point is you have a fairly simple interface to send and rcv commands. The question is, it leaves you some flexibility to implement all or part of the protocol and in a format that works for your app. For example - in the case of X-10 would you implement group X-10 commands are part of the protocol driver or your app? I’d say the former, but others might disagree.

    I guess all I was tryin gto say was that the device took the smart way of representing itself in that it’ll be accessible via HID fairly easily - you still have to do the protocol, etc. But it gives you an easy startin gpoint vs having to worry about the USB internals to even talk to it.

  12. 12 Fulvio P. Mar 2nd, 2007 at 1:47 pm

    Neil - Agree with you about the way to go with the INSTEON device driver. I prefer something I do not have to recompile every time the kernel change and/or something get changed in the kernel. Agree also with the 99.02$ “tax” to pay in order to access the details of the protocol (the other 99.98$ I guess if for the HW you get with the SDK)… in the end with that protocol we’ll be able to talk only to their devices so why to keep it “secret” ?

    My ideal driver would be something I can send a X-10 command, a INSTEON command and if I need send the low level too, maybe using some kind of “prefix” to the command itself, and than having the driver to figure out and do the necessary translation…

    In this way I can concentrate my efforts on the Home Automation itself that requires programming too but at a higher level. I’m still wakening up in the morning wandering if sprinklers stopped ;-) )))))) (btw. this morning they did not … ) cheers Fulvio.

  13. 13 CC Concepts Mar 23rd, 2007 at 7:18 am

    A friend of mine has managed to get OpenPBX built for SlugOS/BE. The packages are in 3.10-beta I believe. I’ve got it running on a turbo NSLU2 with a 2GB flash drive. So far the only thing I’ve noticed is the sequencing of voice mail prompts is a little slow. But otherwise it’s running quite nicely and we haven’t really done much slimming down yet. Buy.com had a major sale on these cool 4GB USB hard drives (they were $20!!!!) Why I didn’t buy 5, I have no idea. But one is on the way. It’ll be interesting to see if that speeds up the loading of the prompt wav files (my current 2GB flash drive is a 13/16Mbps version which is speedy for a flash drive, but hopefully a mini HD will be faster)

    Anyway, it’s been a fun experiment so far. I’ve got 4 shiny new Grandstream GXP-2000’s configured and running, so my Panasonic KX-TD1232 with TVS-100 Voicemail may not be long for this world! Lightning killed 4 of my 6 digital phones anyway and I can buy three Grandstreams for what I paid for one large display Panasonic!

    Like I noted above - I’m not necessarily looking to have everything run on one box - but this is a neat little embedded project - for a box I paid $50 for on eBay :)

  14. 14 wayne | hardwood flooring Mar 22nd, 2008 at 1:23 pm

    I have been thinking about trying the home automated system for my own home but didn’t know anythig about them. Thanks to your blog I now have a place to start looking and what to look for. Thank you.
    www.UpScaleInteriorDesigns.com

Leave a Reply