Difference between revisions of "Sense HAT (B)"
(→SHTC3) |
|||
Line 226: | Line 226: | ||
[[File:com.png]] | [[File:com.png]] | ||
=SHTC3= | =SHTC3= | ||
− | Note: The heating of the Raspberry Pi will affect the actual measured temperature. The board has an I2C interface. If you need an accurate ambient temperature, you can separate the Raspberry Pi from the module and connect it with a | + | Note: The heating of the Raspberry Pi will affect the actual measured temperature. The board has an I2C interface. If you need an accurate ambient temperature, you can separate the Raspberry Pi from the module for a distance and connect it with a cable to test it. |
==BCM2835 demo== | ==BCM2835 demo== | ||
Open terminal of Linux, Compile codes and run example by command:<br /> | Open terminal of Linux, Compile codes and run example by command:<br /> |
Revision as of 06:25, 27 April 2022
| ||
Introduction
It is a sensor expansion board specially designed for Raspberry Pi. It has on-board gyroscope, accelerometer, magnetometer, barometer, temperature and humidity sensor, etc. I2C interface communication supports more external sensors. 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 sensor data such as temperature, humidity and atmospheric pressure in the surrounding environment.
More |
Feature
- Standard Raspberry Pi 40PIN GPIO extension header, supports Raspberry Pi series boards
- Onboard ICM20948 (3-axis accelerometer, 3-axis gyroscope, and 3-axis magnetometer), detects movement, orientation, and magnetic
- Onboard SHTC3 digital temperature and humidity sensor, allows monitoring the environment
- Onboard LPS22HB barometric pressure sensor, allows monitoring the environment
- Onboard TCS34725 color sensor, identifies the color of nearby object
- Onboard ADS1015 ADC, 4-ch 12-bit precision, AD expansion to support more external sensors
- Brings I2C control pins, for connecting other host boards like STM32
- Comes with development resources and manual (examples for Raspberry Pi/STM32)
Specification
Working voltage | 3.3V |
Interface | I2C |
Dimension | 65mm x 30.5mm |
Accelerometer | Resolution: 16-bit |
Ranging:±2/±4/±8/±16g | |
Gyoscope | Resolution: 16-bits |
Ranging:±250/±500/±1000/±2000°/sec | |
Magnetometer | Resolution: 16-bits |
Ranging:±4900µT | |
Barometer | Resolution:24-bits (Pressure), 16-bits(Temperature) |
Accuracy (ordinary temperature): ±0.025hPa | |
Speed: 1 Hz - 75 Hz | |
Temperature & Humidity | Accuracy (humidity):±2% rH |
Ranging(humidity): 0% ~ 100% rH | |
Accuracy(temperature): ±0.2°C | |
Ranging(temperature): -30 ~ 100°C | |
Color sensor | Resolution: 4-channels RGBC, 16-bits per channel |
ADC | Resolution: 12-bits |
Product PK
User Guides for Raspberry Pi
Hardware Connection
The pins used to connect the Raspberry Pi:
Physical hardware connection diagram:
Connect to Raspberry Pi Zero
Connect to Raspberry Pi 4 (required to add a 2x20PIN female header)
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
sudo reboot
Install Function
BCM2835
#Open Raspberry Pi terminal and execute wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.tar.gz tar zxvf bcm2835-1.68.tar.gz cd bcm2835-1.68/ sudo ./configure && sudo make && sudo make check && sudo make install # more refer to the link: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.60 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
sudo apt-get install p7zip-full wget http://www.waveshare.net/w/upload/6/6c/Sense-HAT-B-Demo.7z 7z x Sense-HAT-B-Demo.7z -O./Sense-HAT-B-Demo cd Sense-HAT-B-Demo
I2C device address
ADS1015: AD conversion demo (STM32, BCM2835, WringPi and Python four demos) Device address: 0x48
ICM-20948: 9-axis sensor demo (STM32, BCM2835, WringPi and Python four demos) Device address: 0x68
LPS22HB: Air pressure sensor demo (STM32, BCM2835, WringPi and Python four demos) Device address: 0x5C
SHTC3: Temperature and humidity sensor demo (STM32, BCM2835, WringPi and Python four demos) Device address: 0x70
TCS34725: Color recognition sensor demo (STM32, BCM2835, WringPi and Python four demos) 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.
ICM20948 examples
bcm2835 example
Open terminal of Linux, Compile codes and run example by command:
cd ICM-20948/Raspberry\ Pi/bcm2835/ sudo make clean sudo make sudo ./ICM20948_DEMO
Press Ctrl+C to end the program
- WiringPi example
Open terminal of Linux, run example by command:
cd ICM-20948/Raspberry\ Pi/wiringPi/ sudo make clean sudo make sudo ./ICM20948_DEMO
Expected result:
Press Ctrl+C to end the program
Python
Open terminal of Linux, Compile codes and run example by command:
cd ICM-20948/Raspberry\ Pi/python/ sudo python3 ICM20948.py
Expected result:
Press Ctrl+C to end the program
STM32 example
This demo is based on the XNUCLEO-F103RB development board and outputs data through serial port 2. The connection is as follows:
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 sample program of the module sets AFS_SEL=0 by default, and the corresponding range is 16384 LSB/g (±2g), so the actual acceleration measured is:
Please refer to ICM-20948-v1.3.pdf P12.
Calculate gyroscope angular velocity
The unit of angular velocity measured by the program is LSB (least significant bit). In practice, the unit is often converted to angular velocity (°/sec). The sample program of the module sets FS_SEL=2 by default, and the corresponding range is 32.8 LSB/(°/s) (±1000°/s), so the actual angular velocity measured is:
Please refer to ICM-20948-v1.3.pdf P11.
LPS22HBTR
Note: The temperature detection of the air pressure sensor is only used for compensation. For accurate temperature detection, please observe the value of the SHTC3 temperature and humidity sensor.
bcm2835 demo
Open terminal of Linux, Compile codes and run example by command:
cd LPS22HBTR/Raspberry\ Pi/bcm2835/ sudo make clean sudo make sudo ./LPS22HB
Expected result:
Press Ctrl+C to end the program
wiring Pi demo
Open terminal of Linux, Compile codes and run example by command:
cd LPS22HBTR/Raspberry\ Pi/wiringPi/ sudo make clean sudo make sudo ./LPS22HB
Expected result:
Press Ctrl+C to end the program
python
Open terminal of Linux, Compile codes and run example by command:
cd LPS22HBTR/Raspberry\ Pi/python/ sudo python3 LPS22HB.py
Expected result:
Press Ctrl+C to end the program
STM32
This routine is based on the XNUCLEO-F103RB development board and outputs data through serial port 2.
The connection is as follows:
Compile and download the program:
Open the serial port assistant and set the baud rate to 115200
SHTC3
Note: The heating of the Raspberry Pi will affect the actual measured temperature. The board has an I2C interface. If you need an accurate ambient temperature, you can separate the Raspberry Pi from the module for a distance and connect it with a cable to test it.
BCM2835 demo
Open terminal of Linux, Compile codes and run example by command:
cd SHTC3/Raspberry\ Pi/bcm2835/ sudo make clean sudo make sudo ./SHTC3
Expected result:
Press Ctrl+C to end the program
wiring Pi
Open terminal of Linux, Compile codes and run example by command:
cd SHTC3/Raspberry\ Pi/wiringPi/ sudo make clean sudo make sudo ./SHTC3
Expected result:
Press Ctrl+C to end the program
python
Open terminal of Linux, Compile codes and run example by command:
cd SHTC3/Raspberry\ Pi/python/
sudo python3 SHTC3.py
Expected result:
Press Ctrl+C to end the program
STM32
This routine is based on the XNUCLEO-F103RB development board and outputs data through serial port 2.
The connection is as follows:
Compile and download the program:
Expected result:
The sensor is ok with no errors, LED2 is on:
When the air humidity is lower than 80%, LED3 does not light up. LED3 lights up when the air humidity is greater than or equal to 80%.
TCS34725 demo
bcm2835
Open terminal of Linux, Compile codes and run example by command:
cd TCS34725/Raspberry\ Pi/bcm2835/ sudo make clean sudo make sudo ./main
Expected result:
Press Ctrl+C to end the program
wiring Pi
Open terminal of Linux, Compile codes and run example by command:
cd TCS34725/Raspberry\ Pi/wiringPi/ sudo make clean sudo make sudo ./main
Expected result:
Press Ctrl+C to end the program
Python
Open terminal of Linux, Compile codes and run example by command:
cd TCS34725/RaspberryPi/python3/ sudo python3 main.py
Expected result:
Press Ctrl+C to end the program
STM32
This routine is based on the XNUCLEO-F103RB development board and outputs data through serial port 2.
The connection is as follows:
Compile and download the program:
Open the serial port assistant and set the baud rate to 115200
Expected outcome:
How to convert this data to color? The following introduces a tool, copy it to the browser and open it
https://www.sioe.cn/yingyong/yanse-rgb-16/
Download:
https://www.waveshare.net/w/upload/0/05/Hexacolor3.7z
ADS1015
bcm2835
Open terminal of Linux, Compile codes and run example by command:
cd ADS1015/Raspberry\ Pi/bcm2835/ sudo make clean sudo make sudo ./AD
Expected result:
Press Ctrl+C to end the program
Wiring Pi
Open terminal of Linux, Compile codes and run example by command:
cd ADS1015/Raspberry\ Pi/wiringPi/ sudo make clean sudo make sudo ./AD
Python
Open terminal of Linux, Compile codes and run example by command:
cd ADS1015/Raspberry\ Pi/python/ sudo python3 AD.py
Expected result:
Press Ctrl+C to end the program
STM32
This routine is based on the XNUCLEO-F103RB development board and outputs data through serial port 2.
The connection is as follows:
Compile and download the program:
Open the serial port assistant and set the baud rate to 115200
Resources
Demo code
Datasheet
FAQ
|
|
|
|
|
Support
Support
If you require technical support, please go to the Support page and open a ticket.