How to deal with dying battery?
Clint
Posts: 95
Is there a way to detect a dying battery with the SX?
I am running a circuit with the SX that operates on 4-AA batteries.·I would like to be able to do something in my program prior to a brown out·reset·to indicate to the user that the batteries are dying. What can I do?
I am running a circuit with the SX that operates on 4-AA batteries.·I would like to be able to do something in my program prior to a brown out·reset·to indicate to the user that the batteries are dying. What can I do?
Comments
-Phil
-Phil
Yes you're right my circuit has a 5v regulator. Everything goes through the regulator. The problem is if I dip below about 4volts (Vdd, after the regulator) the circuit starts to misbehave.
I don't understand your original suggestion:
Even if my battery voltage dipped below 5volts, the voltage after the regulator (Vdd) would always be less than the voltage before the regulator (Vbatt), wouldn't it? Is there something I'm not understanding about your suggestion that would let this tell me when Vbatt·is too·low?
Post Edited (Clint) : 5/2/2009 6:15:56 AM GMT
-Phil
Something that twigged me a while ago from what BEAN said...... the TTL levels in the SX are 1.4 volts regardless of the supply voltage. Therefore I believe one could use that fact as a reference (perhaps not too precise) and simply have a voltage divider from the battery to ground, and the tap to a TTL level input on the SX. Nothing further required, not even the comparator, just two resistors.
If that works, then to make it even better, do not ground the bottom end of the divider, but connect it to a low level·SX output instead to effect the ground. Now, under software control.·you can switch that output to an input and effectively disconnect the circuit, preventing battery drain through the divider. Then under software control, every once in a while, effect the output condition again, take a reading, and switch it off again.
Pretty neat if that all works.
I have not tried this, but it sounds like a pausible solution.
Cheers,
Peter (pjv)
Post Edited (pjv) : 5/2/2009 6:33:50 PM GMT
-Phil
As an example, if I wanted the input to go logic "low" when Vdd is below 4 volts, I could use the following circuit and resistor values:
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
*EDIT* I see in the SX/B Online Help that when configured for TTL, the input threshold is indeed 1.4volts. Do I need to configure anything using an SX28 or are inputs automatically TTL when I used the "INPUT" command?
I will try this out on my development board and see how well it works.
Post Edited (Clint) : 5/14/2009 12:51:20 AM GMT
-Phil
· The default threshold is TTL (or 1.4V). If you want to make the input CMOS (1/2 Vdd) then add do it like so:
[noparse][[/noparse]edit] Of course for your purpose you would want TTL mode NOT CMOS mode.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
Post Edited (Bean (Hitt Consulting)) : 5/14/2009 4:40:47 PM GMT
No, Terry..... I think CMOS defeats the concept because its switching threshold is half of the supply, rather than a fixed voltage. It is a fixed voltage that is required to be able to infer the supply (battery) voltage. Of course, if there is a regulator involved, then many options become available.
Cheers.
Peter (pjv)
Oh yeah. I was just showing HOW you would specify cmos mode if you wanted it.
Sorry for the confusion.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
Thanks for the help. I'll report back after I try it out.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
Another thing I've noticed is that if the board is completely unpowered and I measure the resistance across R1·OR the resistance across·R2, they both show about 33kohms·on the voltmeter even though they were definitely 51k and 100k resistors (measured before·soldering onto·the board). This makes me think the SX chip is allowing a path to Vss or Vdd or both.
Furthermore, with this circuit connected and powered, I get an intermittant low signal on the pin (RB#) even with a steady good voltage from a battery source. I think I know this because if I have a simple program which sets an output high for an LED when the pin RB# goes low, the LED will flicker. If I use any sort of logic in my program that latches based on input pin RB# going low,·it will latch. I put a voltmeter from Vss to the pin RB# and it shows a steady voltage above the 1.4v logic threshold, but perhaps I would need an oscilloscope to see if it's actually going below the threshold intermittently or if the voltage isn't the culprit.
Post Edited (Clint) : 1/15/2010 11:13:43 PM GMT
I haven't measured the current through the resistors, but I will do that.