Go Down

Topic: question about battery (Read 565 times) previous topic - next topic

coos

is there any simple way to read a battery's voltage from arduino?
thx?

James C4S

This is a pretty common question.  Search this forum and Google for "Measure Battery."

You've given no details (why kind of battery, how often you need to measure it, what you want to do based on the reading, etc.)
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

johnwasser


is there any simple way to read a battery's voltage from arduino?


For a voltage between 5V and 0V, referenced to Arduino ground:  analogRead()

For a voltage ABOVE 5V, referenced to Arduino ground:  Voltage divider (two resistors) and analogRead()

For negative voltages things get complicated.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

coos


This is a pretty common question.  Search this forum and Google for "Measure Battery."

You've given no details (why kind of battery, how often you need to measure it, what you want to do based on the reading, etc.)


It's 12V li-ion battery?i want to know when the battery should be replace?so i should measure it first

thx for reply

James C4S

I have found that if you want to measure the same battery the arduino is on, you need to isolate the battery from the I/O pin when un-powered.  Otherwise the atmega will get "back powered" through the I/O pin, draining your battery.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Go Up