A normal TV connected to a Raspberry Pi, network storage and the internet that can be used for watching films, browsing the web, monitoring CCTV and so on.
I've wanted to connect the main TV in my house up to the internet for eons now, certainly since well before 'internet' TVs came out and, for a short while at least, I did. However what I done previously was just dumped a tower PC next to the TV and considered it job done. These days I'm a bit more particular about the things I have lying around the house and don't want a bulky PC sitting in my livingroom (and with 2 little one's just itching to push any power button they see without caring a jot about correct PC shutdown procedures it isn't a very good idea anyway!).
With the invention of the Raspberry Pi and my own improved understanding of Linux and file sharing I felt it was now possible for me to have this setup without the bulk of a super computer sitting next to my telly.
Here is what I aimed to achieve in this project:
- Raspberry Pi semi-permanently connected to the main TV in the livingroom and easily usable.
- Ability to browse the web and stream videos from the likes of YouTube.
- Ability to connect to a storage device (such as an external hard drive) kept elsewhere in the house and view video files stored on it.
- Ability to connect to and view footage from my IP camera.
So nothing there that sounds too far outside the realms of possibility!
Setting Up the Pi
First up I got hold of a Raspberry Pi
Thankfully I work in an awesome office full of equally awesome and nerdy friends so getting a hold of one for a trial run before buying my own was fairly straight forward. There have been several versions of the Raspberry Pi out already so for those who are interested the version I used for this project was a Raspberry Pi 2 Model B V1.1 which was running Raspbian GNU/Linux 7 (I also tested with a Raspberry Pi 1 Model B running the same copy of Raspbian, the results of which were pretty much the same).
I took it home, I connected the Pi's HDMI port to the second HDMI port on my TV, the ethernet port to my router, plugged in my wireless keyboard and mouse and fired her up. After just a short spell of trying to guess the username I had forgotten, failing terribly and having to phone for a reminder, I was in! I started up Firefox and managed to connect to the web no bother. As far as I was concerned my first goal was achieved and I was off to a good start.
I quickly went on and tested a few videos on YouTube. Knowing all too well how easy it is to get distracted on there (damn you Vsauce!) I promptly closed it off and shutdown the Pi, striking goal number 2 off the list as I did so.
I had a feeling the rest of the goals wouldn't be quite so easy and indeed setting up the network storage was a bit more involved than just plugging in and getting going.
Setting Up the File Server
As it happens I already had a Ubuntu server sitting unused in the garage. This would be perfect for a home file server and once set up would live quite happily back where it was already residing in the garage. I blew the dust off of it and took it inside.
After powering it up and a few attempts at guessing my old password I finally got in and found I was running Ubuntu 12.04 with no GUI installed. It's been a while since I linuxed so I decided to chicken out of a terminal only setup and installed Ubuntu Desktop. Connecting the server directly to my router allowed me to do so
Next up was installing the wireless USB dongle I have, this turned into a real struggle. It is a D-Link DWL-G122 C1 which reassuringly has pretty good Linux support. After much plugging, unplugging and Googling I finally got the server connecting wirelessly to my network. Unfortunately I went through so many resources I didn't keep a detailed list but there was nothing particularly difficult to find. The one step I do remember is changing /etc/network/interfaces to configure my wireless card by default.
Setting Up The Shared Drive
This step was incredibly easy. I started off setting up a Windows share on my laptop and connecting to it from the server as I assumed this would be easier, it was and it worked. I then followed the instructions over at http://www.europe.eclipse.co.uk/Ubuntu/ for Ubuntu 10.10 and after a short installation of Samba (short because I kept the server hard wired to the router whilst I was downloading packages) I had my shared network area set up on Ubuntu and visible in Windows.
Sadly when I started moving my video files over I found that the connection speed was pretty poor, topping out at just under 1MB/s. Hopefully the Pi would be a bit better as it would be a wired to wireless connection as opposed to the current wireless to wireless setup from my laptop but I wasn't holding my breath. As long as the streaming worked I was happy to live with a slow copy speed.
Connecting the Pi to the Share Drive
I rather naively thought connecting Linux to Linux would work exactly the same as Linux to Windows and Windows to Linux but it turns out this isn't the case. The Samba shares did give me Windows' access to the Linux directory but to get onto it from the Raspberry Pi I had to follow the guide at Ubuntu Help and install a program called NFS. Thankfully though it was all straight forward and within a few minutes I was able to view my files from Ubuntu on the Pi!
All that remained was to test the ability to stream videos and as the pic shows, with a little bit of Linux magic, setting up a home file server is as easy as that.
Well... there was one mistake I made that ended up costing me an hour. The Raspberry Pi uses a program called OMXPlayer to play video files and if you associate the command 'omxplayer %f' to the double click command in Raspbian so that it opens automatically when you double click a file it will launch and essentially disable your keyboard. This meant I had to sit and watch an hour of Ben and Holly's Little Kingdom (one of my 1 year old daughters favourite shows) until it came to a natural end; an hour later! So let this be a lesson, the correct double click command is: 'lxterminal -e omxplayer "%f"'
Auto Mounting EVERYTHING
With me confident that everything was running as it should all that was left was to get everything auto-mounting at boot. I decided against mounting my 1TB external hard drive that I planned to use as the share and instead opted to just use the 70 gig that was on the server's file system. I may change my mind as time goes on.
Since in Windows the drive showed up already as a network device the only auto-mounting required was to get the Pi auto-mounting the share at boot. To do this I logged into the Pi and tried adding the line 'mcserver:/mnt/networkShare /mnt/networkShare nfs' to the file /etc/fstad as per the instructions back at Ubuntu Help but this didn't work and the file system still wasn't mounted at boot.
So I went on and tried adding the command 'mount mcserver:/mnt/networkShare /mnt/networkShare &' to the /etc/rc.d/rc.local file as per advice at LinuxQuestions.org (I tried the other trouble shooting options there first but they didn't work although 'mount -a' after logging in did). This worked and I now had my network share mounting at boot.
And that was it! I now had my Pi TV set up. It was ease to use thanks to the wireless mouse and keyboard, it was discreet - hiding nicely on the TV unit, it had access to the mountains of data on the web and also to its own 70GB hard drive for offline viewing.
I hadn't yet tested the connection to the IP camera so I done that now and sure enough, it worked without issue.
This meant the only problem was that the wireless signal wasn't strong enough to reach from my garage to my livingroom. :(
But how I overcame that is a tale for another time...
(#SpoilerAlert - Wireless booster)
If you want to know more about this project you can email me using the details in the About page.