Overview
The Raspberry Pi Sense HAT is an official multi-sensor expansion board manufactured by the Raspberry Pi Foundation. Developed originally for the Astro Pi mission onto the International Space Station (ISS), it turns any 40-pin Raspberry Pi into an integrated environmental and space science laboratory.
Fitting onto the 40-pin GPIO header, the Sense HAT integrates:
- An RGB LED matrix driven by an ATtiny88 microcontroller and LED2472G constant-current drivers.
- A 5-button miniature directional joystick (Up, Down, Left, Right, Center Click).
- An LSM9DS1 9-DOF IMU (3-axis accelerometer, 3-axis gyroscope, 3-axis magnetometer).
- An LPS25H barometric pressure & temperature sensor.
- An HTS221 relative humidity & temperature sensor.
Quick reference
Operating voltage (VCC) | 5.0 V DC (powered directly from Pi 40-pin header 5V rail) |
| Form factor | Standard Raspberry Pi HAT footprint () |
| Display | RGB LED Matrix (15-bit color depth / 32,768 colors) |
| Input control | 5-way directional joystick (Up, Down, Left, Right, Enter) |
| Motion sensing | 9-DOF IMU (LSM9DS1: accel, gyro, mag) |
| Environmental sensing | Pressure (LPS25H) & Humidity RH (HTS221) |
| Interface | bus 1 (/dev/i2c-1) |
Onboard ICs & Addresses
| Function | Integrated Circuit | Address | Description |
|---|---|---|---|
| 9-DOF IMU (Accel & Gyro) | STMicroelectronics LSM9DS1 | 0x6A | 3-axis accelerometer + 3-axis gyroscope |
| 9-DOF IMU (Magnetometer) | STMicroelectronics LSM9DS1 | 0x1C | 3-axis digital magnetometer |
| Barometer & Temp | STMicroelectronics LPS25H | 0x5C | pressure sensor |
| Humidity & Temp | STMicroelectronics HTS221 | 0x5F | relative humidity sensor |
| LED Matrix & Joystick | Atmel ATtiny88 MCU | 0x46 | Co-processor managing 64 RGB LEDs and joystick |
Specifications
| Parameter | Symbol | Min | Typ | Max | Unit | Conditions |
|---|---|---|---|---|---|---|
| Supply Voltage | 4.8 | 5.0 | 5.25 | V | Power from Pi 5V rail | |
| Operating Current | — | 450 | 600 | mA | LEDs active at 100% brightness | |
| Barometer Accuracy | -1.0 | +1.0 | hPa | Relative pressure accuracy | ||
| Humidity Accuracy | -3.5 | +3.5 | % RH | Across | ||
| Temperature Accuracy | -0.5 | +0.5 | °C | Across | ||
| Joystick Pins | — | — | 5 | — | — | Mapped to ATtiny88 register |
Python Software Installation & Setup
Enable and install the official Raspberry Pi sense-hat Python library:
bash
sudo raspi-config # Enable I2C under Interface Options
sudo apt-get update
sudo apt-get install sense-hat
Python Code Example
python
from sense_hat import SenseHat
import time
sense = SenseHat()
# Clear LED matrix
sense.clear()
# Display scrolling text message
sense.show_message("Astro Pi Online!", scroll_speed=0.05, text_colour=[0, 255, 0])
# Read environmental sensors
temp = sense.get_temperature()
humidity = sense.get_humidity()
pressure = sense.get_pressure()
print(f"Temperature: {temp:.2f} °C")
print(f"Humidity: {humidity:.2f} % RH")
print(f"Pressure: {pressure:.2f} hPa")
# Read 9-DOF IMU Orientation (Yaw, Pitch, Roll)
orientation = sense.get_orientation_degrees()
print(f"Pitch: {orientation['pitch']:.1f}° | Roll: {orientation['roll']:.1f}° | Yaw: {orientation['yaw']:.1f}°")
# Display a red pixel at center (x=3, y=3)
sense.set_pixel(3, 3, 255, 0, 0)
time.sleep(2)
sense.clear()
Common mistakes
- CPU self-heating offset on temperature: Because the Sense HAT sits directly above the warm Raspberry Pi CPU SoC, heat radiating from the Pi CPU warms the board PCB, causing temperature readings to read to higher than ambient room temperature. Use a GPIO ribbon cable or standoff tower to isolate the HAT, or apply CPU temperature offset compensation in software.
- Forgetting kernel module enablement: If
sense.get_temperature()throws an device error, runsudo raspi-configand ensure is enabled in the Raspberry Pi OS kernel.
Notes
- Sense HAT vs Sense HAT V2: The original Sense HAT uses LSM9DS1 + LPS25H; updated revisions use LSM6DSOX + LIS3MDL + LPS22HB.
Assets & downloads
- datasheetdatasheet
- product-pagereference