Buy the Sense HAT – as seen in space*!
*Not actually in space yet. Wait till December.
Today we have a new product launch: the Sense HAT is now available from the Swag Store, and through our partners RS Components and Premier Farnell/CPC. Here’s a video from Matt Timmons-Brown, freshly released from GCSE exam hell, to show you around.
The Sense HAT was originally developed around James Adams’ idea to make a cool toy-style board that showed off just how much you could do with your average modern MEMS gyroscope, 64 RGB LEDs and some Atmel microcontroller hackery.
Somewhere between prototype and production, it seems to have attracted extra features like a pressure sensor, a humidity/temperature sensor and a teeny joystick. It also seems to have been comandeered and made an integral part of the Astro Pi mission, which will see two Raspberry Pis, two Sense HATs and a lot of code written by UK schoolkids hosted on the International Space Station – I guess I’m to blame for that.
The board forms the basis for many of the experiment sequences that will be run on the ISS – many of the schools competition winners’ entries made good use of the HAT’s sensors to gather their experimental data. The LED matrix also provides a feedback mechanism and interactivity for British ESA Astronaut Tim Peake when he’s tasked with deploying the Astro-Pi board on the ISS (he’ll be setting it up on-orbit to run the experiment sequences). One of the winning entries – Reaction Games – programmed a whole suite of joypad-operated games played via the LED matrix. Snake is hilarious on an 8×8 screen.
The board itself has a suite of sensors, a “D-pad” style 5-button joystick and an 8×8 RGB LED matrix driven by a combination of an LED driver chip and an Atmel AVR microcontroller – an ATTiny88.
For the terminally curious, here are the schematics of the board.

The Sense HAT and its Pi tucked snugly into the Astro Pi flight case
Here’s the hardware run-down:
Sensing elements:
Pressure / Temperature
ST Micro LPS25H
– 24-bit pressure measurement resolution (260hPa to 1260hPa)
– 16-bit temperature measurement resolution (0-125°C)
Datasheet
Humidity / Temperature
ST Micro HTS221
– 16-bit humidity measurement resolution (0-100% relative humidity)
– 16-bit temperature measurement resolution (0-60°C)
Datasheet
Acceleration/Gyroscope/Magnetic field
ST Micro LSM9DS1
– 9 degrees of freedom (X, Y, Z independent axes for all sensors)
– ±16 g acceleration measurement range
– ±16 gauss magnetometer measurement range
– ±2000 dps (degrees per second) gyroscope measurement range
Each of these measurement channels has 16 bits of resolution.
Datasheet
All of these sensors have features for periodic sampling of sensor values – complete with internal FIFO storage. The LPS25H and HTS221 have maximum sample rates of 25 per second, the LSM9DS1 has a maximum sample rate of 952Hz – we are already imagining the birth of a million Pi-controlled stunt quadcopters.
LED Matrix
The LED matrix is driven by a combination of a constant-current LED driver and an Atmel ATTiny88 running a custom firmware that delivers an 8×8 display with 15-bit resolution RGB colour. If you want to get into the gory details, the AVR firmware is available on Github.
Joystick
The Atmel is responsible for sampling the joystick. We didn’t have enough pins left on the Atmel to dedicate the five that we needed to sample the joystick axes independently, so they’ve been spliced into the LED matrix row selects. The joystick gets updated at approximately 80Hz, which is the scan rate of the LED matrix.
All of the sensors (and the base firmware for the Atmel) are accessible from the Pi over I2C. As a fun bonus mode, the SPI peripheral on the Atmel has been hooked up to the Pi’s SPI interface – you can reprogram your HAT in the field! We use this method to get the firmware into the Atmel during production test – and we leave it unprotected so you can substitute the stock firmware to get it to do whatever you want. Seriously. First person to turn this sensor HAT into a quadcopter controller HAT wins a cookie from me.
Software
If you’re not assembly-language inclined, you can always use the HAT’s sensors from our shipped Python library – standard function calls return sensor values, give you joystick key events and allow you to display things on the LED matrix. The Sense API is available through the Raspbian APT repositories.
To access the magic, simply enter:
sudo apt-get update sudo apt-get install sense-hat sudo pip-3.2 install pillow
into a terminal window. Note you will have to reboot for the Sense HAT to be recognised.
The API is well-documented (and tested extensively by schoolchildren as part of Astro-Pi) – get reading here.
The LED matrix appears as a Linux framebuffer device – for fun you can compare the results of
cat /dev/urandom > /dev/fb0
and
cat /dev/urandom > /dev/fb1
to fill either your attached monitor or the LED matrix with random noise. The joypad appears as a standard input device – the “keys” map to Up/Down/Left/Right and Enter.
The baseline price (excluding spacers and screws, and local taxes) is $30. You’ll be able to buy from all the usual suspects – the Swag Store (which is bundling spacers and screws for free), RS Components/Allied, Premier Farnell/Newark and all their subsidiaries have stock today. Secondary suppliers may take a couple of days to get their hands on stock.
So, what are you waiting for? Get sensor hacking!
47 comments
Tim Richardson
Great news!
John
Nice hat!
Jonas Grosse-Holz
That’s awesome!
I particularly like the idea of being able to reprogram the AtTiny88, so you could theoretically for example convert the HAT to a standalone gaming handheld.
Leo White
Ordered!
Whilst I already have most of the individual sensors sitting around to put on my next robot it’ll be so much easier to just plug in this HAT and have them all ready to go. Plus there’s the added bonus of the joystick for input and the pretty coloured LEDs for erm.. output I suppose.
Yay for the easy life, and HATs!
Liz Upton
I’ll be really interested to see how many people incorporate one of these into their robot for Pi Wars later in the year. http://piwars.org/
Leo White
I wouldn’t be surprised if most of the PiWar entries were sporting one (That’s where mine is liable to end up first), as its easy to add and gives you a good head start on the ‘Most featured robot’ challenge, even if you don’t actually use the sensors in the other challenges.
What will be interesting is seeing the many different ways the inputs and outputs and incorporated into the design of the robot. I had planned on using a NeoPixel ring to give my robot some colour choices.. but now I may transfer those ideas to the LED matrix on the Sense HAT.
Alex Ellis
I agree with Leo – I have forms of these sensors but having them all in one tiny board is really neat.
On that note, do we know whether the compass is tilt compensated – or whether that needs to be done with additional maths/code routines?
Leo White
Yay! It arrived in time for the bank holiday weekend.
David Honess
Great post Jonathan and thanks to the Raspberry Pi Guy for an awesome video round up of the Sense HAT!
The Raspberry Pi Guy
Glad you like it!
Liz Upton
It’s terrific – thanks ever so much, Matt!
123_electron
What’s about the new offical display?
James Hughes
As with all Foundation products, there will be an announcement when it is ready and available for sale. In general, the Foundation does not announce product launch dates in advance.
123_electron
ok, i accept that.
but is it still in dev? People won’t wait another year till they get the display.
Liz Upton
Don’t worry; you won’t be waiting another year. If I were you, I’d keep a very close eye on this blog. (And that’s all I’m saying.)
123_electron
Thanks Liz,
you made my day (,week, year)!
whheydt
Worth noting that a week or so ago (I can’t find the post now…looks like it was deleted), it was “announced” that the HAT was in full production.
I’d love to see a similar announcement, at the proper time, for the display module.
(Need I add that I’ve ordered a SenseHAT?)
123_electron
the foundaition could say something about the status.
Michelle
My Sense Hat arrived today I got it locally (Australia) from
https://jiffyshop.com.au/SBC/raspberry-pi/85-sense-hat-raspberry-pi-.html
Hope to have it running by the morning ;)
Regards Michelle
ED
Looks like pretty good value for money! But don’t get fooled by the mentioned 16- or even 24-bit sensor readings; the accuracy seems very good for pressure (reportedly +/- 0.1 hPa typically), OK for temperature on the humidity sensor (+/- 0.5 °C around room temperature), quite low for temperature on the pressure sensor (+/- 2 °C for 0 – 65 °C) and rather bad for relative humidity (+/- 4.5 to 6 %).
I suppose for the acceleration & magnetic sensor, sensitivity, response time and hysteresis are more important than absolute accuracy. Response time and hysteresis are not reported as such in the datasheet. By the way, this package has a temperature sensor as well.
(Also remember that there’s always a 5% chance that the actual deviation of one sample is greater than the quoted margin of error. That’s just measurement statistics, not specific to these sensors.)
alexeames
Are you sure you’re not confusing accuracy and precision?
If you want higher accuracy, you’ll have to calibrate. More bits = more precision, not necessarily more accuracy.
(I hope I’ve got that right).
ED
No, that was just my point: precisions seems high with 16 and 24 bit readings, but accuracy doesn’t keep up.
Helen Lynn
I always have to visualise the dartboard to think about this!
Liz Upton
Ooh – I like that. Suddenly things are much clearer.
Stuart
Was just thinking to myself, “self, we should check to see if that thing is on sale yet.”
Sensors on my robot FTW!
Liz Upton
ALL THE SENSORS. :D
Leo White
Ohhh does it include a Tachyon detector? :)
jdb — post author
Unfortunately no, it only detects inverse Tachyons. And then, only if they’re travelling in a beam.
Leo White
Shame… But at least I don’t have to worry about improving my cloaking field…
MCM Electronics
We’re happy to announce that we’ve got the Sense HAT available for purchase for stateside folks at MCM Electronics! – http://www.mcmelectronics.com/product/RASPBERRY-PI-2483095-/83-16980
We’ve been playing with it internally and having some fun!
Chief Points
MCM, thanks for posting…got mine on order now!
whheydt
I ordered one from you before you posted, along with a couple of other items. That Lego-compatible case is cute…no idea what I’ll do with…perhaps I’ll let my 7-year-old grandson build things around it…
Zak Zebrowski
Ordered! Intending on using w/ kite photography rig.
Chief Points
Outstanding news, I’ve been waiting for this! Just finished ordering mine, looking forward to getting my hands on it!
Great job y’all!
Derek G
How does it connect to the RPi board? Is there soldering involved?
Liz Upton
No soldering – it just slots onto the GPIO pins, like all HATs.
Ben Nuttall
Thanks Jon.
Random sparkles on speed!
Ben Nuttall
Video: https://vine.co/v/ejTOwE3MErF
Federico Ramos
What is the behaviour of accelerometer and gyroscope in space? (in absence of gravity?)
Liz Upton
If you’re in freefall on the ISS (which you basically are), your accelerometer will read zero; but if you need to perform a debris avoidance manoeuvre, or a manoeuvre to reposition the ISS, that’ll read on the accelerometer. With the gyro, it does what it says on the tin, with or without gravity: you spin the Pi, you get a number out of it. Remember the ISS is spinning all the time, slowly, so the gyros will, we hope, be able to track that – although it may be that that movement is so slow we won’t be able to spot it.
Incidentally, Federico, you in particular should watch out for Friday’s blog post. Which has nothing to do with space. :)
perfo
I too have for a while now played and used the various individual sensors for ROV’s. I’ll be looking forward to give this all in one solution a go. The screen is an added bonus that though I haven’t a use for at the moment, I just know by looking at it, it will soon be a major part of any project.
I have a question though. At present I send my data over the net using a node.js server on the pi and I’m accessing the I2C modules with JavaScript (from the NPM manager) do you know if there is or is likely to be soon any code in JavaScript for this thing ? Unfortunately I’m not advanced enough to convert the python code…
Thanks for a super HAT.
wallyware
Oh my but this is cute.
don isenstadt
I got my sense hat today .. is it possible to connect my RTC to the sense hat or rather with the sense hat? also will there be a separate sense HAT forum or should the questions be put under astro pi? thanks..
Trevor Hales
Problem of “RPi-Sense FB device” not found etc.
Have any utilities been devised to confirm the successful installation of the software / hardware for the SenseHat device?
What size microSD card is required?
Can one download an already established image for the SenseHat device?
Peter Jones
Hello,
Why do the boards from your official distributors not come with the fixings (as mentioned in your own assembly instructions). I do think this is very unfair to users. You need to make this clear and perhaps spell out the advantages of buying direct you the Swag store. Can users by the fixings so it does not swing in the wind so much?
Jason Meyers
The installation instructions are missing an important step for people still using Wheezy. You need to issue the following command before attempting to install Pillow:
sudo apt-get install libjpeg-dev
Otherwise the pillow install will fail. It took me a while to find this solution on the web.
Patryk
Super equipment, combined with raspberry pi 2 and servo Hat is going to build a good biestie. I build one slowly begins to operate. And additional pressure sensors or temperature can give additional information about the environment: D
Below is a picture of my toy
https://www.dropbox.com/s/xufixrxlc8okyeu/123456.JPG?dl=0
Nicceee :D
Comments are closed