Go Down

Topic: Low power shutdown/failure/t'is quittin' time ... (Read 3175 times) previous topic - next topic

Jack Christensen

Without knowing the exact regulator, would something like this work? No switch. The pullup resistor keeps the regulator enabled until the MCU drives the pin connected to the transistor high. GPIO pins are inputs at reset time, so until the pin is configured as an output and driven high, the regulator stays enabled. When the MCU decides it's quittin' time, it drives its control pin high and goes to sleep.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

KirAsh4

It's the MIC5205 regulator.  Its ENable pin needs to be driven HIGH to enable it, or LOW to shut it off.

Jack Christensen


It's the MIC5205 regulator.  Its ENable pin needs to be driven HIGH to enable it, or LOW to shut it off.


Yep, I might try that circuit then. I also see the dropout voltage is 165mV at the max current output of 150mA, so not bad.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

KirAsh4

Where I'm uncertain is when you say the MCU drives its pin high when it quits.  When the MCU quits, it shuts down, doesn't drive anything high ... they just go bye-bye.

Jack Christensen

Oh wait, maybe I'm going in circles here.  Hmmm...
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

KirAsh4

Maaaybe, though I prefer ellipses.  Anyway, the MIC5205 needs its ENable pin high to function, which is why if it's not used, it's always tied to Vin.  So, if I'm to use the controller to keep it high, I need to wait for the controller to come up, for the sketch to kick in, configure a pin as OUTPUT and then drive it HIGH.  When the controller reaches its brownout, or if for some reason there's an ant sitting cross legged on an exposed trace, sucking the juice, it will simply die and everything on the controller goes byebye, taking the pin low and thus shutting off the regulator - this is what I want to happen. And it needs to stay off and not turn itself back on after the batteries have regenerated just enough juice to turn things on again, even for a brief second.

That's why I thought up the idea of using a momentary push button to kick start things ... once running and I let go of the button, the only thing keeping the regulator alive is the controller itself.

KirAsh4

By the way, I have one shot at this.  I received my first set of test boards today, which I know already have issues, but, being that they're test boards, I can muck with them.  But since it takes so long to push things through BatchPCB, I have one shot at getting these done by the end of the month.  That includes building about 300 tiny little PCBs. :/

So yeah, I'd like to get this right, or as good as can be.  Not expecting perfection here ...

Jack Christensen

The transistor basically inverts the signal from the MCU. In the absence of any input from the MCU, the pullup resistor pulls the ENable pin high on the regulator to keep it on. When the MCU drives the base on the transistor high, it pulls the regulator ENable pin down to near ground, turning the regulator off. BUT, if there is not time (and I wouldn't bet there is) for the MCU to then get into power-down mode, then it'll just reset, the pin driving the transistor will be an input after reset, allowing the pullup resistor to once again enable the regulator. Catch-22. Have to drive the pin to the transistor high, then go into sleep mode, but driving the transistor high cuts the juice.

But it's too late and I'm brain dead... :~

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Jack Christensen

Nick suggested earlier a MOSFET which controls the power to the LEDs. Probably a better approach than fiddling with the regulator enable.  G'nite.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

KirAsh4

Yep, I think the options offered here were a voltage divider and measure it with a pin. (ManiacBug)
MOSFET driving the LED string (Nick Gammon)
The equivalent of a LiPo protection circuit (WizenedEE)
If I do a switch, I could possibly isolate the pin from Vbat with a high-side FET (Graynomad)

And I don't know if having a switch with diodes on the two lines would work ... can't wrap my feeble brain around it.

Alright, decision time.  I'm going to sleep on it and come back to it tomorrow.  Thanks for all the suggestions.

KirAsh4

Ok, I'm back after thoroughly sleeping off the effects of too much wine ...  In the mean time, I received another suggestion and I decided to dive into that and see if I can figure it out.  It's all about experimenting, right?

Anyway, the suggestion was to use a switching FET to turn the regulator on/off.  So I came up with the schematic below.  By the default, the regulator must remain off.  When the MCU's pin goes HIGH, it closes the gate and Vbat flows into the ENable pin for the regulator and turning it on.

The way this ought to work is:

  • By default the regulator is off, Vbat is +6V.

  • Pressing the momentary switch will feed Vbat directly into the regulator's ENable pin, turning it on (this is fine, it can handle up to +17V)

  • With the regulator now on, it feeds power to the rest of the circuit, including the MCU.

  • MCU starts up, and brings its pin connected to the FET's gate to HIGH.

  • FET sees this and closes the gate, enabling Vbat to flow through the FET on to the regulator's ENable pin

  • When I see the MCU operational (it has a blinky LED), I can then let go of the momentary switch and all remains running.

  • When Vbat drops past the MCU's operating threshold, it shuts off, taking it's one pin LOW.

  • FET's gate goes down, opening and thus cutting power to the regulator (and thus also the rest of the circuit).



Yes?  (this is one of those moments where in my head I'm going 'please oh please oh please tell me I got it right and didn't screw up horribly')  :)

If that's all fine, I have three questions:
a) Is what I came up with actually correct for how the FET works?
b) How do I calculate the value of R3?  Again, keep in mind the gate should be open except when the MCU pin tells it to close.
c) Does this mean I can now safely put a momentary switch across Vbat and the ENable pin of the regulator to kick-start it?

KirAsh4

Nevermind, I think I have that backwards ... back to studying.

Graynomad

I don't think you can use an N-ch FET like this. When the MCU switches it on the source voltage will rise to > than the gate voltage. I'm not sure what this will do but it doesn't sound right.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

KirAsh4

Yeah, I caught on to that. I think I need a second "stage" FET to reverse the logic ...  Still learning.

Graynomad

Yep, use a p-ch to do the high-side switching and an n-ch (or npn) to switch the p-ch.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Go Up