I have a microcontroller (ATmega328) powered by a single cell lipo battery. I would like to make the microcontroller know when the battery voltage gets under a given level (someting around 3.5V) to output some kind of "low battery" alert. Can I do that without using another battery? Does the internal analog reference remains stable if the power supply voltage changes? If so, can I simply connect the battery positive terminal to an ADC pin and output the alert when the reading gets under a certain number?

  • \$\begingroup\$ What does the data sheet tell you about the internal/external voltage references when making analogue to digital conversions? \$\endgroup\$
    – Andy aka
    Commented Dec 5, 2016 at 16:08

1 Answer 1


The Atmega328 has both Power on reset and Brown-out detection build in. You don't need to add any components. Read the datasheet: http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf
Read Section 15.2 and you will understand exactly what voltages will stop the microprocessor from running by activating reset.

If you want an early voltage level detection with an indicator (while you processor can still run code), simply use the onboard A/D to provide the measurement.

  • \$\begingroup\$ Thank you, I didn't knew there was this kind of reset in my microcontroller, I'll use it. Is the A/D the analog to digital converter? \$\endgroup\$ Commented Dec 5, 2016 at 17:09
  • \$\begingroup\$ @neaoarchimede. Yes. \$\endgroup\$ Commented Dec 5, 2016 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.