Raspberry Pi Smart TV

This is a small project that creates a pseudo-kiosk streaming media box from a Raspberry Pi. Once you are done, you’ll end up with a Raspberry Pi that loads Chromium into full screen kiosk mode on startup with your favourite streaming services only a click away thanks to some minimal html acting as your command centre.

Step 1 - Install Raspbian

We are going to install Raspbian as our base operating system. Follow the instructions on the Raspberry Pi site to install raspbian.

Step 2 - Open Chromium on startup

Once your operating sytem is installed and you’ve got your Pi up and running, it’s time to set it up so Chromium starts whenever we log in. You’ll need to edit a few files to make this all hang together so get comfortable. I prefer to ssh in and work from my primary machine, but you can also work directly on the Pi if you’ve got a decent screen, keyboard and mouse set up. You might need to enable ssh on your Rasperry Pi if you prefer to work from a different machine.

To open Chromium on startup is a one-liner added to ~/.config/lxsession/LXDE-pi/autostart Including the --kiosk flag will open Chromium full screen without menu bars. This enhances the feeling of it being a dedicated “media” machine.

If you don’t have ~/.config/lxsession/LXDE-pi/autostart, create it with

touch ~/.config/lxsession/LXDE-pi/autostart`

Open the file in your favourite text editor and add this line in:

@chromium-browser --kiosk

If you tend to simply turn your Pi off at the socket rather than shutting down cleanly, one of the annoyances you’ll have is a little Chromium popup every time you start up telling you it didn’t shut down properly.

To stop this happening, we can replace Chromium’s memory of its state with the following bits of magic added to ~/.bashrc

sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences

Step 3 - Create a nice home page

The final piece of the puzzle is to put together a nice default home page to act as the command centre. Grab the icons for your various streaming media services, replace the hrefs and set it as the default home page in Chromium’s settings.

My end result looked something like this:

image

Here’s the basic template - it supports tabbing through items and has a basic animation effect to give you a visual cue of which icon you are currently focussed on.

Note that if you are in the UK, at the time of writing, 4OD wouldn’t stream through Chromium for some reason.

The end

That’s it; a basic kiosk that works well enough for me. If you want something more full featured, check out Donald Derek’s Smart TV tutorial.