A better indicator for high or lower battery power? (Microcontroller)

Discussion in 'General Electronics Chat' started by Fuji, Dec 7, 2014.

  1. Fuji

    Thread Starter Member

    Nov 8, 2014
    100
    1
    Since I have a microcontroller involved with my circuit, I cut off the idea to build a separate circuit close to the batteries area of the board to indicate if the power is high or low. My question is, how can I indicate the battery is high or low with the microcontroller itself? Im using PIC16f84 to test this out.

    Since my power source is 9v coming from the batteries and my microcontroller is at a minimum 2 volts to power it up, where would it be best to indicate the 9v power is high or low? Or how would the microcontroller indicate the 9v is high or low when the microcontroller itself is powered with only 2v? I thought of using 2 LED's along with the microcontroller, one to indicate power is high, and the other to indicate the power is low.
     
  2. JohnInTX

    Moderator

    Jun 26, 2012
    2,339
    1,022
    The 16F84 is an OLD part with not much going for it. For the same or less money you could get a PIC with on-board ADC, comparators, voltage reference, power management/supervision and more memory. With those analog sections, you can easily monitor the power. Any of the Nano-Power and/or 'Analog PIC' Microchip stuff would be a good place to start.

    If you stick with the F84, you'll need some external circuitry to sense the voltage level and report it via an input port (the voltage thresholds of the input ports themselves are not accurate nor consistent enough to use as voltage sensors). A low power comparator with a reference diode comes to mind. Or, presumably, you are using a voltage regulator for the 9V->2V. Many regulators have POWER_GOOD output signals that can be used to detect a low battery as well as provide reverse polarity protection and processor supervision (assert RESET when voltage is too low). Microchip, ST and others make lots of this kind of stuff.

    If it seems like I am trying to discourage you from using the F84 well, I am :)

    Have fun.
     
    Fuji likes this.
  3. Fuji

    Thread Starter Member

    Nov 8, 2014
    100
    1
    Thanks for the reply. I am personally discouraged by it as well. Like I said earlier, I am using it for testing. Do you know any PIC with the similar features you described above? I thought of using PIC16F722A later on. It is a nanoWatt PIC.
    http://ww1.microchip.com/downloads/en/DeviceDoc/41417B.pdf

    Im actually using a dc dc converter buck booster to lower the 9v's to 2v to power the microcontroller instead of using a linear regulator since as I learned it discipates heat. Im trying to save as much battery life as I can. Do you know any low power comparator IC's if there are any to indicate high or low power?
     
    Last edited: Dec 7, 2014
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    The problem with indicating a low voltage is this takes current and low voltage is typically due to your battery dying. I'd prefer a flashing LED for this to conserve power.

    With a 9V source driving a regulator with a 2V output you can divide down the 9V and measure it with a D2A driven off the 2V used as a reference. A separate reference lower than 2V would be even better.
     
    Fuji likes this.
  5. Fuji

    Thread Starter Member

    Nov 8, 2014
    100
    1
    Thanks for the reply. Are you speaking of the VREF/ADC pin's of the microcontroller in which I can connect the D2A to? Sounds like a voltage divider circuit would be needed since I have a 9v power source to drop it down and then read it from the microcontroller.

    As for the term D2A, are you speaking of that circuit breaker?
     
    Last edited: Dec 7, 2014
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Yep, the 9V drives a voltage divider to an ADC pin, as the 9V can change by lots while the 2V remains relatively constant. But by making an even lower then 2V reference you can check both voltages.

    I do not follow what you mean by "circuit breaker."
     
    Fuji likes this.
  7. Fuji

    Thread Starter Member

    Nov 8, 2014
    100
    1
    Thanks for the help.

    I like your avatar with those workers on the board. Has a very big meaning to electronics when those 3 guys are standing up on there.
     
    ErnieM likes this.
Loading...