Loading...
Pages: [1]   Go Down
Author Topic: question about battery  (Read 265 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

Austin, TX
Offline Offline
Faraday Member
**
Karma: 41
Posts: 5171
CMiYC
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

www.cmiyc.com - A guide to being an Enginerd

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 96
Posts: 6376
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

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

Austin, TX
Offline Offline
Faraday Member
**
Karma: 41
Posts: 5171
CMiYC
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

www.cmiyc.com - A guide to being an Enginerd

Pages: [1]   Go Up
Print
 
Jump to: