I just built a fairly simple control box for my 1 meter APA102 (60

I just built a fairly simple control box for my 1 meter APA102 (60 LED) strip. Whenever I call analogRead on any of the three potentiometers my Arduino has connected to it (on pins A0 thru A2), my LED strip shows dim green on the first LED, and occasionally some bright output on the second LED, but the remaining LEDs are unlit, despite calling a bright color in fill_solid() for the entire strip followed by FastLED.show(). I can see from the serial console that the analogRead is happening as expected. It’s just interfering with controlling the strip.

If I comment out the analogRead from this sketch, the strip responds as expected (all LEDs light up). I’ve also tried more complex sketches and it has no problem showing animations, etc.

When I prototyped the control box design on a breadboard with very short leads, the strip responded correctly while reading analog pins. My theory is that there’s some electrical interference present in my physical design that prevents the strip from getting proper instructions if analogRead is invoked, but I don’t know how to fix this. Please let me know if you have any suggestions or comments. Thank you!

Sketch gist link:

Tech details:
Arduino IDE version 1.8.3 on macOS 10.13
FastLED version 3.1.6
APA102 1 meter (60 LED) strip connected to Arduino via 8 foot wires (powered from 5V 10A power supply with ground tied to Arduino ground pin)
Arduino Uno Rev 3 (powered from a USB port)
Three 10K Ohm linear rotary potentiometers with sweeper (center) connected to pins A0, A1, and A2. Side terminals connected to ground and 5V pins on Arduino

As an experiment, try putting lines 27,28 in an EVERY_N… with a setting of 5 or 10 milliseconds.

Another experiment to try is adding a small delay, try 5 milliseconds, at the bottom of your main loop.

@marmil apologies if this double posted, not sure if I forgot to hit post or if G+ ate my comment! Thanks for your reply. I made the suggested changes (new gist link below) and while the majority of the LEDs light up to the specified color, the first LED is still dim green and the second LED will sometimes go dark after a minute or so. I also experimented with adding a color change to the loop, and it seems like it can process this only once, remaining on the second color after one iteration (rather than cycling between them as I’d expect for a loop). Commenting out analogRead lets the colors alternate as expected. I also tried moving the analogRead to setup followed by 3000 ms delay, so that it only runs once and has time to rest, and it still seems to interfere with the LED strip showing subsequent/continued instructions.

So if you run the FastLED demoreel100 or cylon example, everything looks fine and you don’t get the dim green first pixel?

Do you have a 1000uF capacitor across the pos/neg connections on your strip?
If you use a 1 foot data line instead of your 8 foot data line connection (if I understood your setup correctly) does the dim green first pixel go away?

I’ll need to check on the example functionality and shorter data lines tomorrow, but preliminarily I don’t have a cap across the pos/neg strip connections. Would you recommend that in any case? I’ll check on the other items soon. Thank you again!

Yes, try adding a capacitor. 1000uF, 16V or higher voltage rating.
I don’t understand why the analog read would be interfering in any way. That’s strange. Hopefully you can sort out if the longer data line is the problem.

Here’s an example that uses potentiometers to control hue and brightness that you could also try.

Do you have other devices hooked up to your board? I will sometimes get weeirdness on my first pixel if I have an oled board hooked up to my teensy as well as leds- the data transmission to the oled get’s picked up by the first led in my string… but, never gets passed down the line to the next led.

Apologies for the delay in replying here… I left my strip and controller setup at a friend’s house, and will be retrieving it tomorrow. I’m also trying to scare up a capacitor (harder to go and grab just one at a store now that Radio Shack’s gone :wink: ). @Charles_Schmitt_Deta to your question: I don’t have any other devices hooked up to the board. One further experiment I thought of trying is to power the Arduino from the DC jack with its own supply, to eliminate any potential fluctuations/deficiencies that my USB plug may be introducing. I’ll try that tomorrow!

Thanks,
Andrew