Close

A creative solution to battery voltage monitoring

A project log for Water Alert

hear it before you step in it

mcunerdmcu_nerd 04/24/2019 at 13:540 Comments

I was originally thinking about using the typical voltage divider and ADC with the internal 1.1V reference on the Attiny85 to monitor the battery voltage and sound a warning when it got low.  I wasn't crazy about using a voltage divider as it would always be consuming power.  High value resistors could be used to minimize power consumption but I've read that there are potential issues with feeding the ADC with little current (high impedance) source.  MOSFETs could be used to cut power entirely to the voltage divider when not measuring the voltage but then the part count starts the creep up a bit as well as additional board space needed.

There had to be a better way I thought.

I did a bit more googling and stumbled upon this article about monitoring battery voltage with no external components at all! It's simple yet ingenious.  Here's what it essentially boils down to: setting the unknown VCC voltage as the reference and use the internal 1.1V reference as an input.  With some simple Algebra the ADC formula can be written as VCC=(1.1*1024)/ADCvalue.   The chip designers apparently had this use case in mind for many AVR chips including the Attiny85 it permits the internal 1.1V reference to be set as an input.

Mind blown!

Anyways Microchip has an article here about doing this.

Discussions