Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

How to detect low battery within AVR

If you power your electronic device from the battery, you probably want to have a feature that tells when the battery is running low. Rechargeable batteries must know when voltage is nearing the threshold when a lower drop would damage the battery itself. Say LiPo batteries cannot be discharged lower than 3.0V. Josh has gone through this problem by analyzing low battery indication options. He says that a small circuit built around MCP65R46 can be a good choice where voltage is compared to reference inside the chip, but the problem is that you need additional components in that case. Also, such circuits draw a bit of current to work.


So he thought that in microcontroller-based circuits, you can get away without using any circuit and still have the same functionality if not better. The fact is that the AVR microcontroller is equipped with an internal 1.1V bandgap voltage reference. The thing is that this voltage can be sampled with ADC against VCC or VREF voltage. So he suggests take VCC voltage as a reference and measure bandgap voltage as an unknown voltage. Then by applying the simple formula, calculate the actual VCC. Once you have this voltage level, it is up to you how you indicate this – with LED, output on LCD. If you want to be precise, you should know that internal reference voltage can vary from chip to chip. So you need to test it against known VCC and then use calibration to get close values to the truth.

Bookmark the permalink.

Comments are closed.