Monitoring battery voltage in battery operated device (a simpler solution?)

Thread Starter

dcbingaman

Joined Jun 30, 2021
470
I have a PIC32MX with one channel set as analog input ADC (0-3.3V range) to monitor the battery voltage that varies from 9V to 6V.
The requirements are:
1. When not taking a measurement current used by circuit is less than 1uA.
2. The analog input to the PIC must not exceed 3.3V or it could damage the PIC.
3. It is only allowed to draw more current when actually taking a measurement.

The following circuit does accomplish the goal. It has high input impedance when Q2 and Q1 are off. The microcontroller provides 3.3V LVTTL signal to Q2 to turn on the circuit during a measurement and turn it back off when not measuring it.

The circuit will work, but I don't like the fact that is takes so many components. Can anyone provide a simplified schematic that achieves the same goals?

BAT+ (POSITIVE INPUT FROM BATTERY 9 to 6V)
BAT- (NEGATIVE INPUT FROM BATTERY IS TIED TO GND.
BATTERY_MON_TO_PIC_ADC - (To microcontroller Analog input pin, must stay between 0 and 3.3V)
POWER_SAVING_OFF_ON - Normally logic low (0V) circuit is off and power consumption from circuit is minimized). Logic 1: circuit is on both Q1 and Q2 and ready for an ADC conversion.

Purpose of Q1: (When the circuit is off, keep the voltage to the ADC less than 3.3V.
Purpose of Q2: Turn off the voltage divider to minimize power consumption when not taking and ADC measurement.

Thanks for any advice on reducing the parts count for this.


BatteryMonitor.PNG
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
470
BTY: I plan on reducing C1. At this moment it takes way to long to charge or discharge for a measurement from 10uF to 0.1uF.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
470
Ran this in LTSpice. Bad news is it appears the output still exceeds 3.3V at the output when off due to transistor leakage currents.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
470
Had to redesign, this works much better. Still a lot of components required:

Why are you switching the bottom side of R7?

Connect R7 to ground.
Use Q2 to drive the base of Q1 through R8 only.
R5 is not needed

If leakage is a problem, try adding a 100kΩ resistor between the base and emitter of Q1.
Thanks, I did make those changes. See updated schematic. This works in LTSpice with very low leakage current.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
470
I thought I had uploaded the latest with changes, here is the latest with changes. This works in LTSpice. Would be nice to reduce the parts count. Crutschow is right, I am making it more complicated than it needs to be:


BatteryMonitorImproved.PNG
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
470
Why are you switching the bottom side of R7?

Connect R7 to ground.
Use Q2 to drive the base of Q1 through R8 only.
R5 is not needed

If leakage is a problem, try adding a 100kΩ resistor between the base and emitter of Q1.
I had to register for Electro Tech Online. I like your circuit articles. Good stuff!
 

Irving

Joined Jan 30, 2016
2,189
Here's a mosfet based circuit. Not simpler but can use less power than a BJT version.
The mosfets are in a 6-pin complimentary package.

View attachment 245314
That's exactly what I was going to draw up except I omitted R4 as in my experience I've yet to see a MOSFET randomly turn on due to some unexplained charge build up before the MCU has configured the gpio output. I always leave the pads there 'just in case' :)
I also omitted C1. If this circuit was to be followed by other hardware such as a comparator then it would have value but here it's not needed. Natural oversampling and averaging in software will achieve the same result, so down to 4 parts.
 

Irving

Joined Jan 30, 2016
2,189
But there's a simpler solution still which may fit the bill; as always there are trade-offs. If absolute lowest BOM costs are #1 priority then two resistors are all that are necessary.

The fallacy in the original argument was that the MCU will die a horrible death if exposed to voltages above 3.3v; in reality it won't.

The input on most modern MCUs are protected by intrinsic clamping diodes to the supply rails hence the Vdd+0.3v, Vss-0.3v specs. Indeed, manufacturers have to work very hard to get rid of them for specialist inputs! What kills chips with overvoltage on the inputs is localised heating due to unconstrained input current. Limit the current and the input is safe. So in this instance the thevenin equivalent of the 22k/10k combo is 2.9v in series with 6.9k. If the MCU is powered down that represents a current of 0.4mA which is probably OK, but we can do better. So let's increase the resistors by a factor of 100 to 2M2 and 1M respectively. Then the current flow is only 4uA when the MCU is powered down and <3uA drain on battery when powered up. There are 2 other side effects, one is the voltage error due to MCU input leakage (usually picoAmps) and the other is the slower read time due to the RC time constant and of the apparent input resistance and the ADC sample/hold capacitor (typically 15 -20pF). For a good reading you need to wait approx 5 - 6 RC time constants between reads or ADC mux changes to allow any changes to settle. That's approximately every 55uS.
 

eetech00

Joined Jun 8, 2013
2,608
Looks to me that circuit uses exactly the same power as the BJT version (two 100kΩ resistors).
Well..could be less. There's practically no current flow from the I/O ports thru the gates.
The divider resistances could also be increased to reduce current if desired. The pull-up and pull-dn resistors could also be increased.

I left the values as they were because I was lazy...:D
 
Last edited:

eetech00

Joined Jun 8, 2013
2,608
That's exactly what I was going to draw up except I omitted R4 as in my experience I've yet to see a MOSFET randomly turn on due to some unexplained charge build up before the MCU has configured the gpio output. I always leave the pads there 'just in case' :)
Yes....could be optional if source/sink I/O.

I also omitted C1. If this circuit was to be followed by other hardware such as a comparator then it would have value but here it's not needed. Natural oversampling and averaging in software will achieve the same result, so down to 4 parts.
I would leave that in to help keep the voltage stable. But it may turn out to be optional after testing.
 

Irving

Joined Jan 30, 2016
2,189
I would leave that in to help keep the voltage stable. But it may turn out to be optional after testing.
All that is doing is providing a low pass filter with a -3dB point around 230Hz; not sure what you mean by stability, without reference to the voltage source fluctuations. Since this circuit is looking at long-term battery volts eg SoC, it has little value IMHO.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
470
To paraphrase Einstein, I like to make things as simple as possible, but no simpler.

And on that subject, what is the purpose of D2?
I would think that could be deleted.
Simply increase the turn on voltage from approx 0.6 to 1.2V. True, I could probably get rid of it. Being driven by LVCMOS so when low it is pretty close to ground.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
470
But there's a simpler solution still which may fit the bill; as always there are trade-offs. If absolute lowest BOM costs are #1 priority then two resistors are all that are necessary.

The fallacy in the original argument was that the MCU will die a horrible death if exposed to voltages above 3.3v; in reality it won't.

The input on most modern MCUs are protected by intrinsic clamping diodes to the supply rails hence the Vdd+0.3v, Vss-0.3v specs. Indeed, manufacturers have to work very hard to get rid of them for specialist inputs! What kills chips with overvoltage on the inputs is localised heating due to unconstrained input current. Limit the current and the input is safe. So in this instance the thevenin equivalent of the 22k/10k combo is 2.9v in series with 6.9k. If the MCU is powered down that represents a current of 0.4mA which is probably OK, but we can do better. So let's increase the resistors by a factor of 100 to 2M2 and 1M respectively. Then the current flow is only 4uA when the MCU is powered down and <3uA drain on battery when powered up. There are 2 other side effects, one is the voltage error due to MCU input leakage (usually picoAmps) and the other is the slower read time due to the RC time constant and of the apparent input resistance and the ADC sample/hold capacitor (typically 15 -20pF). For a good reading you need to wait approx 5 - 6 RC time constants between reads or ADC mux changes to allow any changes to settle. That's approximately every 55uS.
Thanks! I may experiment around with larger resistor values. The PCB will be using 0805 SMD parts, I could easily increase resistance's. The only reason I use 0805 is to make soldering them easier. I will purchase larger values to experiment with.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
470
That's exactly what I was going to draw up except I omitted R4 as in my experience I've yet to see a MOSFET randomly turn on due to some unexplained charge build up before the MCU has configured the gpio output. I always leave the pads there 'just in case' :)
I also omitted C1. If this circuit was to be followed by other hardware such as a comparator then it would have value but here it's not needed. Natural oversampling and averaging in software will achieve the same result, so down to 4 parts.
The datasheet shows the leakage current for the MOSFET to be a max of 1uA. The datasheet for the chosen BJT's have an leakage current specification of 15nA at 25C. Increases to 5uA at 150C but I don't plan to ever have them reach that temperature. This device will be used in a battery operated outdoor temperature logger that logs the temperature every minute and allows for download to a PC via wireless UART. I appreciate the alternate circuit possibility.
 
Top