Voltage Monitor Project

Hi guys,

Im working on a voltage monitoring project because Ive ran into the need with quite a few other projects that I plan to set as autonomous. I need to monitor the voltage on a LiPo battery because I want to use it eventually to power an air quality monitoring station that samples every 30 minutes. Currently it is powered by a wall wart connected to the Arduino’s barrel jack.

I have this 3.7V - 1480mAh LiPo pack. I have it connected to a solar panel via 5V mini-USB 1A charger and dc-dc booster. I was thinking of connecting a couple of leads from the battery to the UNO in order to read the voltage of the LiPo throughout the day.

According to the Analog Voltage Read example I would plug the + from the LiPo to the A0 pin on the UNO and the - terminal from the LiPo to a GND pin on the UNO, correct?

According to the Analog Voltage Read example I would plug the + from the LiPo to the A0 pin on the UNO and the - terminal from the LiPo to a GND pin on the UNO, correct?

That's about it. As long as you don't exceed 5V*, everything will be OK.

Note that (by default) the reference is the Arduino's 5V supply... That means your readings are only as good as the power supply. For example, if the power supply drops to 3.7V and you feed 3.7V into the analog input, the ADC will read 1023 and your software will calculate 5V.

If that's an issue, you can use the optional 1.1V reference with a voltage divider (2 resistors) to knock-down the voltage you're reading (to 1.1 V or less).

Of course, you might want to do something besides send the voltage reading to the serial monitor...

  • More specifically, the analog input can't be higher than Vcc (the Arduino's power supply voltage) or the chip can be damaged.

Ok I have a question:

I understand the UNO has a 5.0V reference. But I dont understand what you meant with the 3.7V then the ADC will read 1023 which means 5V. I understand the UNO will reference 5V as 1023, so why would it interpret 3.7V as 1023?

Marciokoko: Ok I have a question:

I understand the UNO has a 5.0V reference. But I dont understand what you meant with the 3.7V then the ADC will read 1023 which means 5V. I understand the UNO will reference 5V as 1023, so why would it interpret 3.7V as 1023?

It should only reference 3.7 as 1023 if the input voltage to the Arduino is also 3.7VDC, if you feed the Arduino with regulated 5VDC and Map (or scale) the 0 - 1023 to 0 - 5vdc then you will be fine as the battery should not exceed 4.3VDC fully charged.

A bigger concern is how you will charge the battery, LiPo's are very sensitive to charge voltage and overcharing will cause failure, (potentially non passively as found in an increasing number of Lithium powered "Hoverboards").

Over discharging will also cause premature failure and as the volt drop between charged and discharged in your case is about .7v you will need to react quickly to shut it down.

Some additional considerations for charging from a small Solar cell, the output will not be regulated so will vary depending on available sunlight, this will include dropping below charge threshold. Also Solar cells will draw current from the battery when they are not producing energy (at night etc.), so there should be a diode in the line to prevent discharging the battery.

It should only reference 3.7 as 1023 if the input voltage to the Arduino is also 3.7VDC, if you feed the Arduino with regulated 5VDC and Map (or scale) the 0 - 1023 to 0 - 5vdc then you will be fine as the battery should not exceed 4.3VDC fully charged.

Ok I must have misunderstood what DVDoug wrote then. So Arduino will read 1023 as whatever is the maximum of the input voltage, so long as the input voltage is not more than 5V. So if I plug in a 6V, then 1023 will be equal to 6V.

Ok the charging would be done via a solar cell. I guess that is why the battery discharges at night :slight_smile:

Here is a picture of the setup:

890edd9fb36cc68435e5e3b73e3638e57028a890.png

So I should add a diode in the + lead from the solar cell to the battery to make sure it only gets current into it and not out of it?

SolarCellWithDiodeToLiPo.png

Here is a closer look at that pcb strip connecting the battery to the lipo. This is from an old solar iphone charger. Im wondering if that surface mounted structure on the positive lead is a diode?

FullSizeRender (14).jpg

Marciokoko: Ok I must have misunderstood what DVDoug wrote then. So Arduino will read 1023 as whatever is the maximum of the input voltage, so long as the input voltage is not more than 5V. So if I plug in a 6V, then 1023 will be equal to 6V.

Basically yes you are correct, however don't ever put 6v directly to the chip, all the smoke comes out!!!

I take it the blue PCB is the D.C. - D.C. converter? if so what is it? I am interested in finding small converters.

If the battery has a Solar charger from a phone attached then maybe that is a diode attached, remember that a Diode will also drop the voltage across it (by about .6 of a volt I think) which will impact on your charging capability,what is the output voltage of the panel in full sunlight?

The blue pcb in the picture is the USB charger. The Booster is off to the right so it didn't fit in the picture.

I'll check the solar panel v tomorrow at peak sun hour. I believe I had it at 5.8v today.

I think I need to get a other battery though because this one drops to 0V at night.

DVDdoug: * More specifically, the analog input can't be higher than Vcc (the Arduino's power supply voltage) or the chip can be damaged.

The datasheet say sometingh different :

VREF Reference Voltage 1.0 AVCC V VIN Input Voltage GND VREF V

(pag 323 on my, maybe old, copy)

Cheers, Ale.

Ok I measured the solar cell in direct sunlight, I get 6.18V.

So I need to figure out how many amps the solar panel will produce, then setup a table with sunlight hours and calculate:

storage + production - consumption for peak sunlight hours and storage - consumption for non sunlight hours

I've read a dc motor draws about 1A, which is a lot and will deplete my small lipo real quick. A LED on the other hand will draw very little and I might end up never seeing much difference. Is there a way to limit how many amps a motor draws such that even if it means making it spin slower, I can make sure it draws only 500mA of 300mA?