Skip to content

Access HTU21 (SHT21, SI7021) environmental sensor over I²C with this GoLang package. Periph.io driver?

License

Notifications You must be signed in to change notification settings

parMaster/htu21

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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:

Why does this package exist?

This package is a heavily rewritten idahoakl/HTU21D-sensor library. Main differences are:

  • periph.io i2c package to access I²C instead of proprietary one, idahoakl used
  • periph.io 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.

Releases

No releases published

Languages