Stufin
Home Quick Cart Profile

Raspberry Pi Sense Hat

Buy Now

Environmental monitoring

Temperature, humidity, pressure, and air quality sensors

Motion detection

Accelerometer and gyroscope for tracking movements and orientation

User interface

8x8 RGB LED matrix display and five programmable buttons

Audio capabilities

Built-in speaker and microphone

Key Features

  • Environmental Sensors:

Temperature sensor

Measures ambient temperature in the range of -40C to 85C

Humidity sensor

Measures relative humidity in the range of 0% to 100%

Pressure sensor

Measures atmospheric pressure in the range of 260 mbar to 1260 mbar

Air quality sensor

Detects NOx and VOCs, providing an air quality index

  • Motion Sensors:

Accelerometer

Measures acceleration in three axes (x, y, z) at a range of 2g to 16g

Gyroscope

Measures angular velocity in three axes (x, y, z) at a range of 245 dps to 2000 dps

  • LED Matrix Display:

8x8 RGB LED matrix display for visualizing data, patterns, and animations

Each LED can be individually controlled and addressed

  • User Interface:

Five programmable buttons for user input and interaction

Buttons can be configured to perform specific actions or trigger events

  • Audio Capabilities:

Built-in speaker for audio output

Microphone for audio input and voice commands

  • Power and Connectivity:

Powered directly from the Raspberry Pi board

Compatible with Raspberry Pi models A+, B+, 2, 3, and 4

  • Software Support:

Python library and examples provided for easy programming and development

Compatible with popular programming languages, including Python, Java, and C++

Technical Specifications

Dimensions

65 mm x 56 mm x 10 mm

Weight

25 grams

Operating Temperature

0C to 50C

Storage Temperature

-40C to 85C

Humidity

5% to 95% non-condensing

Applications

The Raspberry Pi Sense Hat is an ideal component for a wide range of projects, including

Environmental monitoring systems

Robotics and autonomous vehicles

Home automation and IoT systems

Wearable devices and smart accessories

STEM education and learning platforms

By combining the capabilities of the Raspberry Pi with the Sense Hat's advanced sensors and features, users can create innovative and interactive projects that interact with and respond to their environment.

Pin Configuration

  • Raspberry Pi Sense Hat Pinout Guide
  • The Raspberry Pi Sense Hat is a versatile add-on board designed for the Raspberry Pi family of single-board computers. It offers a range of sensors and interface options, making it an ideal choice for various IoT projects. This guide provides a detailed explanation of the Sense Hat's pins, helping you to understand how to connect and utilize them effectively.
  • Sense Hat Pin Structure:
  • The Sense Hat has a 40-pin header, identical to the Raspberry Pi's GPIO header. The pins are divided into several sections:
  • GPIO Pins (26-40): These pins are identical to the Raspberry Pi's GPIO pins and can be used as digital inputs/outputs, PWM outputs, or special function pins.
  • Sensor Pins (1-8): These pins are dedicated to the Sense Hat's onboard sensors, including the accelerometer, gyroscope, magnetometer, and environmental sensors.
  • Power Pins (9-12): These pins provide power connections for the Sense Hat's components.
  • I2C Bus (13-16): This section is dedicated to the I2C bus, used for communication with the Sense Hat's sensors and other I2C devices.
  • Pin-by-Pin Explanation:
  • Here's a detailed breakdown of each pin on the Sense Hat:
  • GPIO Pins (26-40):
  • 26 (GPIO0): Digital input/output or PWM output
  • 27 (GPIO1): Digital input/output or PWM output
  • 28 (GPIO2): Digital input/output or PWM output
  • 29 (GPIO3): Digital input/output or PWM output
  • 30 (GPIO4): Digital input/output or PWM output
  • 31 (GPIO5): Digital input/output or PWM output
  • 32 (GPIO6): Digital input/output or PWM output
  • 33 (GPIO7): Digital input/output or PWM output
  • 34 (GND): Ground pin
  • 35 (GPIO8): Digital input/output or PWM output
  • 36 (GPIO9): Digital input/output or PWM output
  • 37 (GPIO10): Digital input/output or PWM output
  • 38 (GPIO11): Digital input/output or PWM output
  • 39 (GPIO12): Digital input/output or PWM output
  • 40 (GPIO13): Digital input/output or PWM output
  • Sensor Pins (1-8):
  • 1 (INT): Interrupt pin for the accelerometer/gyroscope
  • 2 (SCL): I2C clock pin for the accelerometer/gyroscope
  • 3 (SDA): I2C data pin for the accelerometer/gyroscope
  • 4 (DRDY): Data ready pin for the magnetometer
  • 5 (SCL_MAG): I2C clock pin for the magnetometer
  • 6 (SDA_MAG): I2C data pin for the magnetometer
  • 7 (-pressure): Pressure sensor output
  • 8 (temp): Temperature sensor output
  • Power Pins (9-12):
  • 9 (VCC): Power supply pin for the Sense Hat (3.3V)
  • 10 (VCC_ENV): Power supply pin for the environmental sensors (3.3V)
  • 11 (GND): Ground pin
  • 12 (GND_ENV): Ground pin for the environmental sensors
  • I2C Bus (13-16):
  • 13 (SCL_ENV): I2C clock pin for the environmental sensors
  • 14 (SDA_ENV): I2C data pin for the environmental sensors
  • 15 (SCL): I2C clock pin for general I2C devices
  • 16 (SDA): I2C data pin for general I2C devices
  • Connecting the Pins:
  • When connecting the Sense Hat to your Raspberry Pi or other devices, make sure to follow these guidelines:
  • Use the Raspberry Pi's GPIO header to connect the Sense Hat to the Raspberry Pi.
  • Use jumper wires or a breadboard to connect external devices to the Sense Hat's GPIO pins.
  • When using the I2C bus, ensure that you have pull-up resistors connected to the SCL and SDA lines.
  • Be cautious when handling the Sense Hat and its pins to avoid damage or electrical shock.
  • By understanding the pin structure and functions of the Raspberry Pi Sense Hat, you can unlock its full potential and create innovative IoT projects.

Code Examples

Raspberry Pi Sense Hat Documentation
Overview
The Raspberry Pi Sense Hat is a multifunctional add-on board designed for the Raspberry Pi, a popular single-board computer. The Sense Hat provides an array of sensors and peripherals, including an 8x8 RGB LED matrix, accelerometer, gyroscope, magnetometer, temperature sensor, and humidity sensor. This documentation provides an overview of the Sense Hat's features, technical specifications, and code examples to help you get started with using this component in various projects.
Technical Specifications
8x8 RGB LED Matrix
 Accelerometer (ADXL345)
 Gyroscope (L3GD20)
 Magnetometer (MAG3110)
 Temperature Sensor (HTS221)
 Humidity Sensor (HTS221)
 Compatible with Raspberry Pi models A+, B+, and Raspberry Pi 2, 3, and 4
Code Examples
### Example 1: Reading Sensor Data and Displaying on LED Matrix
This example demonstrates how to read data from the accelerometer, gyroscope, and magnetometer sensors and display the values on the 8x8 LED matrix.
Python Code:
```python
import sense_hat
import time
# Initialize the Sense Hat
sense = sense_hat.SenseHat()
while True:
    # Read sensor data
    acceleration = sense.get_accelerometer_raw()
    gyroscope = sense.get_gyroscope_raw()
    magnetometer = sense.get_magnetometer_raw()
# Format the data for display
    data_string = "Accel: {:.2f} {:.2f} {:.2f}
Gyro: {:.2f} {:.2f} {:.2f}
Mag: {:.2f} {:.2f} {:.2f}".format(
        acceleration['x'], acceleration['y'], acceleration['z'],
        gyroscope['x'], gyroscope['y'], gyroscope['z'],
        magnetometer['x'], magnetometer['y'], magnetometer['z'])
# Display the data on the LED matrix
    sense.show_message(data_string, scroll_speed=0.1)
# Wait for 1 second before updating the display
    time.sleep(1)
```
### Example 2: Creating a Simple Weather Station with Temperature and Humidity Sensors
This example demonstrates how to read data from the temperature and humidity sensors and display the values on the terminal.
Python Code:
```python
import sense_hat
import time
# Initialize the Sense Hat
sense = sense_hat.SenseHat()
while True:
    # Read temperature and humidity data
    temperature = sense.get_temperature()
    humidity = sense.get_humidity()
# Format the data for display
    print("Temperature: {:.1f}C".format(temperature))
    print("Humidity: {:.1f}%".format(humidity))
# Wait for 1 minute before updating the display
    time.sleep(60)
```
### Example 3: Creating a Simple Animation on the LED Matrix
This example demonstrates how to create a simple animation on the 8x8 LED matrix using the Sense Hat's pixel API.
Python Code:
```python
import sense_hat
import time
# Initialize the Sense Hat
sense = sense_hat.SenseHat()
# Define a simple animation
def animation():
    for i in range(8):
        for j in range(8):
            sense.set_pixel(i, j, (0, 0, 0))  # Clear the pixel
            sense.set_pixel(i, j, (255, 0, 0))  # Set the pixel to red
            time.sleep(0.1)
            sense.set_pixel(i, j, (0, 0, 0))  # Clear the pixel
            time.sleep(0.1)
while True:
    animation()
```
These examples demonstrate the basic functionality of the Raspberry Pi Sense Hat. With its array of sensors and peripherals, the Sense Hat is an ideal component for a wide range of IoT projects, from environmental monitoring to robotics and wearable devices.