How To

Install the Latest Version of LCD4LINUX on Ubuntu

Update: It seems that I need to add some additional steps when installing on a completely vanilla version of Ubuntu. So I have added all the steps that should now be required.

Despite the most recent version (0.11.0) of lcd4linux being released in November 2009, Ubuntu Lucid comes with an older version and thus misses out on some new features and drivers, in particular drivers for the cool and cheap Pertelian X2040.

It is however, possible to build the latest version of lcd4linux from source, but you need to do a few things in order to get it to work.

This little guide assumes you have built stuff before on Ubuntu, so have all the necessary build tools.

First, navigate to the folder you want to download and build the source in.

Then, download the latest version via svn:

svn co https://ssl.bulix.org/svn/lcd4linux/trunk lcd4linux

Next, navigate into the newly created source folder using cd lcd4linux and install some dependencies:

sudo apt-get install automake autoconf m4 perl libtool gettext

Then, run ./configure, if you want to include a specific driver, for instance for Pertelian, include it here, like this:
./configure --with-drivers=Pertelian
Now, if you try to make, it wont work, I am not sure why, but there are some issues. To fix these, issue the two following commands:
mkdir m4
sudo ln -sf /usr/share/libtool/config/ltmain.sh .
Now, you can run:
make
sudo make install
And you now have a working and up-to-date lcd4linux. I’d recommend using checkinstall rather than make install, because you can uninstall the package at a later date if you want.

Doing all this allows me to run my Pertelan display on my little thin client that I use as a baby monitor. It now tells me the PIDs of FFmpeg and motion (so that I know that they are working and running), that the Internet connection is UP and the system load, alongside the date and time!

Thursday, August 12th, 2010 How To, Linux No Comments

Make Your Own Baby Night Vision Video Monitor…Again

So, a while back, I posted about how to hack your own baby monitor. However, it was all fairly easy and didn’t require that much geekery. This time, however, I have gone all out and have produced what I think is a neat little set-up.

I am using a small thin-client PC, an HP T5700 with only a 750Mhz Transmeta Crusoe CPU and 512MB Ram. My PC is low-power and silent (perfect as it is running in our bedroom). I am also using a cheapo Nightvision Webcam from eBay (make sure it is true nightvision and not just some LEDs that you can turn on and off – the description needs to  say that the webcam uses IR LEDs and that they are “invisible to the human eye”) with a combined microphone.

To stream the video from the webcam, I use the rather excellent motion via sudo apt-get install motion. You’ll need to mess with the settings in motion.conf to activate the webcam server and to allow access from users other than localhost, for reference, here is mine. Then, all you need do is set motion running at boot, there is startup script included with motion when you install it, but I am pretty sure that is borked, so I just added “motion” to my /etc/rc.local file. Thus, to view the video, I simply browse to the http://IPADDRESSOFPC:8081, which is easily opened in VLC.

To stream the audio from the microphone on the webcam turned out to be a much more difficult process, as I detailed in the post prior to this one. Suffice to say, FFmpeg came to my rescue, so I simply run the command:

ffmpeg -f oss -i /dev/dsp -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://234.5.5.5:1234

at boot and my microphone is miraculously streamed to rtp://234.5.5.5:1234, which I can open in VLC (if you are using Linux, you have to use the most recent version of VLC, i.e. 1.1.1, previous versions don’t play well with rtp streams on Linux).

I use the following simple script on my laptop to view both streams, so I can see and hear our lovely daughter, even when she is sound asleep in a dark room:

#!/bin/bash
echo "starting vlc"
VPID=( $(ps -e | grep vlc | awk '{print $1;}'))
if [ $? = 1 ];then
echo "error getting vlc PID, exiting"
exit
fi
while [ -n "$VPID" ];do
kill $VPID
VPID=( $(ps -e | grep vlc | awk '{print $1;}'))
done
cvlc http://192.168.1.5:8081 &
PID1=$?

echo video status $PID1
if [ "$PID1" == "1" ];then
echo "error starting vlc video"
exit
fi
vlc rtp://234.5.5.5:1234 --equalizer-bands="0,0,15,15,15,-20,0,0,0,0" &
PID2=$?

echo audio status $PID2
if [ "$PID2" == "1" ];then
echo "error starting vlc audio"
exit
fi
exit

This set-up has worked perfectly for the last week and even my wife appreciates my geeky skills on this one! Plus, I have a very small WiFi router (a La Fonera2) which makes the system completely portable, as the video feed can be viewed on pretty much any device. This now frees my IP webcams for the job they are much better suited for, home security. The end result are videos of this quality (to be clear, this is a freezeframe from the video feed, taken in a pitch black room):

So, why do all this? Well, for one, it can only up your geekery skills ;) But also, motion has some cool features, that, for example, let you take regular photos, allowing you to make cool time-lapse videos of your baby as she grows and develops (or sleeps through one night – man they move a lot). motion also has built-in motion detection (that is its main job) so I am sure you can configure it in such a way to act as an early warning system if the baby stops moving (I am thinking the horror that is cot-death here, but I have yet to fully look in to getting this to work yet). Also, if have a spare PC lying around that you can put aside for this, it means that in the future you can use that PC for other jobs as your baby gets older. I am planning to, for example, get a cheap touch screen monitor off eBay, to allow me to turn it into an interactive activity centre for our daughter, to help her learn numbers and the alphabet (there are already some great tools in Ubuntu for just this purpose, but I am learning Python and hope to program my own bespoke software for the job). You could add some speakers and use the PC to play soothing music to your baby to help her sleep or even go all out and hook up some kinda remote-controlled mobile. The options are endless and hopefully it’ll mean that once your baby is all grown up, she wont think of you as her embarrassing geeky mum / dad, but her “makes-really cool stuff for me to play with” mum / dad…. ;)

Monday, August 2nd, 2010 Baby, How To, Streaming 5 Comments

Stream Live Audio from a Microphone in Near Real Time in Ubuntu

I have been endeavouring over the past few months to hack my own baby monitor. I initially kinda cheated, by using an IP-webcam.  However, that isn’t nearly as geeky as using a PC and USB webcam (plus, I also wanted night-vision, and IP-webcams with nightvision are not cheap). I got myself a cheap USB webcam from eBay that has six IR lights for nightvision and a built in mic. I’ll post later about sorting out the video feed, which turned out to be relatively easy. Sorting out the live audio feed turned out to be much harder.

My basic set-up is: a PC (I am using a small thin-client, so low-power and silent) running Ubuntu Lucid, a USB webcam with built in mic (with an audio output jack for the mic) and a wired connection to my LAN. I aim to listen to the audio on at least two separate PCs using VLC, so the format of the audio stream wasn’t much of an issue. It turned out to be much more difficult than I expected to get a real-time stream, as the latency with many options turned out to be terrible.

First, I needed to determine what the audio input was. As I had only installed a minimal install of Ubuntu, I needed to install ALSA, the linux sound architecture, via sudo apt-get install alsa-base alsa-utils. Next, I had to set up the mixer levels, since my PC is headless and I was doing this all via SSH, I used the ncurses alsamixer which allows you to set mixer levels via the command line. Don’t forget to run alsactl store afterwards to save your settings. As a result of doing all this, /dev/dsp now pointed to my microphone input.

Next, I needed a way of streaming the audio over my network. As I am a big fan of FFmpeg, that was my first choice, as it comes with a rather neat little streaming server called FFserver. FFserver works in the following way, you set up various streams using an ffserver.conf file, run the server and then run FFmpeg and direct FFmpeg’s output to FFserver. Here is the ffserver.conf file that I used.

After lots of trial and error, I eventually got this going using the FFmpeg command: ffmpeg -f oss -i /dev/dsp http://localhost:8090/feed1.ffm, but the latency was terrible, hitting almost 30 seconds. From what I can gather, FFserver doesn’t get nearly as much love as FFmpeg, the FAQ for FFserver freely admits that audio and video will drift out of sync alongside other issues, so I realised that FFserver was not for me.

Next, I tried using icecast2. Icecast is a streaming music solution, primarily designed to allow you stream music over a network, based on WinAmp’s Shoutcast technology, essentially making your own radio station. I used icecast2 in combination with darkice (since you need a program to send the audio to the icecast server, so it has something to stream). Darkice was perfect as it is designed to stream live audio from the audio input. Both programs are configured via xml files. Here is my icecast.xml and my darkice.xml. You’ll have to edit both these files somewhat, to make sure the log file location is correct for example. Due to the bizzare way that alsa sometimes works, /dev/dsp doesn’t always work. So in the case of darkice, I used hw:0,0 instead. This refers to the same thing, but in a different way it seems (the reasons for it go beyond me, I think it refers to the first card and the first input (the first being 0, the second being 1 etc)).

I would then run the icecast2 server using: icecast2 -b -c ~/icecast.xml and then darkice using: darkice -c ~/darkice.cfg. I had to run the darkice command using sudo, as there were some permission problems with accessing the mic input. This worked much better than FFserver, the delay was now down to about five seconds, but I got constant buffering issues, meaning the audio constantly cut off for ages. Also, over time, the delay would gradually get worse and worse, till it was as bad as the thirty second delay I got with FFserver. Once again, this wasn’t good enough.

My next effort was a complete hack, from the client PC that I wanted to listen to the audio on, I would run the following: ssh server 'cat /dev/dsp > /dev/dsp'. This would literally copy the input from the microphone on the server (my thin client) to the output of my local PC using SSH. Remarkebly, it worked as well as using icecast, but once again there were buffering issues, as I was trasnferring raw uncompressed audio.

So, my next option was using VLC. From doing lots of googling, I had read many people recommending it. My issue with VLC is that it is not a lightweight option and seemed somewhat overkill to me.

The huge advantage with VLC is that it acts as both client and server, taking the audio input and streaming it (although it actually does this using the Live555 streaming media module).

VLC also allows you to stream audio using various protocols; http, rtp, rtsp among others. Once again this wasn’t easy to get working, but after lots and lots and lots of trial and error, I finally came to the following command that worked for me: cvlc -vvv alsa://hw:0,0 --sout '#transcode{acodec=mp2,ab=32}/

:rtp{dst=192.168.1.5,port=1234,sdp=rtsp://192.168.1.5:8085/lily.sdp}' .

This basically takes the microphone input, transcodes it into an MP2 file (despite having FFmpeg installed, VLC would refuse to transcode to MP3) and then streams it via rtp to the address rtsp://192.168.1.5:8085/lily.sdp.

I then simply entered rtsp://192.168.1.5:8085/lily.sdp into the network stream input in VLC on the client PC and I got live audio, in near real time!! FINALLY!! The delay was about 1.5 seconds, it required very little bandwidth and seemed to work well…..for a while. Sadly, there were three problems with this. First; only one client could connect at a time, secondly; the stream would fail after a while, sometimes after five minutes, sometime after two hours, but it would always fail and third it would totally slaughter the CPU. Once again, this was no good for listening out for a crying baby.

Finally, I came to the perfect solution, funnily enough going full circle and using FFmpeg. From my googling of VLC and fixing stream dropouts with rtp, I found out that FFmpeg can stream via rtp nativley, with no need to use FFserver. I thought this couldn’t possibly work, but I tried it out using the following command: ffmpeg -f oss -i /dev/dsp -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://234.5.5.5:1234. This is similiar to the VLC command, except that this time I am converting into MP3 and streaming to the address: rtp://234.5.5.5:1234. Once again, all I need to do is enter rtp://234.5.5.5:1234 as the streaming source in VLC. There are a few huge advantages with this method, first, the CPU usage is only about 25% on my naff little 750Mhz Transmeta Crusoe. Second, it seems multiple clients can connect at once and third, it seems rock solid. I have had this command running for three days straight with no problems. Memory usage seems to creep up over time, but that’s about all. I still get the roughly 1.5 seconds latency, and that is rock solid, it never gets any worse than that over time. Finally, a solution that works. So now, I use the following script, that is run at boot, to stream live audio in real time over my LAN:

#!/bin/bash
echo killing old ffmpegs

PID=( $(ps -e | grep ffmpeg | awk '{print $1;}'))
if [ $? = 1 ];then
echo "error getting vlc PID, exiting"
exit
fi
if [ ! -n "$PID" ];then
PID=1234567
fi
echo killing ffmpeg with PID $PID
kill $PID

echo starting ffmpeg
ffmpeg -f oss -i /dev/dsp -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://234.5.5.5:1234 2> ~/ffmpeg.log &

FF=$!
echo ffmpeg started with PID $FF
exit

This simply kills any other FFmpeg processes running and then starts a new FFmpeg process to stream the audio input (I kill old processes, so I can run this script if for some reason the stream fails and always be sure that only one instance of FFmpeg is running at any one time).

So, it took me about a month to get this far, but I am finally happy. There are other options that I also tried but could never get to work, such as the ability to share audio inputs using Pulse Audio (I got them to share, but it seemed to constantly crash my network) or using the Live555MediaServer directly (the one that powers VLC) or MPEG4IP but they both were poorly documented and were too complicated. I’ll write up about the video portion of this next, to show how I hacked my own baby monitor.

Monday, August 2nd, 2010 How To, Streaming 1 Comment

How To Fix Synergy+ Problems in Ubuntu and Windows

I use the excellent Synergy+ program to share my mouse and keyboard between my Windows XP box and my Ubuntu Lucid box. However, since upgrading to Lucid, I was having all types of problems with the versions of synergy and synergy-plus in the repos (mainly around use of CAPS and Shift being permanently on). Upgrading to the latest nightly builds seem to have fixed this, but there were a few install issues that needed to be sorted.

I got the .deb package for Ubuntu and the Windows installer from the Google Code hosted Synergy+ nightly build page, found here. The .deb package installed with no problems, as did the Windows installer. However, the Windows program wouldn’t load, it had lots of missing .dlls errors.

The missing dlls are libgcc_s_dw2-1.dll, QtCore4.dll, QtGui4.dll and QtNetwork4.dll. A quick Google led me to loads of issues related to various QtXXXX4.dll problems that are seemingly mostly fixed by installing EA’s Download Manager (since most of the posters were having Sims3 issues (nice one EA!)) or some awful bloat-ware that claimed to scan your PC’s registry. Errr, no thanks to that, downloading random dlls is dangerous. So, I went to the source for the dlls; Qt from Nokia. Download the most recent version (you don’t need the SDK) from here and choose LGPL and Qt: Framework only and install the package (it is rather huge at over 200MB, but hey ho).  Once installed, navigate to this folder “C:\Qt\4.6.3\bin” (the version number might be different if it gets updated, but just find the bin folder) and copy the four missing dlls to here: “C:\Program Files\Synergy+\bin” (the location ‘may’ be different on Vista and Windows 7.

So, to recap. Copy:

libgcc_s_dw2-1.dll, QtCore4.dll, QtGui4.dll and QtNetwork4.dll

From “C:\Qt\4.6.3\bin”

To “C:\Program Files\Synergy+\bin”.

Finally, you can now run Synergy+, configure it if need be (though since I was running an older version of Synergy, my configs were already setup) and off you go. No more issue (hopefully:))!

Wednesday, June 30th, 2010 How To No Comments

How To Configure Wireless / WiFi Networking in Ubuntu via the Command Line (CLI)

There are a number of tutorials available on-line for sorting out WiFi in Ubuntu via the CLI, but most of them seem quite outdated, so I decided to do my own.

I did this on a minimal install of Ubuntu Lucid, so it is as up-to-date as possible. The PC I was using has no Windows Manager of Graphical Display Manager, just the good old terminal so all this is done via the CLI only. I did this using a USB WiFI dongle, but it should be the same whether you use an internal card or a USB card.

First, you need to install the relevant software. You need to have a wired connection at this point, otherwise this wont work.

sudo apt-get install wireless-tools wpasupplicant

If you are connecting to an open network, you wont need wpasupplicant. Next, you need to “bring up” (essentially this means activate) your WiFi interface. So, issue:

sudo ifconfig wlan0 up

Next, to make sure your wireless device is working as it should issue:

iwconfig
and then
sudo iwlist scan

This should show you some wireless networks as proof that the WiFi device is working, if something goes wrong here, then there is a problem with your device or driver and you need to get googling.

If you are accessing a secured network and you really should be, you need to access the correct version of your WiFi key. To get your key, issue this command:

wpa_passphrase YOURSSID YOURWIFIPASSWORD

This will result in something that looks like this:

network={
ssid="YOURSSID"
#psk="YOURWIFIPASSWORD"
psk=fe727aa8b64ac9b3f54c72432da14faed933ea511ecab1 5bbc6c52e7522f709a
}

You need to make a note of the long phrase after psk= (NOT #psk=) as this your WiFi password in hex format.

Next, you need to edit your interfaces file, so issue:

sudo nano /etc/network/interfaces

At the end of this file, you need to add your WiFi configuration. Here are the options you can add.

auto wlan0     #change this to the name of your WiFi interface
iface wlan0 inet dhcp     #this is normally fine, if you want a static IP address replace “dhcp” with “static”
netmask 255.255.255.0     #change this as appropriate for your network, this value is usually right
gateway 192.168.1.1     #change this as appropriate for your network
address 192.168.1.100     #only needed for a static IP address
dns-nameservers 192.168.1.1     #only needed for a static IP address
wpa-driver wext     #you shouldn’t need to change this
wpa-ssid YOURSSID     #just type the name of your SSID here
wpa-ap-scan 1     #if the name of your SSID is hidden usually, type 2 instead of 1
wpa-proto WPA    #if you use WPA1 type WPA, if you use WPA2 type RSN
wpa-pairwise CCMP     #if you use AES type CCMP, if you use TKIP type TKIP
wpa-group CCMP     #if you use AES type CCMP, if you use TKIP type TKIP
wpa-key-mgmt WPA-PSK     #usually WPA-PSK (if you share a key) but sometimes WPA-EAP (for enterprises)
wpa-psk YOURHEXKEYFROMABOVE     #the hex key that you generated earlier

Thus, since I am using a WiFi card that is identified as wlan0 and am connecting to a WPA1 AES encrypted network called MYPLACE that isn’t hidden without a static IP address, this is what I added:


auto wlan0
iface wlan0 inet dhcp
netmask 255.255.255.0
gateway 192.168.1.1
wpa-driver wext
wpa-ssid MYPLACE
wpa-ap-scan 1
wpa-proto WPA
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk 71c81a844973ae7bb1243141e5caa7b6bb0e2d7eetcetcetc

Finally, comment out the top section so it looks like this:

#auto eth0
#iface eth0 inet dhcp

This stops your wired network from working. This helps to ensure there are no conflicts. Remember, if you want your wired network to work again, remove these two comments (the #).

Finally, save the file by pressing CTRL and X and then pressing Y to save to the file. Now, reboot and your network should come up. Yay!

Some people have found that this doesn’t always work, so the next thing to do is to edit the configuration file for the wpasupplicant program. Do this by issuing:

sudo nano /etc/wpa_supplicant.conf

Basically, you add pretty much the same information here as you did to the interfaces file, except without the wpa- part. So, my file looks like this:


ap_scan=1
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="MYPLACE"
scan_ssid=0
psk=71c81a844973ae7bb1243141e5caa7b6bb0e2d7eetcetcetc
key_mgmt=WPA-PSK
proto=WPA
pairwise=CCMP
group=CCMP
}

As far as I am aware, the options are the same. So, edit this file as necessary, make sure you add the ctrl_interface and network={ at the beginning and the } part at the end. Save it and try restarting again. If it still doesn’t work, then kick your PC, wish you had installed Windows 7 instead and go off and do some Googling. You’ll find the answer on the Ubuntu forums and you’ll be happy again.

Best of luck!

Friday, June 25th, 2010 How To, Linux, WiFi 2 Comments

Pimp Your Wii with Home Brew Apps

About a year ago, I hacked my Wii, installing the Home Brew Channel via the Twilight Hack (it made me buy the game, which is meant to be one of the best on the Wii, so it’s all good Nintendo – though I haven’t really got into the game – I hate the wide eyed characters, its just so clichéd). However, I didn’t really find much use for it and let it die when the Wii updated itself (incidentally, this is a risky thing to do because depending on the version of the hack you installed and what you installed afterwards, a Wii System Update can brick your Wii..).

Recently, after having too many sleepless nights with the baby, I decided I needed to hack something. In my internet travels I came across this program, USB Loader GX, that allows you to backup your Wii Games to an external hard drive and load them all from one USB drive, no need to change discs any more. Now that sounds seriously cool.

So, following the rather detailed excellent ReadMii from USB Loader GX, I was able to re-install the hack, install the Home Brew Channel and then install the USB Loader GX program. A Word of Warning: Doing this invalidates your warranty and seriously risks turning your Wii into a fancy paperweight if you aren’t very careful. Also, do not use the Wii System Update function, since it might also brick your Wii, bear this in mind before proceeding. You can still access the Wii Network and the Shop after installing this hack, at least for the moment.

Essentially, the install process is:

  1. Use the Banner Bomb technique to install the Home Brew Channel (Home Brew software) via the HackMii installer.
  2. Install various hacked and custom IOS (essentially Operating Systems) and cISO (custom OSs) on your Wii, giving Home Brew software greater access to your Wii.
  3. Install USB Loader GX.
  4. Prepare a USB hard drive to use (formatted either via Fat, NTFS or WBFS), I chose WBFS as I have loads of spare hard drives and it is the most flexible with the Wii.
  5. Connect the hard drive to the Wii and load USB Loader GX.

Once done, you then need to copy all yours games to your Hard Drive. I found that for some reason the Install function of USB Loader GX (where you copy the game to your hard drive) didn’t work for me. So, instead I used a tool called DVD Dumper, following the tutorial from here. That site actually contains lots of useful guides, I recommend it for a good background read. There is a version 1.3 of the DVD Dumping tool, but the dev has given up development and 1.2 seemed to work well, over WiFi anyway. Bear in mind it takes about 2.5 – 4 hours per disc, depending on the speed of your connection – shame Nintendo never added an Ethernet port really.

The process was pretty easy and basically goes like this:

  1. Load DVD Dumper via the Home Brew Channel.
  2. Choose Network Dump and insert your disc.
  3. On a computer, type your Wii’s IP Address in to FireFox (don’t use IE), your Wii’s IP Address is given to you on screen by the DVD Dumper program.
  4. Click on the link to download the inserted game as an ISO and save the file.
  5. Wait 3 hours and go do something good, go running, mow the lawn, vote Lib Dem.
  6. Connect your already prepared USB hard drive to your computer and load WiiBackupManager.
  7. Copy your ISO from your computer to your hard drive using WiiBackupManager.
  8. Connect your hard drive to your Wii, load USB Loader GX, highlight one of the new cover-less games, press 1 to choose to download the covers, let it do its stuff and finally you are good to go!

It should be noted that this technique can also be used by naughty and bad people to download copies of games from the internet and play them, without paying for them. People, this is stealing. If you didn’t buy it, you have no right to use it or play it. I know these days most internet users feel it is their right to download stuff for free if they want, but, there is no way round it, this is stealing and is only harming the industry you love. Don’t do it. Please only use this program to backup games you already own to a hard drive (this in itself is probably illegal, but as I don’t share my games with anyone, I don’t think I am really doing anything wrong).

The Home Brew Channel also gives you access to loads more cool stuff as well. Simply follow this guide to download and install the Home Brew Browser. It allows you to browse, install and update all the cool stuff that people have written for use on the Wii, including old school game ports, media players (including the GeeXbox) and a load of other weird and wonderful stuff. Get stuck in and be the envy of all your boring Wii System Menu version 4.2 friends, so long as you don’t mess up along the way and end up with a nice white brick ;)

Wednesday, April 14th, 2010 Hacks, How To, Wii 1 Comment

Server Migration Complete

So, I am now hosting this site with JustHost.com as I got tired stressing about keeping my own server up and running and not being able to upgrade it and mess with it in case I mess anything up.

Hopefully things will now be more reliable and I shall see if I can add any more services.

If you want to use JustHost.com’s services, click the small advert below and I’ll earn $60 apparently!

Thursday, February 11th, 2010 Set up a blog, Update No Comments

Make Your Own Video Baby Monitor

I’ve been quite quiet on the blog front lately, mostly because my Wifey is pregnant and we’ve only got one month to go! Being a through-and-through geek, I am always looking for ways to make my life easier or to do something cheaper through a clever technical hack and I plan to make my, my Wife’s and my baby’s lives as easy as possible through the power of the geek!

One thing I planned to do was to make my own baby monitor, rather than dropping up to £150 on some pre-built device. I wanted to be able to see as well as hear my baby when it is asleep upstairs, but those devices are very expensive. I thus thought I would try to make my own device using things lying around the house already. It actually wasn’t too difficult in the end, but I was lucky that I had the right equipment lying around. The first and most important piece of equipment is a Webcam. There are loads of options out there, but I wanted to use one that didn’t need to be connected to a PC to use. I had a Dlink DCS-2120 IP Webcam, that can connect to a Wireless network and doesn’t need a PC to run, it perfectly suited my needs.

Dlink DCS-2120

Dlink DCS-2120

The DCS-2120 includes some built-in features that are very useful, but I’ll mention that later. You can use other Webcams, even just simple USB versions, but you’ll need something to handle the video feed. If you don’t want to run a PC all the time, you could use something smaller, like a Fonera 2.0 router, that allows you to plug a USB Webcam.

So, next, you need a wireless network. Now, I didn’t want to carry around a huge router just to get this system up and running, because after all, this system should be portable enough to take to other people’s houses when we go travelling with the baby, so I chose to use the smallest WiFi router I could get my hands on. Luckily, I had one of the smallest routers already, a La Fonera. I already had another La Fonera installed and connected to the excellent free WiFi-sharing FON network, so I didn’t mind using this router for my own devices. Since the firmware (the software that runs on the router) that comes pre-installed on the router isn’t suitable for use as a normal router, I had to install (called flashing) some alternative Firmware. I chose to use DD-WRT, since it is fully supported on the Fonera and is very flexible. I used the guide from here that had some very detailed instructions on how to install DD-WRT on the Fonera. I shall summarise it here:

  1. Enable SSH access to the Fonera using a special web page hack.
  2. Enable the Redboot boot loader (allowing you load alternative firmware on the Fonera).
  3. Copy over the DD-WRT firmware and flash it on the Fonera.

It isn’t that simple, there are lots of steps involved, but the guide is very clear and easy to follow. Once I had DD-WRT installed, I now had a cool mini router, that I could then set-up to use with my IP Webcam.

La Fonera

La Fonera

Finally, I had to figure out how to actually view the feed. I wanted both a portable and a static solution. The Webcam I was using provides a feed using the rtsp protocol, so I needed a video player that could handle the rtsp stream. For my portable solution, I decided to use my Nokia N82 mobile phone, that has built in WiFi and can run the Core Media Player, that supports rtsp streams. For my static solution, I decided to use my laptop, running VLC on Ubuntu Karmic. In fact, because the Webcam just sends out the stream, any client that can access the wireless network and can play an rtsp stream will work. So, I can view the stream on my Windows Desktop upstairs, using VLC, whilst my wife can view the same stream on her Ubuntu Karmic netttop downstairs (yes Jobsworth, nettops can be useful).

I set-up the Fonera router, so that it provided a WiFi network with the same name (SSID) and security credentials as my main WiFi network at home. Thus, the Webcam automatically connects to my WiFi network when at home and my phone connects to it automatically also. Then, if I take the baby elsewhere, the Fonera replicates the WiFi network, so as far as the Webcam and phone is concerned, it is connected to the same network (this is very useful, because, the only way to change the wireless connection on the Webcam is through a wired interface, which is a bit of a complicated pain).

The real advantage of using this set-up is that you can have as many clients connected as you want to the video feed. The Webcam features a powerful microphone, so you can hear as well as see that the baby is ok and finally, the DCS-2120 includes some handy additional features, including the ability to take a photo at set intervals and upload them to an FTP server. Thus, I will be able to create one of those cool time-lapse movies of my baby as it sleeps and grows over time. I also chose the Fonera, because you can connect alternative aerials to it, most noticeably the La Fontenna, so this set-up should even work in my parent’s old house that has 12″ thick solid stone walls.

Since this whole system is meant to allow me to check up on our baby whilst it sleeps, I wanted to make sure it doesn’t look quite so scary and also allow it to be quite versatile. I thus bought a little teddypig, put the Webcam inside and used a Gorillapod camera stand to keep the Webcam in place (and also so I could attach it to pretty much anything).

It might look a little freaky, but I think it looks much less scary than the Webcam on its own.

Finally, here is a quick movie of the WebPig in action, alongside my laptop and mobile phone, showing it all working. The Core Media Player isn’t the best app in the world, so the video feed on the phone occasionally breaks up, as the video shows, but in general, it works very well.

The WebPig

The WebPig

Thursday, February 4th, 2010 Baby, Hacks, How To 2 Comments

Automount a drive in Ubuntu

I wrote this as a post on XBMC forum, but I thought I should share the wealth. The following is a guide to automounting a drive in a minimal install of Ubuntu with no GUI or desktop, only CLI access.

To manually get a minimal install of Ubuntu to auto-mount a USB drive at boot:

First off, you need command line access (also called The Terminal) to your installation and also you need to boot WITHOUT your USB drive connected. So, shutdown your box and then disconnect your USB drive. Now restart the box. Then, when XBMC has loaded, press Alt and F7 together, which should bring up a new Terminal screen with a log in.

Then log in using your username and password that you set up when you installed Ubuntu.

Next you need to type the following:

tail -f /var/log/syslog

This basically prints out the system log as it changes. Once you have typed this, plug in your USB drive. You should see a load of new stuff being printed in your terminal, this is the Ubuntu system recognising and loading your USB drive (though not mounting it). You should see something like this:


Jan  8 13:13:34 xpuntu kernel: [ 1671.616121] usb 2-2: new high speed USB device using ehci_hcd and address 5
Jan  8 13:13:34 xpuntu kernel: [ 1671.750917] usb 2-2: configuration #1 chosen from 1 choice
Jan  8 13:13:34 xpuntu kernel: [ 1671.752477] scsi6 : SCSI emulation for USB Mass Storage devices
Jan  8 13:13:34 xpuntu kernel: [ 1671.752815] usb-storage: device found at 5
Jan  8 13:13:34 xpuntu kernel: [ 1671.752820] usb-storage: waiting for device to settle before scanning
Jan  8 13:13:39 xpuntu kernel: [ 1676.753513] usb-storage: device scan complete
Jan  8 13:13:39 xpuntu kernel: [ 1676.754606] scsi 6:0:0:0: Direct-Access     WDC WD16 00AABB-56PUA0    7H00 PQ: 0 ANSI: 2 CCS
Jan  8 13:13:39 xpuntu kernel: [ 1676.755793] sd 6:0:0:0: Attached scsi generic sg2 type 0
Jan  8 13:13:39 xpuntu kernel: [ 1676.756402] sd 6:0:0:0: [sdb] 312581808 512-byte logical blocks: (160 GB/149 GiB)
Jan  8 13:13:39 xpuntu kernel: [ 1676.757163] sd 6:0:0:0: [sdb] Write Protect is off
Jan  8 13:13:39 xpuntu kernel: [ 1676.757171] sd 6:0:0:0: [sdb] Mode Sense: 00 38 00 00
Jan  8 13:13:39 xpuntu kernel: [ 1676.757176] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Jan  8 13:13:39 xpuntu kernel: [ 1676.761108] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Jan  8 13:13:39 xpuntu kernel: [ 1676.761119]  sdb: sdb1
Jan  8 13:13:39 xpuntu kernel: [ 1676.774572] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Jan  8 13:13:39 xpuntu kernel: [ 1676.774583] sd 6:0:0:0: [sdb] Attached SCSI disk

You want to look out for the reference to “[sd*]“, in my case it is [sdb]. This is the name that Ubuntu has given to your USB drive.

Next stop the tail command, so press:

Ctrl and C

This stops the tail command, then type the following:

sudo blkid

You will have to enter your password. This should give you something like the following:

/dev/sda1: UUID="1024B74F24B73696" TYPE="ntfs"
/dev/sda5: UUID="015273a3-e1a8-4d53-867f-ffec83b3df60" TYPE="swap"
/dev/sda6: UUID="50b2512a-4d07-4a83-860e-be608a5b2cb7" TYPE="ext4"
/dev/sdb1: LABEL="" UUID="48D3-B1C9" TYPE="vfat"

What you see should be different from this. This basically lists all the drives attached to your system, alongside two important pieces of info, the drives UUID number and what the drive is formatted as. You need to find the reference to the “sd*” that you found out earlier, so in my case it is /dev/sdb1. Then, make a note of the UUID number and the TYPE as well, in my case it is vfat.

So, now we know where our USB drive is and what it is called.

Next, we want to tell Ubuntu to automount it each time it boots.

So, you need to edit the /etc/fstab file that tells Ubuntu what drives to mount at boot. Be careful here, don’t delete or change anything that is already in this file, since it will stop your device from booting. It is ok to add new stuff to this file however. To be safe, we shall make a backup of the /etc/fstab file, just incase we mess up. If we do mess up, simple copy this backup over the /etc/fstab file and reboot and everything will be back as we found it. So, to make a backup simple type:

sudo cp /etc/fstab /etc/fstabackup

This copies the /etc/fstab file to /etc/fstabackup, which we can use as a backup.

To edit the /etc/fstab file, you need to use the command line Text editor called Vi ([url]http://en.wikipedia.org/wiki/Vi[/url] and [url]http://www.cs.colostate.edu/helpdocs/vi.html[/url]) I would recommend reading about it first, since it is a bit of an arse to use in Terminal mode.

Start Vi to edit your file using:

sudo vi /etc/fstab

Use your arrow keys to move down to the very end of the file. Then press “a” to Append stuff to the end of the file. Press Return to start a new line and then type the following:

UUID=YOURUUIDNUMBERHERE /home/xbmc/usb vfat defaults 0 0

Add your own UUID number after the = and change the TYPE if yours wasn’t vfat. /home/xbmc/usb is where you will be mounting your USB drive, this can be anything you want, but to make your life easy, since XBMC defaults to showing your home directory in the file browser, put it under your home directory, so in my case, the main user on my box is xbmc, so I use /home/xbmc/usb.

Press Enter again after typing that, then press Escape, then press and hold Shift and press Z twice, this saves and exits Vi.

Next, you need to make the folder that the drive will be mounted in, so type:

mkdir /home/xbmc/usb

Replace /home/xbmc/usb with whatever you put in the /etc/fstab file earlier.

Finally, that is it. Hopefully, if all went well, you can now simply reboot, with your USB drive attached, and the drive will be found at /home/xbmc/usb which you can navigate to from XBMC.

Best of luck!!

Thursday, January 14th, 2010 How To, Linux, Operating Systems No Comments

Backup Backup Backup – Updated

So, my main storage drive failed yesterday. Admitedly I have been having problems with it over the past few months, with fsck throwing errors on reboot, but yesterday it totally died. One minute it was happily sharing my music out via samba, the next, everything had gone :( Luckily, I run a good backup solution, so all I had to do was get myself a new drive (upgrading to 1TB in the process) and copy over my backed up files.

Simple, but if I wasn’t running my backup solution, I would have been screwed – bye bye to my music, photos and work files.

Thank you rsback and rsync….

(Update)

What is even more awesome, is that since Linux regards everything as a file (so all drives are effectively referred to as files (via the UUID) in Linux (in my case Ubuntu)) swapping out a drive with a new one is very simple. I just updated /etc/fstab with the UUID of the new drive, and then copied over my backed up files to it.

As far as Ubuntu is now concerned, it is the same drive, now only bigger. So all my samba shares and rsync folders all work as before.

God I love Linux.

Friday, January 8th, 2010 How To, Uncategorized No Comments

Search

 
If you like what you read, please donate via PayPal;)

Sponsors

Sponsors