Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/parmaster/htu21
Access HTU21 (SHT21, SI7021) environmental sensor over I²C with this GoLang package. Periph.io driver?
https://github.com/parmaster/htu21
gpio htu21 i2c i2c-sensors peripheral-driver-library peripheral-drivers periphio raspberry-pi raspberrypi rpi-gpio sht21 si7021
Last synced: 20 days ago
JSON representation
Access HTU21 (SHT21, SI7021) environmental sensor over I²C with this GoLang package. Periph.io driver?
- Host: GitHub
- URL: https://github.com/parmaster/htu21
- Owner: parMaster
- License: mit
- Created: 2023-02-20T18:06:41.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-30T23:46:31.000Z (over 1 year ago)
- Last Synced: 2024-11-15T03:46:14.290Z (about 1 month ago)
- Topics: gpio, htu21, i2c, i2c-sensors, peripheral-driver-library, peripheral-drivers, periphio, raspberry-pi, raspberrypi, rpi-gpio, sht21, si7021
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HTU21 (SHT21, SI7021) golang package
This package allows you to connect and read environmental data from HTU21 (SHT21, SI7021) sensor. I guess it could be qualified as a Periph.io driver, because it tries to comply with periph.io sensors interface like [bmxx80](https://periph.io/device/bmxx80/) in terms of the ways to access I²C, function calls and data returned.
## Example
You can find an example in cmd folder, it works on RPi 4 with HTU21 connected to 4-th I²C bus, sensor address is 0x40. List of I²C buses can be obtained with`i2cdetect -l`
Once you know the bus number, connected devices can be enumerated with
`i2cdetect -y 4`
## Additional links
Some links you can find useful working with this sensor, RPi GPIO and I²C:
- Sensor datasheet is here - https://www.te.com/usa-en/models/4/00/028/790/CAT-HSC0004.html
- Wonderful Raspberry Pi pinout guide - https://pinout.xyz/
- How to define additional/alternative I²C buses on RPi GPIO - https://www.instructables.com/Raspberry-PI-Multiple-I2c-Devices/
- *"Access GPIO pins without root. No access to /dev/gpiomem. Try running as root!"* problem solution - https://raspberrypi.stackexchange.com/questions/40105/access-gpio-pins-without-root-no-access-to-dev-mem-try-running-as-root## Why does this package exist?
This package is a heavily rewritten [idahoakl/HTU21D-sensor](https://github.com/idahoakl/HTU21D-sensor/) library. Main differences are:
- [periph.io i2c](http://periph.io/x/conn/v3/i2c) package to access I²C instead of proprietary one, idahoakl used
- [periph.io physic](http://periph.io/x/conn/v3/physic) package for environmental data (temperature and relative humidity)
- one function *Sense()* instead of separate functions for each measurement
- no proprietary logging package
- no write/read user registry functions **for now**
I'd really like to get rid of proprietary CRC checking dependency as well.