There are many IC’s out there that can do what is called “gas gauging” to monitor how much battery is left in your robot, just like in mobile phones.
Since I am somewhat new to electronics, I wanted to learn how to implement a battery monitor sensor by using what is called a voltage divider circuit.
Just like LEDs use a series resistor to ensure they receive no more than 20mA of current, with 5vdc this usually turns out to be a 330ohm resistor.
If you wanted to power this same LED, but all you had was say a 9volt or 12volt power source, then you would have to use a second resistor on the ground side of the LED, which would give you a lower voltage AND lower current.
This voltage divider circuit has many more uses besides just LEDs, it can also be used to create a reference voltage or logical voltage level.
For example, I have a 6vdc NiMH battery, but when fully charged it reads 7.08vdc on the multimeter. For my sensor, I want to say that 5vdc is fully charged. I will do some math to calculate what resistors I need to get a 5vdc Vout. Or in my case, I dread math so I will use a Java applet I found:
The applet will help me get a close approximation to start with. I enter in 7v for Vs, and I find I can get 5.00vdc on the voltmeter with R1 = 20k, and R2 = 50k
Voltage Divider Applet
The only snag apparent right now is that with common 5% resistors, there are only a limited selection to chose from. Unfortunately, there is no such thing as a 5% 20k and 50k resistor.
There is another snag too that i’ll tell you about now, is that this circuit is assuming there is nothing connected to Vout, meaning no load. It is basically just a series resistance. The way to deal with that is if you know the current that will be on the load, you can use another series resistor on your 5v. The other way, which is what I will use, is you can add a capacitor between ground, and the voltage you want to stabalize. In my case a 10uF 16V cap is perfect.
According to Ohm’s Law, the ratio of voltage across our two resistors will be equal to the ratio of the resistance values themselves. In my case, I want to drop from 7.08 to 5, thats a drop of 2.08. Therefore my ratio is 2.08:5, or more simply 0.416:1. Unfortunately, this ratio will not work using common 5% resistors. I will round down and say my batteries max charge is 7vdc, which is fine as they will lower in voltage as they get older anyway. So lets say 2:5, or 0.4:1 (or for the purpose of the calculator below, 1:0.4)
In this next calculator, the table shows the significant digits (1st digit, and 2nd digit) of standard 5% resistor values. When you type in a ratio, it calculates the corresponding significant digits (1st digit, and 2nd digit) that would be required to complete that ratio.
Go ahead and type in ‘0.4’ in the desired ratio box.
All you need to do is pick out ratios of valid significant digits (meaning no decimal point, and a number you already see listed on the table, in my case the first 4 in 10:4 is not an existing resistor value).
The table shows that you can use resistance values with the first two digits of (this does not talk about the multiplier) 30:12, or 75:30 to obtain the ratio of 1:0.4.
If instead of doing 2/5 to get 0.4, you had done 5/2, you would have gotten 2.5. If you had specified 1:2.5 (the inverse of 1:0.4), you would have gotten the ratios of 12:30, and 30:75. Which is the same ratios that fit the standard resistor values.