Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

ESP8266 Invalid values #5

Closed
jptrsn opened this issue Jan 26, 2018 · 2 comments
Closed

ESP8266 Invalid values #5

jptrsn opened this issue Jan 26, 2018 · 2 comments

Comments

@jptrsn
Copy link

jptrsn commented Jan 26, 2018

I'm using this library on ESP8266 processors. It was previously working properly, but it is now reporting temperature and humidity at 255. I've verified the sensor works using an Arduino Nano, and the same demo example. The only difference between the two is the pins used (I'm using D4 and D5 for SDA and SCL on a Wemos D1 mini).

Here's what I've changed in the example:
(myHTU21D.begin(D4,D5) != true)

@bfaliszek
Copy link

Change(in HTU21D.h file) line 125: bool begin(uint8_t sda = SDA, uint8_t scl = SCL); ->bool begin(uint8_t sda = 2, uint8_t scl = 14);
Define SDA as D4 and SCL ad D5. And leave myHTU21D.begin(); in .ino file.

@enjoyneering
Copy link
Owner

Hi,
jptrsn you got 255 value because of collisions on I2C bus. If master can't get the value from sensor it throws the code 255. Don't use D6 for I2C. D6 is for SPI bus. Default I2C pins are D2 & D1. Also arduino esp8266 I2C driver is very glitchy. Try my - https://github.com/enjoyneering/ESP8266-I2C-Driver
It works better with none standard I2C pins.

bfaliszek, hardcoded variables is bad practice. Plus you are breaking compatibility - official/default I2C pins are D2 & D1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants