So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Gotfredsen
#80570 I tested this with Arduino 1.8.8 and ESP8266 2.5.0 and I can communicate between two ESP8266 using I2C. However, nor can I get the ESP8266 to work as a slave with other devices such as the Micro:Bit or the Raspberry Pi.

There is an example here by Matej Sychra. Notice that the Master also has to state it's I2C address in the Wire.begin(), which is not standard. I can't get the two ESP8266 to work together without this. Matej writes back from the slave to the master as a master, and not as a slave ... if that makes sense ... but even when I modify the code and writes back to master as a slave, the traditional way, I can't get it to work, unless I state the master's I2C address in the Wire.begin() ... in the master!

So while you can work between two ESP8266 with this version 2.5.0 using I2C, I am not sure that I2C in slave mode has been implemented perfectly in the ESP8266:
On the the Raspberry Pi, when I perform an I2C scan, ie. i2cdetect -y 1, it shows up 80% of the time, which, while seems high, should be and are for other devices, 100%!
And otherwise, I am not able to get any communication going over I2C with the ESP8266 as a slave and any other device as a master.

As mentioned before, In January 2017, Bjorn Hammarberg added i2c slave in Wire.cpp, which probably was released with this version 2.5.0. In all fairness, I don't actually know if this official means that there's is I2C slave support for the ESP8266. The documentation still only mentions support for master mode.
User avatar
By StanJ
#89773 Compile your slave for 160MHz CPU, and only set the I2C bus clock to a maximum of 50KHz.

There are two examples for I2C slave here:
https://github.com/esp8266/Arduino/tree ... e/examples

The master side doesn't have to be compiled at 160MHz, but the slave does.