0

neopixel flash and other weirdness after several minutes of
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

neopixel flash and other weirdness after several minutes of

by wwhite74 on Thu Feb 07, 2019 6:31 pm

about 4 years ago, I made a clock with neopixels, and 3 of the quad alpha LED with i2c backpacks.
It's been running pretty good on an Arduino Uno.

It has wi-fi connectivity, (to set clock, and update some info like outside temperature and upcoming events that's shown on the alpha-leds)
I started with the cc3000 wifi breakout, but was having problems, and it ate a lot of memory,
as part of the initial build, I changed to an electric imp module, connected to the Arduino via serial, which worked, but was kinda slow, and relied on connection to them which I didn't like.

recently I've had success with other projects using an esp32 board, so decided to upgrade.
I copied a bunch of the code, making adjustments as necessary.

It works well for a few minutes (5 to 30 or so, it varies)
and then the pixels start flashing randomly, and the alpha LEDs stop updating,
-The webserver still works.
-I'm able to "control" the pixels
--- I have a brightness setting controlled from the web interface, still blinks, but dimmer/brighter as I change the setting
---I also have a "direct" mode, where I can send a string of colors, it "works", but the colors are all wrong.


Things I've tried.
- Powereing the esp32 off the USB port and the pixels off my power supply, thinking maybe it was undervolting the processor.
-I realized today I needed to provide a 3.3v reference to the i2c backpacks, instead of the 5 I started with on the rebuild, changed and still same results.
-monitoring the free memory (using the alpha LED as a readout and the "ESP.getFreeHeap()" method. It seems to have plenty of memory

equipment list
-esp32 IOT board (bought locally in NYC at tinkersphere) (it's "Comparable to Huzzah32 ESP32 Feather")
-60 neopixel ring. - run through a level shifter (thought that might be the problem, but same results with/without)

and on the i2c bus
--3 quad alpha with i2c backpack (from Adafruit)
--DS1307 Real time clock module (from Adafruit)

I'm kinda at a loss as to how further to troubleshoot.
I am using the NeoPixelBus library, since it's setup for the esp32.
I can post the code, but it's messy as the original clock was my first Arduino project. I'm still making it neater.

I think the battery in the DS1307 is from original build, not sure if it's low, but does seem to hold time over power downs
It's also all still installed on a breadboard, and might be a not so good connection on that.

my next step is to write a very basic sketch that just runs the LEDs and the clock, and see if it holds or not.

wwhite74
 
Posts: 58
Joined: Wed Dec 03, 2014 1:49 am

Re: neopixel flash and other weirdness after several minutes

by adafruit_support_mike on Fri Feb 08, 2019 2:44 am

Other people have run into similar problems trying to run NeoPixels from an ESP32.

Unlike other microcontrollers, the ESP32 runs a simple operating system. The OS runs the code you've uploaded most of the time, but periodically suspends your code and swaps over to built-in firmware that keeps all the radios working.

NeoPixel control signals operate at 800kHz, and it takes 80us to update a single pixel. The bit signals are self-clocking, meaning every bit starts low, goes high, then goes low again. The difference between a 0 and a 1 is the width of the high pulse, with a 1 staying high 150ns longer than a 0.

The ESP32's lag due to process swapping is longer than that, so it can mess with NeoPixel updates once the strip gets longer than about 32 pixels IIRC.

There's no way around that limit with just the ESP32, but we created the Seesaw board to offload that kind of problem:

https://www.adafruit.com/product/3657

It's an I2C device with a memory buffer large enough to handle about 340 NeoPixels. The ESP32 can load the memory buffer, then the Seesaw can take care of controlling the actual NeoPixels.

adafruit_support_mike
 
Posts: 55902
Joined: Thu Feb 11, 2010 2:51 pm

Re: neopixel flash and other weirdness after several minutes

by wwhite74 on Fri Feb 08, 2019 6:11 pm

I'm using the Neopixelbus library, it works well with neopixels and the esp32, and supposedly overcomes the timing issue.
just looked it's using one of the two i2c busses available on the esp32 to drive the pixels.
This method uses i2s hardware support to send data to the NeoPixels. Thus this method uses very little CPU for actually sending the data to NeoPixels but it requires an extra buffer for the I2s DMA to read from. Thus there is a trade off of CPU use versus memory use. The extra buffer needed is four times the size of the primary pixel buffer.

NOTE: The eps32 supports two i2s hardware buses. The first one is left open for other uses


I've got another project that uses this library with about 180 pixels, and it works really smoothly, every so often I'll get a small flash of white on one or 2 pixels for 1 "frame" of data to the strip when I'm fading the strip, but 99.99% of the time it's stable.
which is why I decided to change hardware on this project, although those are a RGBW strip.

the alpha-LEDs also stop working, which are using i2c. which is why I wasn't immediately going to a neopixel comm error.
but, I might have given myself a new avenue to investigate seeing that the library I'm using is also i2c to talk to the pixels.

https://github.com/Makuna/NeoPixelBus/w ... NeoMethods

wwhite74
 
Posts: 58
Joined: Wed Dec 03, 2014 1:49 am

Re: neopixel flash and other weirdness after several minutes

by wwhite74 on Tue Feb 12, 2019 1:44 pm

so, to close this out.

I wound up re-wiring the whole thing in case I had gotten something crossed in my initial go at it. and I wanted to add the level shifter to the breadboard

it would still lock up, but no flashing of the pixels (and I could still set them directly from the web) but all i2c devices would stop working,
I was getting an error 5 "I2C_ERROR_BUSY" returned from all 4 of the devices when testing using "Wire.beginTransmission / endTransmission"

I added an error checker, that resets i2c using "Wire.reset()" if it detects the bus locked up.
It's been working for 18+ hours now with no permanent lock ups.

so looks to have been a combination of an i2c error (seems to be a ongoing issue with the esp32) and my mis-wiring of something,

wwhite74
 
Posts: 58
Joined: Wed Dec 03, 2014 1:49 am

Re: neopixel flash and other weirdness after several minutes

by adafruit_support_mike on Fri Feb 15, 2019 3:16 am

Glad to hear you found the problems and got things working. Happy hacking!

adafruit_support_mike
 
Posts: 55902
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.