Table of Contents
Battery Voltage Monitoring, Project Description:
Battery Voltage Monitor- In this tutorial, you will learn how to display the percentage of charge available in the battery using LEDs. In this tutorial, we not going to use any Microcontroller. This battery voltage monitor is entirely based on the LM339 voltage comparator IC. This tutorial explains the complete designing steps.
In this tutorial, you will also learn how to use a voltage comparator LM339, its basic working principle, How to set the trigger voltages to show the exact charge percentage, and then how to make a final circuit. The same circuit will also be used in making a stabilizer which I will show you in upcoming tutorials.
For advanced level battery voltage monitoring systems check the related projects section given at the end of this article.
Let’s get started.
Other Tools and Components:
Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!
Charge Vs Voltage Table:
I searched for a random battery and downloaded its charge Vs Voltage table. As you can see in the table, at different voltages we have different charge percentage. As we will be using lm339 voltage comparator which has 4 outputs, it means we can connect 4 led’s or relays. If you want to display all the 11 levels then you will have to use three lm339 comparator ic’s. But I will use one IC to display 4 levels,
As I said earlier this tutorial mainly focuses on the designing steps, so before I explain the complete circuit diagram first I would like to explain the LM339 voltage comparator IC.
LM339 Voltage Comparator IC:
It’s a good designing practice to download the datasheets of the electronic components that you are going to use. I always do the same thing. This helps me in understanding the electronic components Pinout, electrical characteristics and so many other things. So first of all, let’s start with the datasheet of the LM339 voltage comparator. You can download the following pdf file.
Download LM339 datasheet: LM339-D
Make sure you download the datasheet so that you can follow all the steps, or if you want the circuit only, then you can jump to the circuit diagram. But remember, downloading the circuit diagram or making the circuit without the designing steps will never help you learn electronics. So if you really want to learn the designing then follow this article and do exactly the same things.
LM339 Voltage Comparator Features:
This voltage comparator can be powered up using 3 to 36 volts. So it really doesn’t matter if you use a 5v power supply or 12v power supply. You have a wide range of voltages that you can use. But make sure the voltage does not exceed 36 volts. The next step is to check the Pinout.
LM339 Voltage Comparator Pinout:
Pin number1 is the ouput2
Pin number2 is the output1
Pin number 3 is the VCC, which will be connected with the supply voltage, In my case, I will be using 12 volts.
Pin number 4 is the inverting input1
Pin number5 is the non-inverting input 1 and so on; all the pins are clearly labeled.
As you can see clearly LM339 has 4 comparators, labeled as 1, 2, 3, and 4.
The output of the comparator number1 is available on pin number 2.
The output of the comparator number 2 is available on pin number1.
The output of the comparator number3 is available on pin number 14 and
The output of the comparator number4 is available on pin number13.
While the supply ground will be connected with pin number 12 and 12v wire will be connected with pin number 3.
LM339 is a voltage comparator IC which has 4 inbuilt comparators. There are so many other voltage comparators but the basic working principle remains the same. A comparator is a very simple circuit and is used to interface or make a bridge between the analog and digital Worlds. Each comparator is capable of comparing two voltage levels and gives a digital output to indicate the larger one. If you look at the comparator symbol above you will find that the two inputs are labeled with + and – signs which are also denoted by “V-“ and “V+”. V- is the inverting input while V+ is the non-inverting input.
The output pin goes high when the voltage at V+ is greater than that at V-, and vice versa. Normally when we use a voltage comparator like the LM339 one of the input pins is provided with the reference voltage and the other input pin is connected with a sensor or any voltage source or external device. Now the job of the comparator is to compare these two voltages and generate an output. The output is high only if the +V is greater than the –V. In Batter Voltage Monitoring system we are going to use the variable resistors to set the reference voltages. As explained above different voltage levels reflect different charge amounts.
At this point, we know enough about the LM339 and now we can move forward. Now lets me explain this through a Proteus simulation.
Download Proteus Simulation: lm339 battery level monitoring without using controller
This is a screenshot from my video tutorial given below. For the best understanding download the Proteus simulation and open the file. Click on the download button above to download the simulation.
U1: C… and
U1: D are the four inbuilt comparators.
These 4 comparators will be used to compare 4 different voltage levels. The +input is the noninverting input and the – input is the inverting input. Five 10k resistors are connected in series which makes a voltage divider circuit and gives me 4 different voltages which are connected with the inverting inputs of all the 4 comparators, the voltages on the inverting inputs of the comparators will be used as the reference voltage. On the left side, we have a variable resistor “RV1”, which can be considered as a battery, as you can see it’s connected with the non-inverting inputs of all the comparators. We can increase and decrease this voltage. This voltage will be compared with the reference voltages.
As you can see the voltage on the inverting input is 2.4volts, while the voltage on the non-inverting input, which is coming from the variable resistor, is 2.94.
So voltage on the non-inverting input is greater than the voltage on the inverting input that’s why the output of this comparator is high and the LED is ON.
The reference voltage set on the 2nd comparator is 4.8volts. so the voltage available on the non-inverting input which is 2.94 is not greater than 4.8volts so that’s why this LED is OFF. If we start increasing the voltage, when the voltage on the non-inverting input is greater than the voltage on the inverting input the LED turns ON
and if we keep increasing the voltage than the other two LED’s will also turn ON.
The purpose of using 2n2222 NPN transistors is that we can upgrade this circuit at any time, we can use the same circuit to control LEDs, relays, etc. As I plan to use the same circuit in a stabilizer and for that, I will be needing relays, so that’s why I added 2n2222 NPN transistors. As you can see the emitter is connected with ground and the collector is connected with the led cathode side and the led anode side is connected with a 1k resistor, this is a current limiting resistor and is connected with 12 volts. All the connections are exactly the same.
I used the same connection on a breadboard and its working perfectly. As you can see I can compare the voltages and can turn on and turn off the LEDs at certain voltage levels. So far we covered the basics of how to use a voltage comparator, what is the purpose of inverting and noninverting inputs when we get a high output. for the practical demonstration watch video given at the end.
As you can see I have marked 4 comparators as 0%…40%…80%…and 100%. If we compare these voltages with the voltage values in the table we find that the LED indications are completely wrong.
Our circuit is working perfectly, we only need to set the trigger voltages, for this we have to make a slight change, instead of using these resistors “R1 to R5” in series we will use 4 variable resistors, so that we can individually set the reference voltage of each comparator, and that’s it.
Download the updated simulation file: updated simulation file lm339 voltage comparator
As you can see I added 4 variable resistors “RV2 to RV5” and set reference voltages as per the table. Now by increasing and decreasing the voltage, we can trigger the led at an exact voltage level. I checked all the connections on a Breadboard and once I was satisfied with the results then I started the soldering. The soldering is completely explained in the video tutorial.
After I was done with all the connections, Soldering, and testing then I started checking the short circuit using the digital Multimeter, and luckily there was no short circuit. The final step was to set the reference voltages which I completely explained in the video given below. So now this circuit is ready and can be used with the battery for monitoring the voltage.
Battery Voltage Monitor Finally Testing:
So this project was a success and I was able to turn ON the LEDs at certain voltage levels. The voltage levels Vs charge chart is given above. I used the same voltages. If you have any questions let me know in a comment.
Don’t forget to subscribe to my channel. Support my channel by liking and sharing the video.