• sales

    +86-0755-88291180

Raspberry Pi Sense HAT (C) User Guide

Overview

If you want to DIY the Raspberry Pi into a robot that can detect motion posture and orientation, or if you want the Raspberry Pi to collect data such as temperature, humidity, and atmospheric pressure in the environment, this HAT can just meet the above requirements.

Features

  • Standard Raspberry Pi 40PIN GPIO extension header, supports Raspberry Pi series boards
  • Onboard QMI8658C+AK09918 (3-axis accelerometer, 3-axis gyroscope, and 3-axis magnetometer), detects movement, orientation, and magnetic
  • Onboard SHTC3 digital temperature and humidity sensor, allows monitoring of the environment
  • Onboard LPS22HB barometric pressure sensor, allows monitoring of the environment
  • Onboard TCS34725 color sensor, identifies the color of a nearby object
  • Onboard SGM58031, 4-ch 16-bit precision ADC, AD expansion to support more external sensors
  • Breakout I2C control pins, for connecting other host boards like STM32 and Arduino
  • Comes with development resources and manual (examples for Raspberry Pi/STM32/Arduino)

Parameters

Product Parameters
Operating Voltage:3.3V
Communication Interface:I2C
Logic Voltage:3.3V
Product Size:65 x 30.5(mm)
Accelerometer Features:Resolution: 16-bit
Range (optional): ±2, ±4, ±8, ±16g
Gyrometer Features:Resolution: 16-bit
Range (optional): ±16, ±32, ±64, ±128, ±256, ±512, ±1024, ±2048°/sec
Magnetometer Features:Resolution: 16-bit
Range: ±4912µT
Barometer Characteristics:Resolution: 24-bit pressure data, 16-bit temperature data;
Measurement Accuracy (at room temperature): ±0.025hPa
Measuring Range: 260 ~ 1260 hPa
Measurement Rate: 1 Hz - 75 Hz
Temperature And Humidity Sensor Characteristics:Measurement Accuracy (humidity): ±2% rH
Measuring Range (humidity): 0% ~ 100% rH
Measurement Accuracy (temperature): ±0.2°C
Measuring Range (humidity): -30 ~ 100°C
Color Recognition SensorResolution: 4 channel RGBC, 16 bits per channel
AD Conversion ChipResolution: 16 bits

Comparision

PK ItemSense HAT (C)Sense HAT (B)Note
GyroscopeMeasurement range: ±16/32/64/128/256/512/1024/2048 dps
Resolution: 16-bit
Measurement range: ±250/500/1000/2000 dps
Resolution: 16 bits
C-type angular velocity range is more
AccelerometerMeasurement range: ±2/4/8/16 g
Resolution: 16 bits
Measurement range: ±2/4/8/16 g
Resolution: 16 bits
MagnetometerMeasurement range: ±±49.12 gauss
Resolution: 16-bit
Measurement range:±49 gauss
Resolution: 16-bit
C-type magnetic measurement range is wider
BarometerMeasurement range: 260 ~ 1260 hPa
Measurement accuracy (at room temperature): ±0.025hPa
Measurement rate: 1 Hz - 75 Hz
Measuring range: 260 ~ 1260 hPa
Measurement accuracy (room temperature): ±0.025hPa
Measurement rate: 1 Hz - 75 Hz
Temperature and Humidity SensorMeasurement accuracy (humidity): ±2% rH
Measurement range (humidity): 0% ~ 100% rH
Measurement accuracy (temperature): ±0.2°C
Measurement range (temperature): -30 ~ 100°C
Measurement accuracy (humidity): ±2% rH
Measurement range (humidity): 0% ~ 100% rH
Measurement accuracy (temperature): ±0.2°C
Measurement range (temperature):-30 ~ 100°C
OthersColor sensor
High-precision 16-bit AD conversion chip
Color sensor
High-precision 16-bit AD conversion chip

User Guides for Raspberry Pi

Hardware Connection

Hardware connection as shown:
Connecting with Raspberry Pi Zero


Connect to Raspberry Pi 4 (required to add a 2x20PIN female header)


Connect to Raspberry Pi Zero


Open I2C Interface

  • Open the Raspberry Pi terminal and enter the following command to enter the configuration interface.
sudo raspi-config 
Choose Interfacing Options -> I2C ->yes start i2C kernel driver


and then reboot Raspberry Pi

sudo reboot

Install Function

BCM2835

#Open the Raspberry Pi terminal and run the following command
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
tar zxvf bcm2835-1.71.tar.gz
cd bcm2835-1.71/
sudo ./configure && sudo make && sudo make check && sudo make install
# For more information, please refer to the official website: http://www.airspayce.com/mikem/bcm2835/

wiring Pi

 #Open Raspberry Pi terminal and execute
 sudo apt-get install wiringpi
 #For Raspberry Pi systems after May 2019 (earlier than before, it is not necessary to execute), an upgrade may be required
 wget https://project-downloads.drogon.net/wiringpi-latest.deb
 sudo dpkg -i wiringpi-latest.deb
 gpio -v
 # Run gpio -v and version 2.52 will appear. If it does not appear, the installation is wrong.

 #Bullseye Branch systems use the following commands:
 git clone https://github.com/WiringPi/WiringPi
 cd WiringPi
 ./build
 gpio -v
 # Run gpio -v and version 2.70 will appear. If it does not appear, the installation is wrong.

Python

sudo apt-get update
#python2
sudo apt-get install python-pip 
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install python-smbus
#python3
sudo apt-get install python-pip3 
sudo pip3 install RPi.GPIO
sudo pip3 install spidev
sudo apt-get install python3-smbus

Download Demo

wget https://www.waveshare.com/w/upload/0/04/Sense_HAT_C_Pi.zip
unzip Sense_HAT_C_Pi.zip -d Sense_HAT_C_Pi
cd Sense_HAT_C_Pi/RaspberryPi

I2C device address

ADS1015: AD conversion demos (STM32, BCM2835, WringPi and Python) Device address: 0x48
QMI8658C: 6-axis sensor demos (STM32, BCM2835, WringPi and Python) Device address: 0x6B
AK09918C: 3-axis sensor demos (STM32, BCM2835, WringPi and Python) Device address: 0x0C
LPS22HB: Air pressure sensor demos (STM32, BCM2835, WringPi and Python) Device address: 0x5C
SHTC3: Temperature and humidity sensor demos (STM32, BCM2835, WringPi and Python) Device address: 0x70
TCS34087: Color recognition sensor demos (STM32, BCM2835, WringPi and Python) Device address: 0x29

Note: The I2C addresses of all the sensors of this module are different, and the user can use all the sensors on the board at the same time.

IMU(QMI8658C+AK09918C)

bcm2835

Enter the terminal of the Linux and execute the following command:

cd /home/pi/Sense_HAT_C_Pi/RaspberryPi/IMU/bcm2835/
#pi for account 
sudo make clean
sudo make
sudo ./main

Expected result:


Press Ctrl+C to end the program.

WiringPi Program

Enter the terminal of the Linux and execute the following command:

cd /home/pi/Sense_HAT_C_Pi/RaspberryPi/IMU/wiringPi/
#pi for account
sudo make clean
sudo make
sudo ./main

Expected result:

Press Ctrl+C to end the program.

STM32

This demo is based on XNUCLEO-F103RB and exports the data by serial port 2. The wiring as shown below:

Sense HAT (C)STM32
3V3+3.3V
GNDGND
SDAPB9
SCLPB8

Compile and download the program:

Open the serial port assistant and set the baud rate to 115200.
Expected result:


Parameter Calibration And Calculation

Calculate Acceleration

The unit of acceleration measured by the program is LSB (least significant bit), and the unit is often converted to gravitational acceleration (g) in actual use. The default range is 16384 LSB/g (±2g), so the actual acceleration measured is: