0
\$\begingroup\$

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?

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

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.

\$\endgroup\$
  • \$\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\$ – noearchimede Dec 5 '16 at 17:09
  • \$\begingroup\$ @neaoarchimede. Yes. \$\endgroup\$ – Jack Creasey Dec 5 '16 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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