newpicommando
Posts: 4
Joined: Sun Jun 16, 2019 3:50 pm

How to read data from HTU20D temp/humidity sensor

Sun Jul 14, 2019 7:43 pm

Hello all,

I'm working on a project that requires me to use the Compute Module, and have wired up an HTU20D(F) temp/humidity sensor to my board. I can see the sensor on the i2c bus when I run i2cdetect:

Code: Select all

[email protected]:~# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
There is a CircuitPython library for the HTU21D that looks like it would work (https://github.com/adafruit/Adafruit_Ci ... hon_HTU21D), but CircuitPython is not available for the Compute Module and I'm not sure where to go from here.

I'm new to working with the Compute Module, so sorry if this is a dumb question but without having CircuitPython available, how would I interface with the sensor? Has anyone worked with these before, and does anyone have sample code or a reference that might help?

Thank you!

PhatFil
Posts: 1302
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: How to read data from HTU20D temp/humidity sensor

Sun Jul 14, 2019 7:53 pm

a quick glance over this project suggests its using c libs..
https://www.instructables.com/id/Detect ... berry-Pi-/

newpicommando
Posts: 4
Joined: Sun Jun 16, 2019 3:50 pm

Re: How to read data from HTU20D temp/humidity sensor

Sun Jul 14, 2019 8:33 pm

Worked like a charm, thanks!

Return to “Compute Module”