Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sensirion/raspberry-pi-i2c-sts4x
Raspberry Pi driver for Sensirions STS4x temperature sensor
https://github.com/sensirion/raspberry-pi-i2c-sts4x
driver linux raspberry-pi raspi sensirion sensor sts40 sts4x temperature
Last synced: 4 days ago
JSON representation
Raspberry Pi driver for Sensirions STS4x temperature sensor
- Host: GitHub
- URL: https://github.com/sensirion/raspberry-pi-i2c-sts4x
- Owner: Sensirion
- License: bsd-3-clause
- Created: 2022-02-09T16:48:30.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-13T13:01:05.000Z (6 months ago)
- Last Synced: 2024-05-14T14:13:14.346Z (6 months ago)
- Topics: driver, linux, raspberry-pi, raspi, sensirion, sensor, sts40, sts4x, temperature
- Language: C
- Homepage: https://sensirion.com/products/catalog/SEK-STS40-CD1B/
- Size: 512 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Sensirion Raspberry Pi I2C STS4x Driver
This document explains how to set up the STS4x sensor to run on a Raspberry Pi
using the provided code.[](https://www.sensirion.com)
Click [here](https://www.sensirion.com) to learn more about the STS4x Sensor and Evaluation Kit.
Setup Guide
-----------### Connecting the Sensor
Your sensor has the four different connectors: VCC, GND, SDA, SCL. Use
the following pins to connect your STS4x:*STS4x* | *Raspberry Pi*
:------: | :------------------:
VCC | Pin 1 (3.3V)
GND | Pin 6
SDA | Pin 3
SCL | Pin 5### Raspberry Pi
- [Install the Raspberry Pi OS on to your Raspberry Pi](https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up)
- [Enable the I2C interface in the raspi-config](https://www.raspberrypi.org/documentation/configuration/raspi-config.md)
- Download the driver for the [Sensirion Github Page](https://github.com/Sensirion/raspberry-pi-i2c-sts4x) and extract the `.zip` on your Raspberry Pi
- Compile the driver
1. Open a [terminal](https://www.raspberrypi.org/documentation/usage/terminal/?)
2. Navigate to the driver directory. E.g. `cd ~/raspberry-pi-i2c-sts4x`
3. Run the `make` command to compile the driverOutput:
```
rm -f sts4x_i2c_example_usage
cc -Os -Wall -fstrict-aliasing -Wstrict-aliasing=1 -Wsign-conversion -fPIC -I. -o sts4x_i2c_example_usage sts4x_i2c.h sts4x_i2c.c sensirion_i2c_hal.h sensirion_i2c.h sensirion_i2c.c \
sensirion_i2c_hal.c sensirion_config.h sensirion_common.h sensirion_common.c sts4x_i2c_example_usage.c
```
- Test your connected sensor
- Run `./sts4x_i2c_example_usage` in the same directory you used to
compile the driver.Output:
```
Serial number: 272952127
Temperature: 25.09 °C
Temperature: 25.08 °C
Temperature: 25.08 °C
Temperature: 25.10 °C
Temperature: 25.08 °C
...
```Troubleshooting
---------------### Initialization failed
- Ensure that you connected the sensor correctly: All cables are fully
plugged in and connected to the correct pin.
- Ensure that I2C is enabled on the Raspberry Pi. For this redo the steps on
"Enable the I2C interface in the raspi-config" in the guide above.
- Ensure that your user account has read and write access to the I2C device.
If it only works with user root (`sudo ./sts4x_i2c_example_usage`), it's
typically due to wrong permission settings.