1 week ago

Learn Sense HAT with Raspberry Pi

Essential resources for the space-borne add-on board for Raspberry Pi.

The Sense HAT 

Astro Pi Resources

The Sense HAT is an add‑on board for Raspberry Pi. It adds a range of motion sensors to Raspberry Pi, including a gyroscope, accelerometer, and magnetometer, plus temperature, pressure, and humidity sensors. On top of the Sense HAT board sits an 8×8 LED matrix and five-button joystick.

Sense HAT is a lot of fun. It’s a great way to get feedback on an environment with Raspberry Pi, and was made especially for the Astro Pi mission (where two Raspberry Pi units were sent into space).

Astro Pi is an ESA (European Space Agency) project run with the Raspberry Pi Foundation. It enables young people to conduct scientific investigations in space by writing computer programs that run on Raspberry Pi computers aboard the International Space Station.

Students up to 19 years old can take part. If you’re older than that, you can still get involved by volunteering for a Code Club (codeclub.org) and mentoring students.

Even if you don’t want to take part, Astro Pi has a solid set of resources designed to help students set up the Sense HAT and collect data from it.

Getting Started with Sense HAT

Raspberry Pi Projects

If you’re looking to get up-and-running with Sense HAT, the Raspberry Pi Foundation has you covered. The Getting Started with the Sense HAT tutorial shows you how to display text and images on the LED matrix display, set the orientation, and sense the environment and movement.

After that, head over to the Raspberry Pi Foundation’s projects website, click ‘Browse all projects’, and change the ‘Any hardware’ drop-down to Sense HAT. Here you’ll find a range of fun projects that explore all the different elements of the Sense HAT – from building a tight-rope game controlled by the accelerometer, to a weather logger and rainbow predictor. The projects are sparkly and designed to appeal to kids, but they’re a great way to learn data capture and basic programming concepts.

Experiment with Sense HAT

Essentials Guides are short books designed to make it easy to learn Raspberry Pi subjects. One of the most popular and enduring is Experiment with the Sense HAT.

You can still pick up a digital copy of this book for free, although print copies are now hard to find.

Inside the book, you’ll find eight chapters that cover everything from setting up the Sense HAT to building projects such as a Magic 8 Ball and Interactive Pixel Pet.

While the Astro Pi mission has evolved beyond that described in the book, the tutorials have stood the test of time. They remain a great way to understand the inner workings of the Sense HAT and how to control it with code.

Web resources

Get the most from your Sense HAT with this online documentation


Make sure you bookmark the Sense HAT API webpage. This reference outlines all the functions used to control the HAT (and used in a variety of different tutorials).

Sense HAT GitHub

Take a look at the Python module used to control the Sense HAT hardware on Raspberry Pi. Here you will find the underlying code being used to control the device.

Sense HAT Documentation

Raspberry Pi documentation for the Sense HAT explains how to set up and calibrate the device, as well as update the firmware. Check out the link to the schematics while you’re there.

Video learning

Set up the Sense HAT by watching a video

Astro Pi Kit – How to assemble the Sense HAT

This video from the ESA takes you through setting up the Sense HAT on a Raspberry Pi and using it to take part in the Astro Pi project.

How to build a 3D-printed Astro Pi flight case

The Sense HAT units used in the Astro Pi program are housed inside special cases designed to endure the rigours of space flight. Discover how to 3D-print your own special Astro Pi case in this video.

Tim Peake with Astro Pi on the International Space Station

Take a tour of the ISS and the Sense HAT kits being used on board the space station with British ESA astronaut Tim Peake.