bbx10 / htu21dflib Goto Github PK
View Code? Open in Web Editor NEWhtu21df temperature and humidity sensor support for Raspberry Pi
License: MIT License
htu21df temperature and humidity sensor support for Raspberry Pi
License: MIT License
ISSUE: Some sensors failed to init with "htu21df_init:htu21df did not reset" message.
FIX: Change line 124 of htu21dflib.c to
if ((buf[0] & 0xc7) != 0x02) {
Long description:
This issue caused by incorrect checking of user register content during sensor initialization routine.
As stated by manufacturer (see table on page 13 of sensor's datasheet https://cdn-shop.adafruit.com/datasheets/1899_HTU21D.pdf ), values of Reserved bits may be changed by manufacturer ("default
values of respective reserved bits may change over time without prior notice"). And I have real sensors with these bits changed (all '1').
So we need to mask these bits before checking.
PS: Excuse me for text description instead of attaching some diffs or patches. I am absolutely novice on Github.
Hi!
I hooked up a HTU21D-F Humidity Sensor (adafru.it/1899) to my raspberry pi A+. Was very lucky to find your code. I've installed it and received errors:
opening /dev/i2c-1
htu21df_init:htu21df I2C_RDWR failed -1/5
i2c_init failed -1
Now I'm stuck. Can you give me a hint?
"sudo i2cdetect -y 1" shows there must be something at dress 0x40.
So I think I've wired it right (VIN=Pin1 3.3VDC, GND=Pin9 Ground, SDA=Pin3 SDA1, SCL=Pin5 SLC1).
Stefan
In the htu21dflib.c file there is a line that is hard coded to the Raspbery V2 i2c value.
static const char I2CDEV[] = "/dev/i2c-1"; // raspberry pi
The version 1 Pi uses the i2c-0 address for the bus. You could maybe add a check for what version it is running on, and set the value accordingly.
Otherwise great code that works well!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.