Temperature, humidity, pressure, and air quality sensors
Temperature, humidity, pressure, and air quality sensors
Accelerometer and gyroscope for tracking movements and orientation
8x8 RGB LED matrix display and five programmable buttons
Built-in speaker and microphone
Key Features
Measures ambient temperature in the range of -40C to 85C
Measures relative humidity in the range of 0% to 100%
Measures atmospheric pressure in the range of 260 mbar to 1260 mbar
Detects NOx and VOCs, providing an air quality index
Measures acceleration in three axes (x, y, z) at a range of 2g to 16g
Measures angular velocity in three axes (x, y, z) at a range of 245 dps to 2000 dps
8x8 RGB LED matrix display for visualizing data, patterns, and animations
Each LED can be individually controlled and addressed
Five programmable buttons for user input and interaction
Buttons can be configured to perform specific actions or trigger events
Built-in speaker for audio output
Microphone for audio input and voice commands
Powered directly from the Raspberry Pi board
Compatible with Raspberry Pi models A+, B+, 2, 3, and 4
Python library and examples provided for easy programming and development
Compatible with popular programming languages, including Python, Java, and C++
Technical Specifications
65 mm x 56 mm x 10 mm
25 grams
0C to 50C
-40C to 85C
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.
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.