switching off 8 Neopixels via extra hardware?

Hi everyone,

I am looking for a solution to switch off Neopixels via hardware and not via the software library.
The reason is that I am using the Scheduler library where one loop controls the Neopixels and the other loop decides to switch them off or not. Normally this would not be a problem but my Neopixel loop has lots of delays who are difficult to remove. And I want to switch the Neopixels off immediately and not after a long delay.
Therefor I have used a PN2222A transistor but there seems to be some current leaking because when I set the Base low the Neopixels glow red.
Is there any other cheap, easy way with small parts to make some kind of switch that I can control via a digital Pin?

Kind regards
tom

(deleted)

but my Neopixel loop has lots of delays who are difficult to remove.

Bite the bullet and get rid of the delay()s. You know it's the right thing to do.

You want to take 8 of the most finely-engineered and controllable devices ever made and just cut the power to them?

Fix the software. The hardware is fine.

If you need help with the code, post the code here.

Thank you all very much for your replies!
I am not a huge fan of delays and always try to code without them :slight_smile:

I am building my project on top of this code:

The best solution for me seemed to be cutting off the power. I stopped my effort to remove the delays because of the difficulty.
What do you think?

Edit: I have just seen that someone posted the code without any blocking delays on the Github site of this project. I think will continue my project with it :slight_smile:

I post Neopixel code without blocking delays here all the time.

You can use a commutable delay instead of the regular type. That is one that returns when the time is up OR some pin is low, so when you switch that pin low you zip right up to the top level, see that the pin is low and do the turning off thing.

Hi,
You will need to High Side Switch the LEDs.

Are the LEDs in the middle or start of a string?
If you disconnect power from the LEDs they will hten not pass control signal on to any down stream LEDs that you may still want to control.

Tom.... :slight_smile: