PIC 12F675 battery monitor using a diode/LED and resistor

Here’s a circuit by Joe Desbonnet’s Random Tech Stuff that’s designed to monitor battery voltage. It uses one resistor, one diode (or LED), one microcontroller ADC input and one digital output. A practical application using a PIC 12F675 is presented. This allows you to monitor battery voltage under load, allowing sufficient time to replace the power source before failure.

Join the Conversation


  1. What is this guy doing? The PIC 12F675 already has on on-chip comparator with programmable voltage reference! Many dime-a-dozen micro-controllers have references that can be tied to the ADC too. Sheeesh…

  2. Drone, I admit I haven’t explored the comparator on the 12F675, but from a quick glance at the datasheet (p42):
    When VRR = 1: CVREF = (VR3:VR0 / 24) * VDD
    When VRR = 0: CVREF = VDD/4 + (VR3:VR0 / 32) * VDD

    In all cases CVREF is a function of VR3:0 bits *and VDD*. So you cannot program an absolute voltage reference — not that I can see anyway. To gauge battery voltage you’ll need something absolute to compare with. I’m probably missing something, but can’t see it right now. If you can point me to an app note or web page somewhere I’d be very grateful. Thanks!

Leave a comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.