I2C and ESP8266 07 / 12 not working - Working in NodeMCU
Posted: Tue Jun 05, 2018 11:05 pm
Hello,
I'm facing problems in order to use I2C in a Single ESP 8266 12 and 07 Chip. I'm not having this problem if I connect the I2C sensor to NodeMCU ESP 12, anyone faced this problem too?
Here is the configuration with problem:
- ESP8266 12 or 07 Chip (Not NodeMCU / Chip soldered direct on PCB);
- SHT20 connected to ports GPIO4 and GPIO5 (04 - SDA and 05 - SCL);
- Power to SHT20 comes from the same VCC and GND lines;
Configuration that works:
- NodeMCU ESP 12;
- SHT20 connected to ports D1 and D2;
- Power to SHT20 comes from the same VCC and GND pins from NodeMCU;
Both of configurations use this I2C Scanner Code:
Maybe the NodeMCU has a Pull Up, Voltage Divider, because since the ESP are the same and the ports are the same, this problem is something to blow the brain trying to solve and understand...
I'm facing problems in order to use I2C in a Single ESP 8266 12 and 07 Chip. I'm not having this problem if I connect the I2C sensor to NodeMCU ESP 12, anyone faced this problem too?
Here is the configuration with problem:
- ESP8266 12 or 07 Chip (Not NodeMCU / Chip soldered direct on PCB);
- SHT20 connected to ports GPIO4 and GPIO5 (04 - SDA and 05 - SCL);
- Power to SHT20 comes from the same VCC and GND lines;
Configuration that works:
- NodeMCU ESP 12;
- SHT20 connected to ports D1 and D2;
- Power to SHT20 comes from the same VCC and GND pins from NodeMCU;
Both of configurations use this I2C Scanner Code:
Code: Select all
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknow error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for next scan
}
Maybe the NodeMCU has a Pull Up, Voltage Divider, because since the ESP are the same and the ports are the same, this problem is something to blow the brain trying to solve and understand...