A HAT, in case you’re wondering, is a Hardware Attached on Top add-on board that connects to a Raspberry Pi’s 40-pin GPIO. They can extend the capabilities of a Pi by adding motors, LCDs, sensors, controllers and more. In addition, they can be programmed via the Pi and Python.
In this tutorial, we’re using the Raspberry Pi TV HAT as sold by The Pi Hut. It’s a Sony CXD2880 TV Tuner supporting DVB-T and 2nd-gen DVB-T2 standards.
Step 1 – The Raspberry Pi TV HAT is compatible with the Pi Zero, Pi 3 A+ and B+ models. The kit comes with everything you need to connect the HAT to your RPi, including spacers, screws and the 40-pin header. Begin by opening the box and spreading the contents out on a clear area.
Step 2 – Start by connecting the 40-pin header to the 40-pin GPIO on top of your Raspberry Pi. Now take the spacers and screws and fit them to the corresponding holes in the corners of the main Raspberry Pi and the TV HAT; use three spacers and screws for the Pi Zero and two for the Pi 3 Models A+/B+.
Step 3 – With the spacers attached to the Raspberry Pi, line up the TV HAT with the 40-pin header, ensuring that the side of the HAT with the Pi logo is facing up and the HAT’s gold coloured coaxial attachment is on the side of the SD card. When in place, screw the HAT to its spacers.
Step 4 – Now attach the coaxial adapter to the gold-coloured pin at the side of the TV HAT. It may need a firm push to lock into place, it will ‘click’ when fully inserted and in position. Now you will need to connect the TV HAT to your TV aerial and provide power to the Raspberry Pi.
Step 5 – You can use the HDMI port to connect your Pi and its TV HAT to the TV/monitor, or you can just power the Pi (the TV HAT gets its power from the Pi) and connect remotely. The most important element is to ensure that the TV HAT is connected to an aerial that you know can receive a TV signal.
Step 6 – Power up your Raspberry Pi and when you get to the Raspbian desktop, open up the Terminal app. When at the Terminal, enter the following to ensure the Pi is up to date and running the latest versions of its software and system:
sudo apt-get update && sudo apt-get upgrade
Step 7 – Press Enter and allow the Pi to run through the update process. If you have any significant updates, you may need to answer ‘Y’ to any questions the Pi asks regarding these. Answering yes will replace the older software with the newer versions and is necessary for a smoothly running Pi.
Step 8 – If you haven’t used your Raspberry Pi since, at least, November 2018, then you may need to upgrade the core OS and synchronise the version of Raspbian with what’s currently available from the Pi Foundation’s downloads page. It’s not totally necessary, but if you choose to, enter:
sudo apt-get dist-upgrade
Press Enter and follow the on-screen instructions.
Step 9 – When the updates are complete, there’s a good chance you’ve got some leftover, older setup files and packages in the system. To save space, use the following commands:
sudo apt-get autoclean
sudo apt-get autoremove
Answer ‘Y’ to clear the system of the unnecessary packages and files.
Step 10 – At this point, it’s worth noting that in the UK it’s necessary to have a valid TV License in order to watch or record programmes as they are being shown on TV or live via an online service. It is an offence under Section 363 of the Communications Act 2003 to use a TV receiving device without a valid TV License.
View Part 2 of this tutorial here.