SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By kirash4
#171559
I have a bit of a unique situation here and hoping someone might have a better idea of what I can do, even if it means going through a hardware redesign. I have LED strips with LPD8806 drivers that are powered directly from a single Li-Ion Power Cell so they can take advantage of the amp burst. They're controlled via several 4.1A Sziklai pairs (PNP/NPN pairs) which in turn are controlled by the MCU. The MCU turns them on or off when needed. The issues I have here are two:

a) the way the software is written, there's a trigger button that actually turns the strips on and starts displaying whatever they're meant to display. When the button is pushed, the MCU first turns on the Sziklai pairs which provide power to the strips, and then it starts sending data to them. When the button is pushed again, it stops sending data, and powers down the Sziklai pairs. However, what I'm noticing is, when I trigger them on again, the strips are coming on with some random data for a brief second before actual data from the MCU starts arriving. This tells me that somewhere, either when they're turned off or when they're turned on, whatever's in the drivers' registers gets horribly mangled and when power is applied again, it just displays whatever it sees. The LED drivers don't actually reset to a known state when power is removed from them. I'm not sure if it's because I'm powering down the Sziklai pairs too fast, or if something else is going on. I'm open to suggestions on what to try.

b) next issue is, because the LED strips are connected directly to the battery and the Sziklai pairs are controlled by the MCU, when the unit's running and power is cut off, the strips will remain turned on because the MCU died before telling the Sziklai pairs to actually power down the strips prior to shutting down. Short from using a DPST switch to forcibly cut power off from the strings, is there a way to do a delayed power off where when I hit the rocker switch, the MCU actually knows to power down the Sziklai pairs first before the whole unit loses power? Or should I be thinking about a different hardware circuit that will also power down the Sziklai pairs when power is cut off?

And before you ask why I did it this way, there are several reasons. The LED drivers will continue to consume a phantom amount of current even when the LEDs are turned off. And since there are 96 of them, that adds up very quickly. So I needed a way to cut off power completely to them while the unit itself might just be sleeping (as opposed to being completely turned off.) The trigger button is there to start or stop a display sequence. When stopped, all the drivers should have power removed, but the MCU continues to run, waiting for the next trigger.

Attached is the Sziklai pairs circuit.
You do not have the required permissions to view the files attached to this post.
By kirash4
#171560
Just thought of something, will a 10K pull-down on the IO pin that's responsible for managing the Sziklai pairs be helpful here? When power is switched off from the entire unit (and the MCU doesn't tell the Sziklai pairs to power down,) will the pull-down take care of that?
By Mee_n_Mac
#171561
kirash4 wrote:Just thought of something, will a 10K pull-down on the IO pin that's responsible for managing the Sziklai pairs be helpful here? When power is switched off from the entire unit (and the MCU doesn't tell the Sziklai pairs to power down,) will the pull-down take care of that?
I would advise you to add that 10k pull-down as I think the MCU I/O pin goes to a tri-state, high impedance state when powered down. That said I think you may want to do more. When you said ...
... when the unit's running and power is cut off, the strips will remain turned on because the MCU died before telling the Sziklai pairs to actually power down the strips prior to shutting down
... it sounds like the power off switch doesn't go to the MCU but to some other circuitry that actually removes all the power. Can you show this circuit ? I don't know if the following will help but let me suggest it anyway. The power on switch needs to directly power on the MCU. Then I would have the MCU command a parallel "switch" (?FET?) to keep power on after the (momentary) power on switch is released. The LED strips get full +Vbatt power only after the MCU has booted, and perhaps has used the phantom power to send an "all off" message down all the strips, and the trigger button has been pushed.

When time comes to power down, a switch (perhaps the same power on momentary) is used to notify the MCU of intent to power off. The MCU sends the "all off" message again and then removes their +Vbatt power via your posted circuit. The MCU then does whatever other housekeeping tasks you may have for it and then commands the aforementioned parallel switch to off, thereby removing it's own power as it's last command.

Now maybe this is more than needed and maybe it there's just no way to cure the LED flash upon power up but I don't think it adds much to your existing circuitry.
By kirash4
#171562
The main power switch cuts off power between the battery and the boost circuitry (which in turn powers the MCU.) Actually, IT'S slightly more than that. The full path is for the MCU is:
battery -> MAX8903 -> power switch -> LM2621 -> MCU

It's done that way so that I can apply power to the MAX8903 and recharge the battery without the whole unit itself needing to be turned on.

And the full path for the LED strips is:
battery -> Sziklai pairs (controlled by the MCU) -> LED strips

That's so they don't consume any current till the MCU turns on the Sziklai pairs.

So when the power switch is thrown, it cuts power to the boost circuit, which in turn shuts off the MCU. If the pull-down gets the job done as far as powering down the Sziklai pairs, that's one hurdle cleared. I didn't even think about that till now. Then I need to figure out why the drivers go haywire when power is cut off from them. It's entirely possible I'm not giving them enough time to latch the 'all off' command. I'll have to test that when I get home this evening.
By kirash4
#171575
One other thing I forgot was to add a flyback diode on the main switch. For voltages no higher than 4.2V, what's a recommended (SMD) part?