For the technical features of this module read this.
In order to simplify working on ESP8266 with a breadboard I reccomend to connect it with the ESP 07/12 Breakout Board.
So, after Setup ArduinoIDE to work on ESP8266 and load my script, I try to connect it with an i2c sensor: the HTU21D. But Wire library seems not working.
I googled a lot and finally I found the solution.
The ESP8266 seems to needs the GPIO02 as SDA and GPIO14 as SCL for the I2C protocol! So, take a look to the ESP 07/12 Breakout pinout in order to rightly connect ours I2C module on board.
Now, we can load a simple script testing I2C:
#include <Wire.h>
void setup() {
int sda=2;// qui SDC del sensore
int sdc=14;// qui SDA del sensore
Wire.begin(sda,sdc);
Serial.begin(115200);
}
void loop() {
i2cscan();
delay(1000);
}
int i2cscan(){
//scanning i2c
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the 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");
}
If it's all OK you should be able to see on Serial monitor: I2C device found at address 0x....
N.B. Another information I did not easily found is how setting ESP8266 on programming mode with ESP 07/12 Breakout Board: just hold on the reset button for at least 1 second and release. After that you are able to flash the firmware!
