A geek’s thoughts on various stuff
23 Aug
As promised, here’s the source code for my VAMS-0808 interface. It’s in C#, with C# projects included, and can be opened in Visual C# Express or full Visual Studio 2005 or greater. There are two test projects included - one which just writes status changes out to the console, and a WinForms project (which runs in mono) for full interaction.
14 Jul
Over a year after it began, the whole-house-audio project is complete. 4 rooms around the house can now be filled with the sound of any of (currently) 4 audio devices thanks to a mixture of hardware and software.
The project had a slightly rocky start, with a prototype not functioning at all and partly destroyed amplifier (which was thankfully fixable by replacing a couple of components). A software alternative was considered at one point, to avoid too much expensive hardware. The hardware solution proved to be less complex and more likely to work.
The living room, dining room, kitchen and master bedroom are host to a pair of speakers each, connected to matching 240W rack-mounted amplifiers housed in my home-made full-height 19″ rack cabinet. The cables that carry the audio signals to the speakers were installed along with 24 runs of CAT5 before moving into the house.
The audio is routed to the amplifiers via an 8×8 VAMS-0808 AV matrix switcher, which allows the 8 outputs to take their inputs from any of the 8 available sources. Only 4 of each are currently in use, so there’s plenty of room for expansion.
4 audio sources are connected via simple custom-altered CAT5 cables, which simply transmit line-level signals over the existing twisted pair infrastructure installed in the house. These sources are currently the DAB radio in the kitchen, the TV in the living room, the computer in the dining room (for playing CDs) and a second DAB radio in the master bedroom.
I’ve written the software to control it all using .Net (C# of course), running on mono on linux. There are four components to this:
There is currently just the one controller front-end, located in the dining room. To listen to the kitchen radio, for example, all that is necessary is to select the ‘Kitchen DAB Radio’ option from the main menu, then select which of the 4 rooms to play it through - or all of them if you are going to be wondering around most of the house.
Thanks to building the web interface with iUi, the system is compatible with the iPod Touch and iPhone, so they can instantly act as frontends for audio control. A second fixed controller may be added in the master bedroom in time, if there’s enough money available. Each front-end costs about £200 in hardware, depending on what bargains can be found on eBay.
The matrix switcher supports both audio and video. Only the audio channels are used at the moment, so there is the very real possibility of using the remaining 4 output zones to connect to TVs around the house and adding some AV sources. This way it’s instantly converted into a whole-house-AV system. The video signals can be carried over the twisted pair CAT5 cables like the audio, but will require a little more hardware to preserve quality. This hardware is relatively expensive, although savings can be made by building the equivalents by hand. Following the tradition of this project, that’s probably what I’ll do. I have done it before while I was at university and it works beautifully.
10 Jul
The audio system that I’m building requires 2 low-power computers: 1 for the touchscreen controller (not using an iPod Touch for the moment) and 1 to act as a webserver and serial-console server.
Once again eBay has come to the rescue, and by searching for ‘geode’ - a low-power processor for Thin Clients & Small Form Factor (SFF) PCs - I found the 2 machines that I needed. These are the specs:
magnesium (the black one)
£70 + P&P
potassium (the grey one)
£35 + P&P
Magnesium is used as the client machine, and potassium runs a custom-made webserver and the control software for the VAMS-0808 Matrix Switcher.
Both came pre-installed with Puppy Linux, a lightweight distribution designed for low-power machines such as these. It runs surprisingly quickly, but to make it easier for me to maintain I decided to install Ubuntu.
On such slow computers it took many hours to get Ubuntu installed on magnesium alone. I initially installed to the CF drive that came with the machine. However I found it to be quite slow, so I followed a guide for running Ubuntu via network boot and removed the CF disk. I did the same for potassium. Both booted off of the fileserver, boron.
Unfortunately during installation, I found that the slower of the machines has a tendancy to overheat causing the machine to hang. To get Ubuntu installed I had to remove the case. This has now been rectified by installing a blower to get at least some air circulating. This is the only fan in either of the machines. Magnesium gets quite hot but has never crashed because of it. It also sits in a cooler environment, and is much better engineered.
Sadly I’ve been forced to install Windows XP on magnesium purely because I couldn’t get the touchscreen to work under linux despite spending more than a day trying to. While it was detected, and it detected touches, the calibration was completely off and there was no way to configure it. Rather than waste any more time I decided to switch to Windows and everything has worked beautifuly since then. To accomplish this I’ve had to reinstall the CF disk since as far as I know XP Pro can’t do diskless booting.
Shots of these computers in use and more information on their roles to come soon.
18 Jun

Yesterday I completed and successfully tested the control software for the audio system. The software works with the matrix switcher and the APC MasterSwitch remote control PDU to allow the audio output devices around the house (TV, radio, CD player etc.) to route their sound to any of the 4 audio zones.
I’m now waiting on some more purchases from eBay to arrive before I can finish the system off. On the way is a small touch-screen monitor and a low-power mini ITX computer to connect it to. This will function as the controller and will probably sit in the dining room at the centre of the house. I’ve not gone for an iPod just yet, since a small mobile device has the possibility of getting lost or damaged more readily than a fixed controller. I’m looking out for a cheap 2nd hand one on eBay though.
Although I had got the software working yesterday, I foolishly installed some updates for Ubuntu and now the serial ports have disappeared again. Rather than battle to get the ports to show up and behave I’ve gone a little more eBay crazy and bought a second thin-client-like low power PC which will run the matrix control software and possibly the web server for the front-end control interface.
The other remaining tasks include creating some more cables and positioning and attaching the speakers for zone 4, the master bedroom.
Full details of the setup, with a video, will hopefully be posted in the next few weeks.
12 Jun
Thanks to the chip manufacturer of the cheap serial port card, I’ve managed to get some extra serial ports working. If you can’t figure out how to get additional serial ports working, I recommend this guide [ZIP, 792KB] available from the Moschip driver download page. It should be valid for most models of serial cards, and explains how to add more than the standard 4 ports that most linux installs have.
Now that this problem is out of the way I can continue with writing the remote control software for the audio system.
11 May
Having put the 4 port serial card back into boron, the onboard port now works again, so I’ll probably continue with developing the software. The expansion card still doesn’t work though, so I’ve ordered a cheap 2-port card from eBay in the hope that a different card will work.
Before reinstalling the card I upgraded Ubuntu to see if that would help (it didn’t) which brought its own scary moment of the 1TB RAID volume being dead. That too is solved now - the drive letter assignments had changed.
10 May
Today I started development of the software to control the whole-house audio system. It’s written in C# and based on the MiniHttpd project - a small but powerful implementation of a web server in C#.
However, when it came to testing the first bits of code, I’ve envountered a problem. A while ago I bought a 4 port RS232 serial card to go into boron, because the motherboard only has 1 onboard port which isn’t enough for the UPS, the matrix switcher and probably some other things such as connections to network switches.
The new card shows up fine in lspci, seems to be ok when running setserial -gb, but when trying to send or receive data nothing happens. Thinking it might be a conflict with the onboard port, I went into the BIOS and disabled it. Still nothing. So I swapped the card into another machine and re-enabled the onboard port in boron’s BIOS. Now the onboard port doesn’t work either.
I’m going to contact the manufacturer of the card for some help. But for the onboard port I’m completely stumped. It too shows up in lspci and setserial -gb (though only when running using sudo, which wasn’t necessary before) but any attempts to use the port result in various I/O error messages. I was worried that the new card may have killed the serial communication capabilities of the matrix switcher and the UPS, but I’ve confirmed that at least the matrix switcher still works by connecting it to my test machine, iron.
If anyone thinks they might know what’s getting on, please get in contact via the comments for this post - I would be very greatful for any help.
27 Apr
I’ve set up a few MRTG config files and some simple shell scripts to graph the available data from my Compaq UPS via Nut. This will give a basic way to monitor the combined power consumption of everything that’s connected to the UPS. Currently this is everything in the rack plus the computer under my desk (and the peripherals on top). If you like graphs, you can see them on this site.
In addition to this method, I also have a plug-in power meter that can be used on individual items. It’s currently plugged into the incoming side of the UPS. For whole house power monitoring, the Wattson looks pretty good, but it’s not exactly cheap.
23 Apr
An interface for MythTv on the iPhone (and presumably the iPod Touch too) has been developed by Chris Carey. It looks pretty darn cool. This saves me from having to write my own as part of the iPod Touch remote control project that’s planned. [Via Automated Home]
6 Apr
Several months ago I posted some information on the cable to connect a Compaq T2400h to a standard serial port. This weekend I finally got around to trying out the information that I found. I now have the 2.4KVA UPS at the bottom of my rack cabinet talking to my Ubuntu-based fileserver, boron.
The first step was to create the cable. This requires a 9 pin female ‘D’ connector and a matching male connector. For the cable I used an offcut of CAT5, though normally serial cables do not use twisted pair (usually just parallel wires).
The software part is done using NUT, for which there is a package included in the Ubuntu distribution. This software talks to the UPS, monitors it’s status and allows other computers to check the status. The monitoring applications are then responsible for shutting down the computers attached to the UPS should power fail and the battery become critical. So far this is just boron and my Windows machine, aluminium. The latter uses WinNUT to shut down Windows when needed.
There were a few problems getting NUT to work with Ubuntu. First off, the package doesnt put any configuration files in the /etc/nut path, so I had to go hunt for the examples and copy then modify them. The next problem was with permissions for the serial port. For testing purposes I tried running the protocol module as root, but this introduced different permissions problems. The solution was to add the ‘nut’ user to the ‘dialout’ group, which is one group that has access to the serial ports. To my relief this got everything working.
These are the parameters that I can access over the serial connection:
simon@boron:~$ upsc compaq@boron
battery.charge: 97.22
battery.runtime: 1620.000
battery.voltage: 0055.50
battery.voltage.nominal: 0048.00
driver.name: upscode2
driver.parameter.input_timeout: 5
driver.parameter.manufacturer: Compaq
driver.parameter.port: /dev/ttyS0
driver.parameter.use_pre_lf: yes
driver.version: 2.0.5
driver.version.internal: 0.84
input.voltage: 0244.50
input.voltage.maximum: 0276.00
input.voltage.minimim: 0162.00
input.voltage.nominal: 0230.00
output.current: 0001.95
output.frequency: 0050.00
output.voltage: 0215.10
ups.alarm:
ups.delay.reboot: 000
ups.delay.shutdown: 000
ups.load: 21.875
ups.mfr: Compaq
ups.model: UPS 2400 VA FW -0023
ups.power.nominal: 2300.000
ups.serial: E########
ups.status: OL TRIM
These are the resources that I used to get the UPS/NUT combo working: