Got a cool tech project you're working on at home? Tell us about it here.
Saturday 10 May 2008, 8:38 PM
Hitch with the audio system
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.
Saturday 10 May 2008, 8:37 PM
Successful test of audio over CAT5
I have just successfuly tested transmission of near-line-level audio over the cat5 cables I’ve recently finished installing.
The amplifiers and matrix switcher have been installed for a while, but until now I’ve not performed any tests of sending audio from one part of the house to the matrix switcher, through the appropriate amplifier and out of the installed speakers.
I bought some 2m green cat5 cables off of ebay, but rather than use them as normally intended I cut one of them into two equal lengths.
After removing a length of the outer insulation at the cut ends, I attached 2 phono plugs to one length and a stereo 3.5mm jack to the other (with a little help from wikipedia for the correct pinout of the latter).
A multimeter was used to verify that there weren’t any shorts - wire-wrapping the connections was a little fiddly - before I plugged the cables in for testing.
The length with the phono plugs was connected to the matrix switcher and the RJ45 patch panel, and the other length was attached to the headphone output of a DAB radio in the kitchen and one of the 2 ports in that room.
The successful test is promising for the completion of this project. I have ordered and bid on 2 more sets of speakers for the dining room and kitchen, and the final amplifier will be ordered soon.
The software needs to be written to control the system, but I could probably do most of that in a weekend. A little more hardware in the form of a touchscreen capable low-power computer and an iPod Touch will be required to run the web-based front-end for the software. Then the system should be complete.
Look out for a video demo of the system once I’m happy with it!
Tuesday 6 May 2008, 9:28 PM
Completing the data wiring
Today I added the final 4 network points - there are now a total of 24 around the house.
The wiring project started about 14 months ago, with the plan to have at least 2 network points in all rooms except the bathroom. The final distribution has ended up as:
Living room: 6
Dining room: 4
Kitchen: 2
Pantry: 4
Landing: 2
Bedroom 1: 4
Bedroom 3: 2
Despite considering that 24 ports might be a little excessive, I’ve come to realise that 24 ports isn’t quite enough especially when it comes to distributing analogue audio & video over CAT5 (i.e. not as IP data) since at least one port is required for each A/V combination depending on the quality of the signal desired. The living room should probably have 4 more ports, the kitchen could do with at least 2 more and a couple by the front door would come in useful for security purposes.
I’ve learnt a lot from the experience of doing this wiring, such as how to lift floorboards, that lathe & plaster ceilings are extremely fragile and plastering is nowhere near as easy as it looks.
Running the cables before moving in was certainly a good idea. It would have taken me probably another 12 months otherwise to get to this stage. It’s taken a lot more work than I expected, although the overall time is down to being in a lazy, bored and/or apathetic mood most weekends. I’m glad I did it though - the ports have come in useful for the MythTV system, for the family computer and soon enough the whole-house audio system. I’m also using them to trial some IP video cameras.
Wednesday 23 April 2008, 12:55 AM
PHP5 - MIME type quirks
It has been a while since I did any web development, and I recently decided to get back into PHP development. After downloading the latest version of PHP for my IIS server I proceeded to do some tinkering just to get back into the feel of the language. Just for grins I decided to figure out how to send a directory listing to the browser, adding links for any image files that were found so that the user could click on them and display the image in their browser. Simple, right? Well apparently not. I must have spent about 4 hours last night on Google trying to find out why the MIME typing was not working correctly, nor the various PHP extension libraries being loaded properly. I finally managed to figure it out this afternoon:
PHP comes with two extension modules for determining the MIME type of a file: Fileinfo and Mimetype. Both require a mime.magic file that stores the MIME type definitions, but they access it in two different ways. Fileinfo requires that the path to the magic file be passed to the finfo_open function. Mimetype, on the other hand, uses a setting in the php.ini file that identifies the magic file.
Now the only reason why I mention anything about this topic is that judging from the plethora of Google hits I came across while trying to solve my dilemma I realized that this is not well-documented anywhere, not even in the PHP documentation. So here is a concise explanation:
The MIME magic files
If you go to the GnuWin32 project page on SourceForge you can download the MIME magic files and unzip the archive to your PHP installation folder.
mkdir C:\PHP\magic
... unzip the MIME files into C:\PHP\magic
should now contain:
magic
magic.mgc
magic.mime
magic.mime.mgc
Using Fileinfo
In your php.ini file, make sure that the DLL gets loaded automatically by PHP:
... add to the end of the file where other extensions are loaded
extension=php_fileinfo.dll
Now within your PHP file you can do the following:
$finfo = finfo_open( FILEINFO_MIME, "C:/PHP/magic/magic" );
$mimeType = finfo_file( $finfo, "C:/PHP/php.gif" );
finfo_close( $finfo );
echo $finfo;
.... should display image/gif
Using Mimetype
First, make sure that the extension is loaded and that it knows where the magic file is located.
mime_magic.magicfile="C:/PHP/magic/magic.mime"
extension=php_mime_magic.dll
Now in your PHP page you can do this:
echo mime_content_type("C:/PHP/php.gif");
... again, image/gif
That's all there is to it. Now, a couple of things to mention ... the Mimetype extension is marked as deprecated with the Fileinfo extension being the preferred method for determining file MIME type. I'm not sure why this is the case, as for me it makes more sense to have the MIME magic files be a system-wide setting, but according to the PHP extensions documentation Fileinfo is the way to go. The other thing to note is that Fileinfo uses the C:/PHP/magic/magic file whereas Mimetype uses C:/PHP/magic/magic.mime. It is very important to get these right. If you switch them up it will not work. I tried this to make sure that that is the case and was unable to get the MIME type.
For anyone out there who does regular PHP development, you all probably knew most of this already. For all those who are new to PHP or re-learning it like me, I hope this helps clarify and resolve any problems you have encountered with this set of extensions.
Monday 21 April 2008, 6:21 PM
Replacing the SS4000-E: Part I
Well as I mentioned in my earlier post I am trying to find a way to replace my SS4000-E as our production file server. To that end I have begun to build a Linux From Scratch server, upon which I plan on adding just the necessities to have a working file server in our Windows LAN. I was hoping to have a new system to work with that was complete with SATA RAID, a gigabit NIC, lots of RAM, etc, but I decided to work off of one of my old PCs first as a practice run and work out all the snags before building the final production box.
In the course of this past weekend I was able to build the basic LFS system and have already added some security software, as well as some simple utilities, but that has been about it thus far. (I figured it was time to get some sleep after 4am this morning) If all goes well I should have the rest of the pieces put together by the end of the week, and come next Monday I will be able to throw it to the wolves and have our microfilm scanners try and beat it up for a few days. I will be surprised if the performance does not meet my expectations, even for a setup that is by far scaled down as compared to the final system I plan to use.
Just for those who are not familiar with LFS, I suggest you take a look at the Linux From Scratch website. The project is lead by Gerard Beekmans, and he and his group of developers have done an excellent job of outlining the entire process of creating a Linux system completely from source code. It is not a quick process, but it really is not all that difficult either once you have read through the LFS documentation. This is the third or fourth system that I have built using their procedures and the others had served well for a long time. It just takes patience and a decent knowledge of Linux.
The other tool which I suggest all systems administrators take a look at is Knoppix. This is a Linux distribution that runs entirely off of CDR and makes a great recovery tool, even for Windows-based PCs. In building my LFS box I used this as my base Linux system, allowing me to run off of CDR while I built directly onto my hard drive.
Once the final system is in place I'll post back a list of the software installed so that anyone else who is interested in building one of their own can replicate the procedure. Also, I invite comments on which software choices should / should not be included and why. I am curious to see what other admins use on a regular basis in administering their servers, and any tips / tweaks that they have found.
Tuesday 15 April 2008, 6:57 AM
Intel's SS4000-E - so you're having issues with one too, eh ...
About six weeks ago we realized that we needed more production storage space and decided to look into a NAS solution instead of a traditional server. After doing some searching I came across a neat-looking little black box made by Intel, their SS4000-E. I read through the specs and called up TigerDirect to get some of my questions/concerns answered, the primary question being "will it handle the throughput we require each day?" We are a document conversion business that digitizes paper and microfilm/microfiche, and on any given day we may scan well over 500K images, each at around 65K as the average file size. Needless to say, we planned on beating the devil out of this storage box. At any rate, TigerDirect told me that yes, the system will be able to handle the throughput without any problems. Ok, that's great. So we ordered one ......
Well, I wish I had found some of the postings I have read since then describing the "shortcomings" of the system. I realized, much to my chagrin as CTO and resident tech guru, that my purchase was not all it was sold to be. Part of our processes involves building multi-image TIFF files, and some of these files can be upwards of 15-25MB in size. I realized immediately that something was awry when I tried processing out to the box; the system came to a screeching crawl. Come to find out later that part of the issue was with the drives that we received with the unit. For those who don't know, it comes with a set of SATA-300 drives. On the back of these drives (something I had not thought to check as I have only used EIDE drives to this point) there is a jumper that limits the throughput of the drive to 1.5Gbps instead of allowing the full 3.0Gbps data transfer rate. This apparently was installed for those cases were the motherboard did not support the 3.0Gbps rate. What made no sense to me is that this system states that it does support the faster transfer rate, so why put the jumper on there?
So ... off came the jumpers. Ok, the transfer rate sped the system up from a crawl to a slow walk. Obviously something else is still wrong. Being the Linux "guru" I decided to try and access the system directly via SSH and see what was going on. One would figure that the box, being a Linux-based system, would have a SSH daemon running, right? Nope. Oh, and don't waste your time looking for a way to turn it on in the web configuration interface. I had to do some Google searching to turn up the solution to this one. There is an undocumented CGI script that gives you the ability to turn the SSH daemon on, but you have to put it into your address bar yourself. None of the other CGI pages will take you there.
Ok, now I have my SSH access ... great. I get in there and find out that (a) you're stuck with XFS as the file system on your NAS shares and (b) apparently no one thought that turning on the noatime mount option was a good idea. The mounts are not listed in the fstab, either. There is a conf file that you have to hunt for, add the noatime option, then reboot the box. After all that, it now is no longer at a slow walk, but rather a light jog. (sigh)
If there is anyone out there that can enlighten me on how to speed up the XFS file system, I would appreciate the advice. I have worked with reiserfs in the past and had much better results. Unfortunately the box does not come with reiserfs installed (although according to the conf files it is supported), and even if it were there is no way that I have found to tell the box to make a new share using anything other than XFS.
The only consolation I have found is that there are a number of others out there who also have similar problems with their systems. I even saw an article earlier that discussed a way to install a Debian distro onto the box, but the steps required seem daunting at best. One would figure that Intel would put out a better product than this, but I also have found out that it was not their product in the first place; they bought it from some other manufacturer and have basically no way to support the internal workings of the system.
So, what to do with it? It does make a good storage solution, meaning as long as you write the data once and do not require any substantial processing to be done to that data once it is there, it will work well. It is stable and will run probably for months at a time, if not longer, between shutdowns for maintenance. It just is not designed to handle massive amounts of reading and writing all at one time. At this point, that will be its ultimate mission in our shop, but it sill leaves us with the problem of not having enough production workspace.
To that end, I have decided to take a more traditional approach and install a Linux-based file server. As cost is an issue, I have been pricing out some bare-bones solutions upon which I can build. Also, I have decided to build a Linux From Scratch OS onto the box, instead of installing a heavy distro. I like Mandriva and Ubuntu, but I really do not want to have all that extra software and package management to deal with. I was able to work out a list of applications/libraries that I will need, cutting out all of the fat and trimming the system down as much as possible. Once I have gotten everything successfully installed I will post my results and any performance issues/benefits that I encounter. If all goes well, I should have a solution for anyone else out there who bought one of these storage boxes and is looking for a higher-performance solution.
Sunday 13 April 2008, 4:42 PM
The idea, creating the webpage and posting to Google
Step Number 1: Yes the big step that involved me getting off the couch (only to pick my laptop up) and start thinking about making some money online. I as many of you have a full time job so I cannot afford to pack things, pop to the post office, arrange deliveries etc so my thoughts right now are to think about making some dough through pay-per-click advertising.
The thing with this type of advertising is that I need to get potential traffic to my site, so I decided to create a subject that is very popular - mobile phones.
There are good and bad things about this, the good is that you have a lot of potential customers, the bad is that it is a very competitive market, but I have to try this to see if its possible, and in turn you will also see!
So I thought if I create a mobile review page and add some adsense advertising at the top, potential customers who may read my site and click on the associated adverts.
Ok, page created, adverts created thanks to google adsense, take a look, let me know your thoughts: http://mobilephonereview.bravehost.com (Click on the ads as well if you think they are targeted correctly). Right now I'm ready to submit my site to google. This is going to be hard me thinks.
The first step of posting is optimisation, this is all new to me remeber so after reading a few websites and other blogs I think I have the basics, i.e. return links to other mobile websites, meta tags keywords etc, pictures labelled correctly. Let me know your thoughts on this.
The second step is to visit google add url page and suggest my site. Right, done, lets give it a week and see what happens...
This blog will be updated once I'm on google, feel free however to let me know your advice, thoughts or own experiences.
Regards,
Nicholas King
Tuesday 18 March 2008, 8:33 PM
Trunking and tray
I’ve finally managed to find somewhere to buy stuff to tidy up some of the cabling around the house. A couple of weeks ago I ordered some trunking and a cable tray (which will replace the improvised MDF/timber one I constructed from offcuts) from Minitran.
Unfortunately the first of two packages arrived late on a friday with only the larger items present - it appeared that the bubblewrap packaging (with no strong outer container) had disintegrated and spilled the smaller items somewhere along the delivery chain. The delivery company were mostly to blame for this, with the delivery driver not having the best attitude and the delivery not even being recorded on the paperwork which is probably why it was the last item to be delivered. The items should have been packed in something stronger but I guess such packaging is hard to come by for 3m x 30cm x 5cm consignments. I was also worried by the fact that my card payment had been manually entered into a PDQ machine, wihch suggests that my card number - submitted via the website - is being stored in plaintext somewhere. These days I would expect all online stores that accept card payments to do so via automated secured systems. Clearly this isn’t the case.
Anyway, I continued with installing what I had - the cable tray, a 3m length of 50×50mm trunking, and 2x 3m lengths of 25×38mm trunking.
The 50mm square trunking was used to tidy up the majority of cables that come through from downstairs. This required being fixed to the wall by screws, which wasnt too difficult. I used a hand mitre saw to make the 90 degree bends. I could have purchased corner joints, but they are over £7 each and would have gotten lost anyway. The mitre saw did a great job and the result looks neat.
After I had got the first lot of trunking installed I set to work on the cable tray. The tray is made from a steel wire mesh which is lighter than standard cable tray, looks fairly good and lets light through. The problem was, though, that I had to figure out how to securely mount it without using the steel rods and support brackets that had gone missing. I settled on doing what I had done with the improvised cable tray and used the picture rail to my advantage.
The tray had to be cut to size, about 50cm shorter than the 3m length. With the help of a dremmel this wasnt too hard. I initally left some spare length so that I could bend the wires around and then use them to fix the tray to the picture rail with screws. This didn’t quite work as I had hoped though. To bend the extra length I had to cut part-way through the wires and carefully bend them. I then intended to solder the bends to strengthen them up a little. This plan didn’t work, and I ended up removing the bent parts altogether.
Thanks to the tray being relatively light and strong it turned out that there was no need to fix it to the walls. Just resting on the picture rail keeps it secure enough.
The smaller trunking contains the cables from the other side of the house - from the pantry, bedroom 3 and the landing. This was self-adhesive so was a lot quicker to fit. The cables only just fitted inside though.
Once all of the trunking was installed, I re-ran all of the cables to the cabinet, tidying them as much as I could along the way. This involved lots of cable ties, spiral wrap and patience. As part of this, the remaining network cables were run to the cabinet and connected up to the patch panel. Unfortunatley the back of the patch panel is an unavoidable mess. At one point I thought of disconnecting, trimming and reconnecting the cables that were already connected but this proved far too difficult so I just tried to keep things as tidy as possible.
After clearing up the cables inside the cabinet, things look a lot neater in there (if you ignore the back of the patch panel). This makes it a lot easier to work around the back and portrays a more professional appearance.
Tuesday 18 March 2008, 8:31 PM
New amplifiers
Last month, as per my schedule of purchases, I bought 2 more amplifiers. These will serve zones 2 (dining room) and 4 (master bedroom). I ordered them from the same place as the first, despite having a rather unpleasant experience with the trader on eBay thanks to their appauling checkout/payment system and problems with their UK bank account (they are based in Germany).
The first amplifier, for zone 1 (living room), is silver. I was a bit surprised to find that the 2 that I received were in black. I was hoping to get my rack looking tidy by keeping the same look throughout the cabinet. Black goes better with this scheme, but the silver one stands out now. To balance it out I’m hoping to get a silver one next. A note of appology was included with the amps, which includes a 5 euro discount on the next order. I probably won’t be getting the next amp for a while, to keep my budget under control having spent quite a bit on the matrix switcher.
Tuesday 18 March 2008, 8:29 PM
The VAMS-0808 matrix switcher and determining its protocol - part 2
As I mentioned last month, I bid on and won an 8×8 AV matrix switcher on eBay. The switcher arrived the Monday following the Saturday that I won it (speediest delivery ever!), so I took it home and plugged it all in.
I rummaged around for a serial cable to connect the switcher to boron, the Ubuntu file server and found something that I thought would do the job. Sadly the switcher has a male connector, whereas for a standard serial cable it should be a male connection on each end. So, slightly disappointed, I went ahead and ordered a M-F serial extension from eBay, assuming that this would do the job. This attempt also failed - the matrix switcher would not respond to any of the commands that I thought it should, and nothing was being returned either. After a bit more research in the little documentation that I had I noticed that the switcher requires a cross-over cable AKA a null modem cable.
The next cable I ordered was a M-M cable, so I got an M-F converter at the same time. Success! I now have the ability to control the matrix switcher via the RS232 on boron.
The following weekend I set about writing a prototype of the software to communicate with the switcher. The switcher operates in such a way that state is important, since switching channels requires at least 2 commands and at any time someone can press a button on the front panel to issue any command.
When a button is pressed on the front, a message is sent via the serial port to indicate the action that has taken place. Similarly, when an instruction is sent to the unit over the serial connection a reply is received indicating whether that command succeeded or not. Sometimes the switcher doesn’t notice that it’s been sent an instruction, so to get around that I ended up sending the same message up to 3 times.
The resulting prototype works quite well. I may release the source code at some point.
There’s a video demonstrating the software and the switcher.






