TUTORIALS Sense HAT
Turn a Pi HAT into a Magic 8-ball project
SENSEHAT
Les Pounder blasts off with another tutorial showing how a versatile HAT board can answer all your questions, and even be run in space!
OUR EXPERT
Les Pounder is associate editor at Tom’s Hardware and a freelance creative technologist.
YOU NEED
Any 40-pin Pi model
SenseHAT
Raspberry
Pi OS
Code: https:// github.com/ lesp/LXF273-SenseHAT/ archive/main. zip
T
he Raspberry Pi Foundation released its Sense HAT add-on back in 2015. Yet this board still packs a full scientific platform and an 8x8 RGB LED matrix for a little fun. In this tutorial we’ll introduce the board, show text on the LED matrix and learn how to read accelerometer data for a classic game of chance.
Installing Sense HAT is straightforward. With the Raspberry Pi powered off, connect the Sense HAT to all of the GPIO pins, ensuring that the Sense HAT perfectly overlaps the Raspberry Pi. Use the included stand-offs to securely mount the SenseHAT. Now attach your keyboard, mouse, HDMI, micro SD and finally power to boot the Raspberry Pi to the desktop. Because we’re using the latest version of Raspberry Pi OS, there’s no need to install any software or Python packages.
Project 1: Hello World
The first project with any new piece of tech or software is “Hello World”. It proves that our kit is working, and that everything is ready for us to move further. The first project is a simple scrolling message that will prove our software and hardware works. In your preferred Python editor, Thonny, IDLE, Mu or a text editor create a new file and call it text_scroll.py. Remember to save often!