neopixelWrite() and WiFi.h

I observe that the builtin, function neopixelWrite() (which allows you to control the on board color LED on some ESP32 development boards) breaks WiFi. This does not appear to be documented anywhere.

On my Lolin ESP32 C3 Pico board, I can successfully connect to a WiFi AP as a client using WiFi.h. I can also successfully control the color LED using neopixelWrite(). But if I make any call to neopixelWrite() after calling WiFi.begin(), the WiFi will fail to connect. I can successfully use neopixelWrite() before WiFi.begin() or after WiFi.disconnect(). On my board the color LED is on Pin 7 which should not conflict with WiFi as it is not connected to ADC2.

Any ideas why this is happening?

neopixelWrite() uses RMT peripheral which seems to create an issue with WiFi from what I read

see here for some ideas

1 Like

My guess is that as any writing to neopixels turns off the interrupts while it works, it is that which is upsetting the Wi-Fi as during that time no interrupts from the Wi-Fi can be serviced.

I would switch to the "Dot Star" LED strips as you can write to them without turning the interrupts off. Or conversely not use a library and directly bit bang them, in an interrupt free way. I have code for that if you are interested.

Grumpy_Mike: the LED in question is on my LOLIN C3 Pico board, so switching LED strips is not an option. Sure, I'd be happy to try your bit bang code to see if it avoids the WiFi issue. Thanks.

J-M-L: Thanks for your pointer.

How often do you refresh that LED?

Then I am afraid you are stuffed. I would not expect you to be able to get it to work.

There is only one led to deal with so interruption blocking should be minimal, about 30 microseconds…

Fastled does not use the RMT peripheral, so that might be an option

J-M-L: I change the LED very slowly, max of 2x per second. I will look into Fastled. Thanks.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.