NeoPixel-KnightRider icon indicating copy to clipboard operation
NeoPixel-KnightRider copied to clipboard

Works only up to 315 NUM_PIXELS

Open themanfrommoon opened this issue 7 years ago • 7 comments

Hi,

I just want to report that I tested this sketch. It runs fine up to #define NUM_PIXELS 315 But with higher NUM_PIXELS it seems not to work, no idea why. (I wanted to run up to 600 NUM_PIXELS. With other sketches my hardware runs without any issue)

Thanks a lot and best regards, Chris

themanfrommoon avatar Jan 31 '18 10:01 themanfrommoon

I'd say if you are using an Arduino Uno you are running out of RAM. Try an Arduino Mega or something like a Particle Photon.

technobly avatar Feb 01 '18 07:02 technobly

Hello Brett, I’m using no Arduino. I’m using a nodeMCU v2 (ESP8266), I think it has 64 kB RAM. An Arduino Mega has only 8 kB RAM I think. An Arduino Uno has 2 kB RAM I think. So this should not be the problem?!

themanfrommoon avatar Feb 01 '18 15:02 themanfrommoon

Yeah, RAM is probably not an issue.

Does it compile for you above 315? What is the observed behavior above 315?

Try moving old_val up into global space, you might be getting a stack overflow. You may or may not need to replace it with memset(&old_val, 0, sizeof(old_val));

Try this shared app for a Photon (if you have one). It compiles up to 16000 pixels. https://go.particle.io/shared_apps/5a736e1cc4272765c7000fac

technobly avatar Feb 01 '18 19:02 technobly

It compiles without any issue. But then the nodeMCU v2 (ESP8266) is rebooting itself over and over every 2-3 seconds. I also tried what you wrote expect this shared app (don't know how it works) Nothing helps. It does not work.

themanfrommoon avatar Feb 01 '18 22:02 themanfrommoon

It could be power related. How much do you trust the power going into the Arduino? Try an alternative power supply. Have you calculated enough amps for all the pixels? Try using the power in the pixels on a separate power supply and the data from the Arduino.

drumminhands avatar Feb 01 '18 22:02 drumminhands

I have no Arduino! I'm using nodeMCU v2 (ESP8266). I don't think it is Hardware related, because other sketches on the same hardware works without any issue with 600 LEDs. I have a 12V 30A power supply for the LED strands. This should be enough to power ~5 LEDs walking around on the LED strands.....

themanfrommoon avatar Feb 02 '18 10:02 themanfrommoon

To rule out power, try using only one color to lower the current (avoid white). Or just unplug the strip from the MCU completely.

Rebooting does sound like a power brown out, or memory issue. Does the nodeMCU v2 have any stack overflow or heap overflow indicators?

I don't see any type issues in the sketch when the pixel number goes above 315, and if you moved old_val out of the function I doubt you are having any stack issues. Maybe there is something happening in the neopixel library you are using that's affecting things.

I hope you can figure it out, please report back if you do I'm sure that could help someone going through the same issue.

technobly avatar Feb 02 '18 22:02 technobly