# Battery level indicator help

#### plasmaninjaa

Joined Nov 16, 2012
5
Hello all! This is my first post.
Let me start by saying I am very very new at circuits so go easy on me haha.

I am using this circuit http://imgur.com/eUil72x
it works perfectly. Basically it fades an led from green to yellow to red as the battery runs out.

However, now I want it to work while charging the battery. So as the battery charges the led goes from red to yellow to green as the battery goes from dead to full charge.

But I have no idea how to get the circuit to read the voltage from the battery and not the power adapter that I am using to charge the battery!

#### MrChips

Joined Oct 2, 2009
23,308
Use a duplicate of the same circuit but adjust the thresholds to 13.8V and 14.4V.

#### plasmaninjaa

Joined Nov 16, 2012
5
Use a duplicate of the same circuit but adjust the thresholds to 13.8V and 14.4V.
could you explain a little more? How will this measure the voltage of the battery as it charges?

Your saying I need 2 of each component? or is there a way to simplify that.
Believe it or not, this is for an invention of mine which I am currently prototyping and I am hoping to sell, so I need it to be professional but cheap!

#### MrChips

Joined Oct 2, 2009
23,308
Hopefully if your charger is current limited the battery voltage will creep up as it is being charged.

You can use the same circuit but switch to different thresholds when charging and discharging.

Or put a single voltage monitor across the battery.

#### plasmaninjaa

Joined Nov 16, 2012
5
Hopefully if your charger is current limited the battery voltage will creep up as it is being charged.

You can use the same circuit but switch to different thresholds when charging and discharging.

Or put a single voltage monitor across the battery.
I'm still not sure I understand. I'll test out what you mean though

#### MrChips

Joined Oct 2, 2009
23,308
What is the size (capacity) or model number of your battery?
What is the max current and voltage output of your charger?

#### plasmaninjaa

Joined Nov 16, 2012
5
What is the size (capacity) or model number of your battery?
What is the max current and voltage output of your charger?
the battery is 11.1v 1600mah li-ion
the charger is 12v 1a

#### wayneh

Joined Sep 9, 2010
17,152
You could set up a second voltage reference and switch to that while charging. This would add very little to your existing circuit.

You could even use a quad comparator LM339 instead of that op-amp (which is configured as 2 comparators), and then use another of the 4 comparators on that IC to detect charging, and then switch the reference voltage for you.

#### plasmaninjaa

Joined Nov 16, 2012
5
You could set up a second voltage reference and switch to that while charging. This would add very little to your existing circuit.

You could even use a quad comparator LM339 instead of that op-amp (which is configured as 2 comparators), and then use another of the 4 comparators on that IC to detect charging, and then switch the reference voltage for you.
ok so your saying that the voltage taken from the charger and battery in parallel will rise as the battery charges? This makes a little more sense.
How would I go about switching?

#### wayneh

Joined Sep 9, 2010
17,152
Your current circuit uses the 5V regulator to provide the reference voltage.

A manual switch would be very simple. You could switch between 2 resistors to complete the existing voltage dividers that provide a measure of battery voltage to the 2 comparators. Flipping the switch would move the two set points.

You could instead add a voltage divider off the 5V reference, and then use a switch to choose between 5V and a lesser value from the divider. Personally, I think that's what I would do.

I'm sure there's a clever way to automatically switch from one to another with a comparator, but it's eluding me at the moment. It'll come. Hopefully someone else will come along with it first.