Pages: [1]   Go Down
Author Topic: question about battery  (Read 498 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Pages: [1]   Go Up
Jump to: