Circuit to detect how many batteries I have

summersab

Joined Apr 8, 2010
146
Alright, so, my background is more mechanical engineering and computer science in nature, and it's been quite a long time since I've done anything EE related. So, know that I know the basics, but beyond that, I'm pretty rough, here.

I guessthat the easiest way to do this is to write out the logic in pseudocode (that's the CS major in me). Suppose I have a bunch of AA batteries, and based on how many there are, I want to direct the output to a different circuit. Assuming a AA battery is 1.5V:

if (Vin <= 1.5V)
Vin >> circuit1
if (1.5V < Vin <= 3V)
Vin >> circuit2
if (3V < Vin <= 4.5V)
Vin >> circuit3

And so on. So, if I put in one battery, the voltage is directed to a circuit that, say, lights a bulb. If I put in two batteries, a second bulb (and only the second bulb) lights up. If I put in three batteries, a third bulb (and only the third bulb) lights.

Assume I don't know the resistance of the circuits; all I know is Vin, and I want to switch between circuits based on these thresholds. Is this possible?

tshuck

Joined Oct 18, 2012
3,534
Using some relays/transistors could get this going, though you will run into a problem in that a battery's voltage will not always be 1.5V, effectively hosing anything you do...

You could, run a supervisory circuit, which would use fixed voltage references and enable/disable devices according to voltage ranges that would coincide with the ranges you'd expect from these batteries...

JohnInTX

Joined Jun 26, 2012
4,240
This will do it

LM3914 LED Bar/Graph generator. Scale the input with a voltage divider.. Use the DOT mode.

summersab

Joined Apr 8, 2010
146
Beautiful!

wayneh

Joined Sep 9, 2010
16,399
It is beautiful, but won't save you from the inherent problem of trying to count batteries based on their combined voltage. 4 cells run down to 1.2V each will still look a lot like 3 fresh cells at 1.5V each. If all you really care about IS the combined voltage, then you're good to go.

You could also just dedicate a cheap multimeter to the chore. They're cheaper than the parts you'll need to build your LM3914 circuit. No pretty lights though.