R
R
rinaz222020-08-06 08:42:41
Arduino
rinaz22, 2020-08-06 08:42:41

How to check battery level with arduino nano?

Hello. I want to make backup power for arduino and display the remaining charge, for example, on a monitor port? How can this be done? I'm new to arduino, so don't judge too harshly.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin Zaitsev, 2020-08-06
@KonstantineZ

In order to accurately know the charge, you need to integrate the power taken from the battery when discharging and reported to it when charging. Usually special microcircuits are used for this.
If high accuracy is not needed, only the battery voltage can be measured. In this case, non-linearities are possible or the measured percentage of charge can sometimes float, but the circuitry and code are much simpler.

S
Sergey Vodakov, 2020-08-06
@WaterSmith

If we are talking about lithium, and high accuracy is not needed, then detailed instructions are here:
https://vk-book.ru/uroven-zaryada-akkumulyatora-18...

D
Dmitry Pavlov, 2020-08-06
@Stalker31

If you need to measure the battery voltage and it does not exceed 5 volts, then something like this:

#defin Akym //номер пина к которому подключен аккумулятор (A0-A7)
void setup(){
Serial.begin(9600);}
void loop(){
int i=analogRead(Akym);//возвращает цифровое значение напряжения в диапазоне 0-1023
int a=map(i,0,1024,0,5);//преобразование из цифрового диапазона , в диапазон напряжения 0-5 вольт
Serial.println(i);//Вывод результатов
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question