Metering a battery on request...

I am currently developing a circuit to meter liquid level among a few other things and it will have a backup 9v Battery. I want to be able to meter the battery using an analog pin, but I do not want to connect it directly through a voltage divider as this may represent a constant draw on the battery(am I wrong about this?). So I developed the circuit below.

Sig In represents a digital pin being set high, and Sig Out represents 1/2 of the 9v battery’s current voltage. I used the 47K resistors as they are already on my parts list and they seemed sufficient.

Anyone out there notice any glaring issues here, or have anything they could add? I’m looking to have PCBs made soon and this is one of the last things I need to work out.

Anyone out there notice any glaring issues here,

Yep, it will not work. The voltage on the emitter will only ever be the value of the voltage on the base minus 0.7V. You need a PNP transistor as a top switch and another NPN transistor to drive that.

I know very little about transistor switching so I have nothing to add on that score.

However, how do you plan to bring the backup battery into service when the main supply fails? In that case the switching power will have to come from the backup battery (because the other supply won't be available. Won't that system represent a drain on the backup battery?

You will also need to consider whether measuring the battery voltage tells you very much about the condition of the battery. Usually batteries need to be tested under load.

I would use a rechargeable backup battery which is normally a full part of the circuit and being trickle charged by the supply. That way it steps in without any switches or glitches if the supply fails - and there is probably no need to read the battery voltage.

You could build a battery test routine into your code that would isolate the backup from the supply, put a load on it and measure the voltage. But I would need to think hard before concluding that all that trouble improves reliability.

...R

there should be no current draw (except for a small amount)

So drop the transistor (just do a voltage divider and feed it directly into an analog pin) and take your results when you wish, no point wasting a pin to switch on a transistor that's not needed to begin with..... tie the grounds and take a reading...

If the OP wants to switch the divider then use this circuit.

Mike, you forgot the resistor between Q1 collector and Q2 base, to limit Q1 collector current to a safe and sensible value.

pguerra75, the simplest solution is to use a very high resistance voltage divider, permanently connected to the battery. One of my designs runs from a 9V battery and doesn’t have an on/off switch, because it puts the mcu and other chips into sleep mode when it is off. To monitor the battery voltage, I use a voltage divider comprising two 4.7Mohm resistors. This drains 1uA from the battery, which (using a standard 600mAh alkaline 9V battery) gives a theoretical battery life of 600000 hours, which is 68 years - in other words, much longer than the shelf life of the battery.

Using such a high value potential divider introduces a small error, in theory around 2% because the input resistance of the ADC is quoted as 100 Mohms typical. For me, a 2% error in the battery voltage reading was acceptable. If you will be reading other analog pins as well, you need to do something to prevent crosstalk from the other inputs to the high resistance input. One simple solution is to connect a 0.01uF capacitor between the analog input pin and ground.

Mike, you forgot the resistor between Q1 collector and Q2 base, to limit Q1 collector current to a safe and sensible value.

Yes you are right. i just did an internet search for images and grabbed the first one I saw, thanks.

Thanks to everyone for their responses.

dc42, I am not using any other analog pins, or at least not as analog pins so crosstalk should not be any issue. I have decided to order a few proto-boards and I will be using your solution on a couple of them and I will also be using mikes approach on a couple as well. I will stress test them and will take the simpler route provided no other problems arise.

However, how do you plan to bring the backup battery into service when the main supply fails? In that case the switching power will have to come from the backup battery (because the other supply won't be available. Won't that system represent a drain on the backup battery?

No, I have the battery and the line power connected through low recovery time schottky diodes, when the higher voltage from the line is present it disconnects the battery(metering circuit will be before the diode so it can be metered even will on line power). The diode on the line side is to keep the battery from being drained by things outside the system.

Thanks again to everyone!!