Battery full indicator using opamp

Audioguru again

Joined Oct 21, 2019
6,826
The diode that is used as a voltage reference is actually a thermometer since its forward voltage changes when the temperature changes.
I wonder why the opamp and diodes have no very important part numbers.
I wonder why the supply voltage is not shown.
 

MisterBill2

Joined Jan 23, 2018
27,522
OK, now I can see it. If the diode serving as a reference for the inverting input isa zener diode it is backward, it it is an ordinary diode the reference is not high enough, AND the forward drop of a regular diode does change a bit with the current. If that resistor is 5.6K ohms and the Vcc is 12 volts then the current is about 2mA, and that is not on the straight part of the curve yet. And if it is 506K, even worse. If the Vcc is the voltage being monitored, no, it will not be nearly stable enough to be useful.
 

Thread Starter

ProfessorEmeritus

Joined Mar 9, 2020
8
OK, now I can see it. If the diode serving as a reference for the inverting input isa zener diode it is backward, it it is an ordinary diode the reference is not high enough, AND the forward drop of a regular diode does change a bit with the current. If that resistor is 5.6K ohms and the Vcc is 12 volts then the current is about 2mA, and that is not on the straight part of the curve yet. And if it is 506K, even worse. If the Vcc is the voltage being monitored, no, it will not be nearly stable enough to be useful.
Not zener, it is 1N4007. The VCC is 5V and the battery is a Li-ion
 

Thread Starter

ProfessorEmeritus

Joined Mar 9, 2020
8
The diode that is used as a voltage reference is actually a thermometer since its forward voltage changes when the temperature changes.
I wonder why the opamp and diodes have no very important part numbers.
I wonder why the supply voltage is not shown.
The diode
The diode that is used as a voltage reference is actually a thermometer since its forward voltage changes when the temperature changes.
I wonder why the opamp and diodes have no very important part numbers.
I wonder why the supply voltage is not shown.
The diode is 1N4007 and the opamp is LM358. Vcc is 5V.
 

Dodgydave

Joined Jun 22, 2012
11,395
If he's an 'Emeritus' then he's Retired !!

Your Hysteresis resistor is too high try 100K, also use a Zener diode for the reference like 1.2V, or better still just use a TL431 Zener , like post#24 @crutschow
 
Last edited:

Thread Starter

ProfessorEmeritus

Joined Mar 9, 2020
8
If he's an 'Emeritus' then he's Retired !!

Your Hysteresis resistor is too high try 100K, also use a Zener diode for the reference like 1.2V, or better still just use a TL431 Zener , like post#24 @crutschow
Not too high. The lower the resistor, the higher the hysteresis factor. I have experimented with 1k, 10k, 100K and 250K before i finally settled with 1M.

That 1M just keeps the LED steady and holds it in that state once the UTP is reached until you remove the charger and that is what I want.

Lower values will increase the bandwidth and shift the UTP and LTP considerably.
 

MrAl

Joined Jun 17, 2014
13,704
Try adding R and two C's as shown.
There will always be some anti-hysteresis with this kind of circuit unless you use a reference source for both the pot and the reference itself. Before you do that you will always be dealing with a somewhat variable hysteresis that varies depending on the battery SOC which is hard to predict.
So in addition to the one R and two C's shown you might need to use a voltage reference to keep both the pot voltage constant as well as the "diode" voltage constant, but then you dont need the diode.

Remember the hardest thing to do in electronics is to light a light bulb :)


BattGauge_20200421_080247.jpg
 
Last edited:

Thread Starter

ProfessorEmeritus

Joined Mar 9, 2020
8
Try adding R and two C's as shown.
There will always be some anti-hysteresis with this kind of circuit unless you use a reference source for both the pot and the reference itself. Before you do that you will always be dealing with a somewhat variable hysteresis that varies depending on the battery SOC which is hard to predict.
So in addition to the one R and two C's shown you might need to use a voltage reference to keep both the pot voltage constant as well as the "diode" voltage constant, but then you dont need the diode.

Remember the hardest thing to do in electronics is to light a light bulb :)


View attachment 204962
Do you think a zener diode will perform better in the place of that 1N4007 as a voltage reference?.. Although i measured the voltage across it and it appears stable.
 

crutschow

Joined Mar 14, 2008
38,508
Do you think a zener diode will perform better in the place of that 1N4007 as a voltage reference?.. Although i measured the voltage across it and it appears stable.
The diode voltage sensitive (≈2mV/°C) and will also vary with the current.
Thus as the battery voltage goes up so will the opamp reference voltage.
 

MrAl

Joined Jun 17, 2014
13,704
Do you think a zener diode will perform better in the place of that 1N4007 as a voltage reference?.. Although i measured the voltage across it and it appears stable.
That sounds very good, but the change in voltage may be hard to detect with a voltmeter unless you do it carefully with a digital meter. If you think it is stable DC wise, then it very well could be but the capacitor will help eliminate any AC interference which would cause an unstable op amp output.
The other cap across the pot arm is almost mandatory. The resistor isolates the pot arm from the feedback hysteresis resistor so that the hysteresis changes less with the pot setting, and also allows the cap to be placed from the pot arm to ground to help reduce interference.

I also mentioned the unavoidable anti hysteresis inherent in this circuit and circuits like it. The LED on the output draws current from the power supply and if the power supply (which i guess is a battery here) pulls down slightly (as it definitely will unless it was well regulated) that pulls the non inverting terminal of the op amp down and that is the opposite of what we want to happen for the hysteresis. That means more hysteresis is required than usual. The only problem is the amount the battery supply is pulled down depends highly on the state of the battery so you could see perfect stability one day and the next day it's jumping all over the place. The way to avoid this is to use a voltage reference for the pot as well. What you could try doing if you dont want to install a regular voltage reference IC is you could place a diode across the POT too, with an added resistor from the top of the pot to the battery supply rail. That might be enough, and if you can rig it such that the resistance seen by the diode is the same as the resistance seen by the other diode, then both terminals will see the same increase or decrease meaning the effect cancels out. But the added diode and resistor may take care of the stability problem.

Just to note, the LM358 does function as a comparator i've used it at low frequency 60Hz.
The advantage is you dont need an output pullup resistor. The other advantage is if you are using on half of the package for an actual op amp you dont want to add a comparator so you use the other half for the comparator and that is how i used it.
 

MrChips

Joined Oct 2, 2009
34,814
How about a resistor, LED, and zener diode?
Besides being simple, it has the added advantage that it gives a soft turn on, i.e. the LED brightness is an indication of the level of charge.
 

Audioguru again

Joined Oct 21, 2019
6,826
He said the Vcc is 5V and the battery is Lithium-ion so it must be 1 cell.
He does not know that a Lithium-ion battery cell voltage is at its max of 4.20V long before it is fully charged. It is the charging current dropping that signals a battery charger IC that the battery cell is fully charged and to stop charging it..
 
Top