Getting HTU21 Temperature/Humidity Sensor to work with Pi 1/2/3/Zero

enable i2s

  • sudo raspi-config
  • Advanced Settings > Enable I2C

or run the commands below

  • sudo sed -i 's/#dtparam=i2s-arm=on/dtparam=i2s-arm=on/g' /boot/config.txt
  • sudo sed -i 's/#dtparam=i2s=on/dtparam=i2s=on/g' /boot/config.txt

install i2c tools

  • sudo apt-get install i2c-tools python-smbus -y
  • sudo i2cdetect -y 1 (see if you can spot the connection, mine said 40)

install the pigpio libary

  • wget
  • unzip && cd PIGPIO
  • make && sudo make install
  • sudo pigpiod

get the pi code

  • git clone && cd RaspberryPI_HTU21DF
  • sudo python install

test it

  • python

DigitalOcean Referral Badge
Keep my site online & receive a $100 60-day credit at DigitalOcean for your VPS Hosting
Cheaper Games on Instant-Gaming
Proudly published with Ghost | Header Image by GUWEIZ@DeviantArt Creative Commons Licence