Introduction to the Sense HAT

What is the Sense HAT?

The Sense HAT is an add-on electronic board (or HAT) for the Raspberry Pi computer. It has sensors, a mini joystick and a grid of multi-colour pixels.


The Sense HAT was made for the Astro Pi project and launched into space in December 2015. With the Sense HAT you can create physical computing projects that use sensors and joystick inputs and show outputs on the LED matrix.

The Code Club Sense HAT projects are written for the Trinket Sense HAT emulator so you don’t need a physical Sense HAT. You can also complete the projects using a physical Sense HAT and a Raspberry Pi.

Trinket Sense HAT Emulator

You don’t need a physical Sense HAT to complete the Code Club projects. You can use Trinket Sense HAT Emulator which lets you code and test Sense HAT projects in a web browser.

Trinkets can be embedded in web pages, you can try the one below:

When using the emulator you write Python code in the editor on the left and the emulator runs on the right.

You can use the sliders in the emulator to adjust the values of the temperature, pressure and humidity sensors. Note that the values that are returned will not be exact as the readings from a real Sense HAT are not completely accurate or consistent.

You can emulate joystick inputs using the arrow keys pn the keyboard for directions and enter for a press of the middle button on the joystick.

Text output from print statements is shown below the emulator.

Note that Trinket uses Python 2 by default so we need the #!/bin/python3 line to tell it to use Python 3.

For general information on using Trinket in a Code Club see our Trinket Introduction and Trinket Accounts pages.