I would like to monitor my battery using Arduino but I don’t know how exactly should I connect it to Arduino or if I need any resistors or anything thing to control the power to avoid damages to Arduino pins. I will explain what I need and the component used.
From the attached diagram I have a 7.4V battery with 1mA which connected to a 5v regulator. I would like now to connect a wire to an Arduino pin and try to print the battery value which will be from 0 to 255 because from Arduino pin, at the same time I want to be sure to not damage the Arduino pin that I will read the voltage value from it. Please inform me with clear explanation because I am a beginner in this field.
If the battery drops the voltage regulator will keep the voltage at 5V
If you want to monitor the battery you make a voltage divider of 2x 10K resistors.
+7.4V ----[ 10K ] -----A------[ 10K ]----- GND
Point A will be ~half the voltage of the battery. The Arduino analog in can savely safely read this value. If the battery drops from 7.4 to 6.8 the voltage at A will drop from 3.7 to 3.4
float voltage = analogRead(A0) * 14.8 /1023; // as you measure half the voltage the factor is doubled - you might need to tune this constant.
From you diagram it is unclear (to me) why you have the 5volt regulator.
Are you using the 5V to power the Arduino (which is fine)?
Using the voltage divider as per robtillaart (savely should be safely),
you should understand that point A should be connected to an analog input pin.
Are you looking to monitor the depletion rate of the battery or are you just interested in a threshold at which point "it's time to recharge/replace"?
Is this a Li-Poly battery pack?
You should look into charts depicting discharge rate at load.
Is the load constant?
I believe a 7805 has a dropout of 7.2v so if you are using a standard 5v regulator, you are only not going to power this circuit very long if it draws even a small amount of current unless that is a really big battery pack as in lots of mAh big. You should look into chargepumps (buck/boost regulator IC's) to power a circuit from a lipo.
Sacman:
I believe a 7805 has a dropout of 7.2v so if you are using a standard 5v regulator, you are only not going to power this circuit very long if it draws even a small amount of current unless that is a really big battery pack as in lots of mAh big. You should look into chargepumps (buck/boost regulator IC's) to power a circuit from a lipo.
Very much agree. It is foolish or understandable ingorance to use a linear regulator in a battery powered application these days. Look at the price of this step down voltage regulator from an Asian seller, $2 with free shipment, and there are many different sellers for these products. You just simply are throwing away battery capacity and trading it for heat generation by using a linear regulator.