# How to design a circuit to disconnect battery charger automatically?

I want to use an AC to DC 14.4v adapter to supply both my circuit and its battery. The circuit works with 12v and I used a battery during power outage(blackout time). I have prepared the below circuit for switching between adapter and battery but I need to recharge the battery when power comes again. Assume the dip switch as main power key.

The main problem is that if I use an op-amp as a comparator for battery voltage level, it will shows the adapter output voltage not battery level. So how can i solve it?

And another problem is: suppose we are in blackout time and battery voltage level decreased to for example 9 volts. How can i disconnect the battery? Is it possible to use a MOSFET transistor something like IRF510 between battery and circuit?

Many thanks.

• “The main problem is that if I use an op-amp as a comparator for battery voltage level, it will shows the adapter output voltage not battery level” ...can you explain more why you think this wont work?measuring the voltage across the battery should be okay. – Navaro Aug 5 '18 at 10:41
• @Navaro Oh really?! Actually i didn't try. I thought it will show source voltage. So if it acts like this, the buck converter input voltage decreases and also we would have another decrease on buck converter output terminal. – M.Hasanpour Aug 5 '18 at 15:32
• I test it. Charger with no load had 14.4v in output terminal. After i connect it to the battery, voltage decreased to 14.16v. I think its naturally, however output current is low (about 0.5A) and its a chip one. I didn't expect this charger more than this :) – M.Hasanpour Aug 6 '18 at 6:12
• did you measure the charger output voltage or thr voltage across the battery. my understanding is that the battery voltage is used as input for the op amp. place a resistor of a 10-100ohm between the charger and battery and measure the voltage across the battery. – Navaro Aug 6 '18 at 11:13
• @Navaro So I should place a 10-100Ohm resistor after D2 and I measure the voltage of battery right after the resistor. Right? Okay I'll test it. Thank you. But Another question. Why engineers are using difficult methods for measuring battery voltage level during charging? For example they disconnect the charger and then they measure it. Or they use Coloumb counting?!!! – M.Hasanpour Aug 7 '18 at 8:31