WS2812 - power capacitor not discharging and 'freezing' LEDs

Hi,

I've built up a project using 14 WS2812 through-hole LEDs. There is a resistor from the Teensy to the data input (actually between the output of a 74AHCT125 and the first LED), 0.1uF caps across +ve and -ve on each LED, and a 1000uF cap across the main power input to the circuit - these are all as specified for using WS2812.

All was working Ok initially but then on a disconnection and reconnection of power I found that several of the LEDs had 'frozen' on in a variety of colours that were not meant to be on as programmed in the sketch. I disconnected and reconnected power again and these were still lit up on power application. I tried uploading the sketch again and they still remained lit, and then tried a new sketch and they still remained lit.

After some investigation I think I have linked this with the discharge of the 1000uF cap. If I have the power supply - uses a USB-A to barrel cable - in a 'standard' USB adapter connect this to the unit, turn on the power, then turn it off at the socket I see the voltage over the power cap drop down to 0V over maybe 10s. I can then turn the unit back on and the LEDs work as they should.

However, if I use the same adapter but instead of turning it off at the wall I pull the barrel connector from the back of the unit then I see the power cap discharge down to about 0.4V over a few seconds but then take upwards of 10 minutes for that last 0.4V to discharge. If, whilst the cap is in this phase of discharging from 0.4V to 0V I plug the barrel back in, that is when I get the LEDs freezing up.

Now I've located this, this is pretty repeatable. If I pull the barrel and then plug in as described they freeze. However if I turn off at the socket, or pull the barrel and then short ground and +ve on the unit to discharge the cap then it works as well.

Is this a 'known' issue with WS2812?

And then the question would be, is there a way of designing a capacitor discharge circuit in to my project to make sure that when power is removed the cap is always discharged to 0V within a few seconds?

Thanks in advance for your help.

Ok, continued to investigate and it seems like a simple bleeder resistor will do the job.

Using the calculator here - [https://www.digikey.com/en/resources/conversion-calculators/conversion-calculator-capacitor-safety-discharge](http://Ok, continued to investigate and it seems like a simple bleeder resistor will do the job.

Using the calculator here - https://www.digikey.com/en/resources/conversion-calculators/conversion-calculator-capacitor-safety-discharge -) - it would seem a resistor < 1k would mean the capacitor is discharged within 6s which would work fine for me.

I shall breadboard this up and see what happens!

Note sure what the problem was. :cold_sweat:

Clearly, they retain the memory of the last programmed state while there is more than half a volt or so of power - no surprises there.

By "freeze", are you suggesting they did not then respond to your code?

Hi Paul - yes when they were in a 'frozen' state they did not respond to any code; so for example the code might set all 14 LEDs to RED, but what you actually see is 12 of them are off, one is yellow, and one is green.....but if you pull the power and reconnect (without waiting for the cap to discharge) or just do sketch re-upload then they would stay in that same state - 12 off, 1 yellow, 1 green.

I ahven't tried it with the full project, but from my breadboard test, putting a 1k resistor across the cap drops the voltage to zero in just a few seconds and from my testing so far, if the cap is fully discharged when power is applied then there are no issues, so I think this should solve the issue.

I found in another post in one of the forums here a very similar situation someone had; albeit it was an ATTiny that was getting 'stuck' if the input cap wasn't discharged when the power is reapplied. Their fix was the same as this so I think this should solve it :slight_smile:

Cheers,

As a final update to this, I applied the 'fix' - a 1k resistor across the power capacitor - and it works a treat!

As long as I leave a few seconds between powering off and back on again then no issues at all.

So there we have it, if you are making a WS2812 project, consider a bleeder resistor across the power cap to hopefully stop any issues with 'frozen' pixels - use the calculator above rather than just sticking 1k on though!