I've got an ESP8266 that takes instructions from a web page and sets a series of NeoPixels to flash in different sequences.

I noticed that when the Wi-Fi got data and parsed it, my LEDs would "stutter" as the processor ignored them for a moment while processing the incoming instructions.

So I added a 2nd ESP8266. This one just handles the LEDs. So the 1st ESP gets the Wi-Fi data and parses it. It then sends an interrupt to the 2nd ESP which breaks out of the LED display loop, checks the interrupt pin for HIGH or LOW and sets the LEDS based on HIGH/LOW.

However, I would like to send more data from the Wi-Fi ESP to the LED driving ESP. e.g. Colour data, transition speed, rotation direction etc. All of these settings I can send to the ESP from a web page.

I thought I2C (the wire library) would help but all comments seem to say that the ESP8266 cannot act as a slave so I can't send to it.

So it appears I'm left with Serial comms (the interrupt is over by the time comm start because I realize Serial does not work in an interrupt).

So my questions are:

  • Am I right that I2C will not work?

  • If I am wrong does anyone have a working end to end example?

  • If I am right is there an approved way to do ESP to ESP serial comms?

3 Answers 3


I assume that you are using the Arduino core for the ESP8266 (https://github.com/esp8266/Arduino)

Am I right that ic2 will not work?

I am not certain, but I get the same impression as you. It seems that the Expressif SDK only supports master mode.

If I am right is there an approved way to do ESP to ESP serial comms.

There is no "approved way", but there are many ways you can do it. A direct serial link will give you a simple pipe of data - what you put in at one end comes out the other. It's up to you to decide how you format and interpret that data.

My ICSC library may help you with that - I use it to connect an ESP8266 to an BeagleBone Black through serial: https://github.com/MajenkoLibraries/ICSC


The issue with the ESP8266 is that it is multitasking, and only 80% of the CPU time is available to developers. This manifests as an outage of 100-200us every 500ms or so, which rather complicates all sorts of software serial interfaces, such as I2C, SPI and UART. As a bus master the ESP8266 hides these issues as it is responsible for the bus clock, but as a bus slave it needs to halt data transfer for the duration of these random events.

A typical solution for this inter-CPU issue is to provide an external RAM cache to act as a mailbox, where each CPU will periodically check to see if any actions are outstanding and leave any requested data.

Has anyone explored this option for the Arduino to ESP8266 interface?

  • If you wish to ask a question please use the "Ask Question" button in top right corner.
    – Avamander
    Commented Feb 15, 2016 at 9:43

I am not certain, but I get the same impression as you.
It seems that the Expressif SDK only supports master mode.

Sorry no. Espressif SDK supports Slave Mode too. official the Master works with 50 kHz (CPU 80MHz), and 100 kHz in technical referenz and unofficial in my test with !1.2MHz you must switch then to the 160 MHz CPU and you must work for delays with asm ("nop") 12.5 ns at 80MHz and 6.25 ns at 160 MHz then you can toggle the pins at 80 MHz with 700 kHz and with 160 MHz with 1400 kHz. because there are instruction to the gpio ( toggle output low, "opendrain" clear output with pullup high ) it will be a netto rate of 620 kHz, and 1260 kHz.

a stable 120 kHz is done

best wishes rudi ;-)

I2C Slave ESP8266


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.