0
\$\begingroup\$

I'm trying to put together a breadboard solution involving an 18650 cell (routed through a LiPo charging board) that powers both an ATTiny85 and two NeoPixel sticks. Two buttons trigger interrupts that sequentially light up or turn off the individual LEDs on the sticks. (I'm a software guy, that was the easy part!) Trouble is, if only one or two LEDs are on, all 16 LEDs go berserk, flashing various random colors and flickering. I measure the voltage at the GND and 5v pins going into the first stick and was surprised to see roughly 3.3v, not ~4.0v (which is what the battery supplies directly if I measure the voltage right on the battery terminals). On a whim I put the multimeter inline to measure the current and found that when it was flickering it was drawing nearly 100ma. I'm guessing that the boards aren't getting enough voltage and the laws of physics are compensating by drawing more current. It could also be my breadboard, potentially, because when I fiddle around with either the battery leads going into the power rails or with the data line, the flicker goes away and the current drops to something like 4ma (for just a single LED).

fritzing diagram

video demonstrating the issue

First question then - is that a plausible analysis of the problem (that the strip is flickering because of low voltage/high current)? The NeoPixel docs state that you can power a strip directly from a LiPo cell. (In addition to the docs I found I had to drop a small, like 100ohm or less, resistor directly on the ground line for the strip or all three diodes on each LED would turn on full brightness.)

Second question if the first is plausible: is it possible that because the ATTiny85 outputs 3.3v and the strip is sharing a ground with the ATTiny, the strip is only receiving that 3.3v?

Third question if the second is true: how can I ensure that the strips get the full 3.7+ volts from the battery rather than the 3.3v or less from the MCU? Is it simply a matter of breaking out a dedicated ground line from the battery right into the strip? Do I need to isolate just the ground or both the ground and positive signals?

Edit - might have solved it

I went back to some of the docs around using a Raspberry Pi which I thought might be helpful since it's another 3.3v system. Those docs recommended powering the Neos via 5v directly (though other docs on Adafruit's site say you can use a 3.7v LiPo and just have to work around the 3.3v data signal) and warn that very likely you can't just plug it in and have it run; you need either a 74AHCT125 level converter or a 1N4001 diode. I don't have any level converters laying around but I do have a few 1N4007s and so I ripped out all the resistors and put the diode on the battery+ line. Instant relief! As soon as the system gets power, the first pixel lights like it should with no flicker.

I also went back and looked at the stick closer - they already supplied a 475ohm resistor right on the data line. If I put another resistor on the data line I ended up getting the same flickering happening on the first LED. So for now, I'm just using the diode on its own, with the power and ground running right from the battery before going anywhere else, and no extra resistors anywhere.

So to the first question, I think the answer might be that the flickering was caused by the data signal voltage being out of range for the sticks unless most of the 16 were lit up enough to drop the voltage to the point where the data signal was back in range? The docs say it needs to be around \$0.7 * Vcc\$, and I imagine by adding the diode I lowered the voltage enough that the signal was more to the liking of the LEDs.

Does that make sense? Am I thinking about this right?

\$\endgroup\$
5
  • 1
    \$\begingroup\$ It would be better to have a small capacitor of about 0.1 uF across the power pins of the ATTiny, as close as you can to it. Then, connect the power to the LED strips with as little wiring as possible: instead of taking a route across the breadboard you could connect them directly to the charging board, thus reducing the current drop in the wires. Thicker wire would also help, if you have some and they are only thin ones at the momemt. Please let us know if that helps. \$\endgroup\$ Commented Apr 16, 2022 at 13:35
  • 2
    \$\begingroup\$ Regarding adding a capacitor: What is a decoupling capacitor and how do I know if I need one? \$\endgroup\$ Commented Apr 16, 2022 at 13:38
  • \$\begingroup\$ The MCU isn't powering the LEDs, it is only providing a data signal. \$\endgroup\$
    – Mat
    Commented Apr 16, 2022 at 13:39
  • \$\begingroup\$ "(In addition to the docs I found I had to drop a small, like 100ohm or less, resistor directly on the ground line for the strip or all three diodes on each LED would turn on full brightness." Source? My guess is this is talking about regular LED strips and not neopixels, which are digital devices so they way you dim them is to send them lower brightness values over the protocol. If the neopixels are turning full on, that is because they are getting a full on RGB value over the DI line, which might be a different problem. \$\endgroup\$
    – bigjosh
    Commented Apr 16, 2022 at 16:19
  • \$\begingroup\$ This was more an experimental source - the way it was wired up, without a resistor, everything was on full 100% bright; my point here was that nothing about a power resistor was mentioned on Adafruit's side and when I saw the high mA reading on the stick my first instinct was to slip a resistor in to cut the current. \$\endgroup\$
    – tmountjr
    Commented Apr 17, 2022 at 3:13

1 Answer 1

1
\$\begingroup\$

I'll just address one point: you can't have a resistor on the ground line. This will seriously confuse the controllers in the LEDs by causing the LED ground to rise above microcontroller ground.

This will also cause hiccuping as the LEDs starve themselves of voltage every time they draw current. I think this is what you're observing!

Remove that resistor first, then debug your original problem.

As an exercise, use Ohm's law to calculate the voltage across the LED strip + and - terminals when 50 mA is going through that 100 Ohm resistor :)

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Agreed. From the video, it looks like the data received by the the Neopixels is getting corrupted, and having the data signal be relative to that flickering ground would be consistent with that. \$\endgroup\$
    – bigjosh
    Commented Apr 16, 2022 at 16:13
  • \$\begingroup\$ Yeah, so it turns out that resistor was a terrible idea. 😬 \$\endgroup\$
    – tmountjr
    Commented Apr 17, 2022 at 3:22
  • \$\begingroup\$ This wasn't the answer per se but it definitely did put me in a "reset" frame of mind to dig up something that did work, so I'll mark it as the answer. \$\endgroup\$
    – tmountjr
    Commented Apr 19, 2022 at 3:14

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.