structure7 / fridgeTemps

Monitoring of a refrigerator and freezer's temperature to an OLED display.
1 stars 0 forks source link

NodeMCU with I2C attached SHT21 sensor not working #34

Open Martyz80 opened 6 years ago

Martyz80 commented 6 years ago

I'm trying to get a real SHT21 I2C humidity and temperature sensor to work with a NodeMCU V1 with a ESP8266 -12E. I have been trying ReadSHT2x and SHT21_DEMO. I have the sensor with SDA to D1 and SLC to D2. So the defaults should work. The results are: 1) ReadSHT2x returns zero's so it prints the "failed" values like 0.00% and -459.40 F. SHT21_DEMO returns nothing! I have these same programs and the same sensor running perfectly on a UNO.

My concerns are does this AMICA NodeMCU have the I2C functions? I suspect not as they would exit through GPIO02 and GPIO14 which aren't defined. I read in forum's you must bit bang for I2C on this NodeMCU. However, the Wire.h and it's source file don't contain any bit banging. They call txBuffer and rxBuffer.

I tried "NodeMCU I2C with Arduino IDE", which had me attach the NodeMCU to the UNO directly and the I2C worked perfectly, each spoke to the other Master and Slave. But I suspect this isn't real I2C.

My background is I wrote my own bit banging on a MicroChip 16F88 to talk to the SHT21's and have about a dozen projects running today in Assembler. Only Assembler.

I want to get I2C talking to my sensors from this ioT NodeMCU. Can you please help?

Martyz80 commented 6 years ago

More, I can see the SHT21 if I run I2C Scanner. It says it is on GPIO5 ,GPIO4 and address 0x40. If I attach a scope, on the UNO I see valid traces on SDA and SCL. On the NodeMCU I see nothing.

This is very confusing.

Martyz80 commented 6 years ago

Solved this. I had to add SlowSoftWire and SlowSoftI2CMaster to my .ccp file along with one definition line.