You might've heard that the Raspberry Pi Foundation released the Raspberry Pi TV HAT last month. The new HAT from the Foundation adds the power of a DVB-T/DVB-T2 receiver to your Raspberry Pi Media Centre setup.
There are several media centre operating systems to choose from to use with your Pi, and in this tutorial we're going to go over getting set up with OSMC (Open Source Media Centre). The team at OSMC have released new downloadable images for the Raspberry Pi this week to add support Raspberry Pi TV HAT to OSMC.
You will need:
- Raspberry Pi Zero/Zero W/2/3/3+ (we will be using a 3B+)
- Raspberry Pi TV HAT
- An SD card pre-loaded with OSMC (see install/update instructions below).
- A coaxial cable
- A micro USB power supply
- A HDMI cable
- A keyboard and mouse
- A TV or monitor
- A wifi connection
- Another networked computer (either another Raspberry Pi, PC or MAC).
- A small flat head screw driver.
Assembling your TV HAT
Firsly, let's put together our Raspberry Pi TV HAT. Inside the TV HAT box will be a bag of screws, posts and connectors. Screw two of the posts to the Pi next to the header using two of the flat head screws.
Once the posts are screwed in, add the 40 pin header onto the Raspberry Pi. Take care not to bend pins as you do this.
Take your TV HAT board and add the coaxial cable adapter to the board.
Push the TV HAT and adapter onto the 40 pin header on the Raspberry Pi.
Secure the hat with two screws using a small flat headed screwdriver.
Connect the coaxial cable to the Raspberry Pi TV HAT.
Now we're ready to set up OSMC!
Installing or Updating OSMC:
If you are installing OSMC for the first time, you can obtain a pre-built image from OSMC's Downloads page. Make sure you choose the 2018.10-1 release or newer to ensure the TV HAT will be compatible. Write this image to an SD card.
Or if you are updating OSMC, you can go into the menu and select My OSMC then Updates to update your version to the current version.
Setting Up OSMC
Plug in your Raspberry Pi using the power supply, HDMI cable to the monitor and connect your keyboard and mouse. Also connect the coaxial cable to the Raspberry Pi TV HAT and into the wall socket.
OSMC will boot up through a few initial setup and loading screens.
The first screen you'll see is the language choice. Scroll down and select "English". Hit enter.
Next select your timezone, for us it's Europe/London. Hit enter.
Now we need to name our device. We've gone with the default "osmc" but feel free to be adventurous. TV based puns are highly regarded here.
The next screen lets us pick whether SSH is enabled. We're going to use SSH after this tutorial, so we have enabled it. If you're not going to need command line access to this Pi, then feel free to deselect it. Hit enter on "Accept".
Next there is the License agreement. Naturally you should read this before continuing... Hit enter on "Continue" when you're ready.
Now we're going to setup our wifi connection to the Raspberry Pi. On the Networking menu, click "I'd like to set up networking manually".
Scroll down to "Wireless", move right and click "Enable Adapter". This will start to scan for available wifi networks.
Our home networks is PLUSNET-93G5 so we're going to choose to connect to that one. Enter your Password when prompted and wait for it to connect.
Make a note of the IP Address which has been allocated to this Pi, for us this is 192.168.1.75. Yours will most likely be different.
Now choose your Look + Feel. You can either choose OSMC or Classic. We're going with "OSMC" as we covered "Classic" in our LibreELEC tutorial.
And that's it, you've finished the initial setup!
Installing TVheadend ServerThe next step is to setup our Raspberry Pi to receive TV signals using the new TV HAT. To do that we're going to use an app called TVheadend which has a server and PVR client to receive and decode the signals.
Firstly we should setup the server. Scroll down to "My OSMC" and in the menu go to "App Store" in the bottom right corner.
The top option should be TVheadend Server.
Once you've clicked on it select "install" and then "apply"
Once this has installed successfully, you'll need to move onto your other computer.
Configuring TVheadend Server
On your other computer, open a browser and navigate to the IP Address we made a node of earlier along with an additional port number.
For us this would be 192.168.1.75:9981, for you just add :9981 onto the end of your IP address.
A login screen should pop up, and you'll be able to log in with the default username and password which is omsc for both username and password.
Select "English (GB)" for your language and click "Save & Next".
Next we can add additional users or change the password. We're going to keep it as default, but we recommend you change it to something secure. Click on "Save & Next".
On this next screen, we can see that the Sony CXD2880 DVB-T adapter has been picked up by TVheadend. For us, it's appeared in the Network 2 slot. In the drop down below Tuner, we need to pick "DVB-T Network". Then click "Save & Next".
Now we need to "Assign predefined muxes to networks". Basically this means pick an antenna to receive our TV signal from. In the UK we can use Digital UK's Coverage Checker. Enter your postcode into their checker and this will tell you which antenna is closest to your house. For us this is "Sandy Heath", so we pick "United Kingdom: uk-Sandy Heath" from the drop down menu next to "Pre-defined muxes". Click "Save & Next".
Now the receiver is scans for channels. This will take a little while, but by the time the scan is finished we've found 9 muxes and 150 services. This may differ depending on where you're receiving TV from, but it should find something at this point. Click "Save &Next".
The final screen of the setup of TVheadend server is the Service Mapping menu. Here you can choose to map specific channels and hide others (there are some *ahem* adult channels on Freeview which you might not want small eyes seeing). We're going to choose "Map all services". Click "Save &Next".
We've finished the setup of the TVHeadend Server. Now you should be able to browse the Electronic Programme Guide (EPG) and see what's on.
Setting up TVHeadend HTSP Client
Now the server has been setup, we need to add a client to our OSMC setup. To match the Tvheadend Server we're going to install Tvheadend HTSP Client. This will enable us to livestream, record and browse the EPG through OSMC. So let's go back to our Raspberry Pi with the TV HAT.
From the OSMC main menu navigate to "Settings" then "Add-on browser".
Now select "My add-ons", "PVR Clients" then "Tvheadend HTSP Client".
Scroll across to "Enable" and click on it. OSMC might pop up an error saying "Tvheadend HTSP Client Access denied." but we'll deal with that in the next step.
Scroll left and choose "Configure". Enter the IP address of the Raspberry Pi, ours is 192.168.1.75 and enter the username and password for the backend. Leave all the port information as it is. Hit OK.
OSMC has been setup now with a server and client to receive, decode and stream the TV signals. Now we should try to watch some TV! Head back to the main menu and select "PVR & Live TV" and the EPG should appear.
Select the channel you'd like to watch, hit "switch" on the menu and watch away!
If you want to get started with LibreELEC,we have a matching Getting Started with LibreELEC tutorial.
Let us know how you got on setting up your Raspberry Pi TV HAT in the comments below. Happy watching!