Monitor supply voltage of chip?


Closed Thread
Results 1 to 17 of 17
  1. #1
    Join Date
    Jan 2015
    Posts
    45

    Unhappy Monitor supply voltage of chip?

    Hi everyone, I need some help with monitoring battery supply voltage to the chip. I am supplying the pic (12f683) with a 3.7v 18650 battery. Basically I want to trigger a comparator interrupt when the voltage hits the 2.8v mark, which will then put the pic into low power mode (sleep/nap).

    My problem is that as the supply voltage is coming from the same battery that I want to monitor the voltage from, I cant seem to find a way to use comparator or adc. This is because the voltage reference (supply voltage) is dropping at the same rate as the pin that I will be reading from, it doesn't matter if I use a divider or not, I just cant find a way.

    Can anyone help with this or is it impossible without a separate/fixed voltage input to the chip?

  2. #2
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    I think a fixed Vdd to the PIC set below the "low battery" level is your only recourse with this one.
    Then a simple voltage divider to monitor the battery level with the A/D to trigger sleep mode after that.

    If you're not sourcing much through the 12F1683, a small 2.?V zener is all you'll need for Vdd.
    Louie

  3. #3
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    The datasheet for the 12f683 shows that it has an internal Fixed Voltage Reference that can be used to compare against the supply voltage.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  4. #4
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    There is more than one way to to this. All you need is fixed reference voltage.
    Eg 0,6V from diode(if you can tolerate drift about 2mV/degC), some pic have built in diode for temp. monitoring, or pic fixed reference(FVR), or voltage from some blinking LED(Do battery check when LED is on).
    So you can feed fixed voltage on ADC pin, and use Vdd as reference for ADC. If Vdd is lower than ADC result are higher and reverse.
    Some pic have FVR on ADC multiplexer(or internal diode), so there is convenient way to do that, without loosing io pins.
    If you are using external fixed reference, you can use IO pin to turn on/off reference to minimize current draw.

  5. #5
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    Hey Robbo,

    If you decide to use the internal Fixed Voltage Reference you might want to take a look at my second post in this tread... http://www.picbasic.co.uk/forum/showthread.php?t=19035

    and read this thread also... http://www.picbasic.co.uk/forum/showthread.php?t=17321

    sorry that my post about the FVR earlier was so short but I was at work.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    have a look at AN1072. Darrel wrote a piece about the subject.

  7. #7
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    Heckler
    According to microchip's datasheet( http://ww1.microchip.com/downloads/e...oc/41211D_.pdf ) PIC12F683 doesn't have Fixed Voltage Reference.
    Last edited by pedja089; - 25th February 2016 at 09:50.

  8. #8
    Join Date
    Jan 2015
    Posts
    45


    Did you find this post helpful? Yes | No

    Red face Re: Monitor supply voltage of chip?

    Thanks for all the replies! Yes the 12f683 doesn't have a FVR, so that's out the question. I think I am going to go with "LinkMtech's" idea and just use a 2.4v Zener to regulate the chips supply, then a divider onto a pin for reference.

    Thanks for your help.

  9. #9


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    microchip has a to92 voltage detector...... different voltages and draws 1 microamp....
    http://ww1.microchip.com/downloads/e...Doc/21434g.pdf

  10. #10
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    @robbo78
    That solution is not good for battery.
    With zener regulator current draw from battery is same in if pic is sleep mode as in run mode.
    If you use zener, then feed that voltage into analog pin, and then do ADC. This way current thru zener can be few uA instead few mA.

  11. #11


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    I don't know how wedded you are to the PIC12F683 but PIC12f617 looks similar but with a 0.6v ref but no EEPROM (although it can self write so that needn't be a show stopper).

  12. #12


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    PIC 12F1822 has FVRs and eveyrthing else you need.

  13. #13


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    I recently made a low battery warning for a 12V lead acid battery using a 12F675. B+ 12V powers the PIC through a 3.3V LDO regulator.The same B+ 12V goes to the ADC pin through a 220K resistor. The ADC pin then has 47K to ground. Here's the code I used. It flashes an LED when the battery gets weak. Perhaps you can tweak the code and circuit for your application to put the PIC in low power mode.

    ANSEL = 0 'all inputs digital ADC command will convert it to analog
    CMCON = 7 'comparators off
    DEFINE OSCCAL_1K 1 ' Set OSCCAL for 1K device
    TRISIO = %00000001 'INPUT ANA0 FOR ADC READINGS
    GPIO = 0 'ALL OUTPUTS LOW
    BATTEST VAR BYTE
    @ DEVICE MCLR_OFF, WDT_ON, BOD_ON, PWRT_ON, PROTECT_ON

    TEST:
    Clear 'CLEAR BATTEST
    ADCIN 0,BATTEST 'TEST CHARGE
    IF BATTEST <= 166 Then GoSub BLINK
    GoTo TEST

    BLINK:
    High GPIO.2
    Pause 500
    Low GPIO.2
    Pause 500
    Return

  14. #14


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    PIC 12F1822 has FVRs and eveyrthing else you need.
    Oh yes, thats nice. I don't understand why I didn't find that in the truly horrible Microchip selector... but of course, it's terrible.

  15. #15
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    @ pedja,

    sheesh, your right, I'm not sure which datasheet I was looking at but it wasn't for the 12f683.

    As others have pointed out there are other choices such as the 12f1822, etc. that do.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

  16. #16
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    Quote Originally Posted by Heckler View Post
    The datasheet for the 12f683 shows that it has an internal Fixed Voltage Reference that can be used to compare against the supply voltage.
    hi, Dwight,

    not really a reference for the 683 ...


    - Programmable on-chip voltage reference
    (CVREF) module (% of VDD)
    so, here it is not possible to reach the goal ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  17. #17
    Join Date
    Jan 2015
    Posts
    45


    Did you find this post helpful? Yes | No

    Default Re: Monitor supply voltage of chip?

    @robbo78
    That solution is not good for battery.
    With zener regulator current draw from battery is same in if pic is sleep mode as in run mode.
    If you use zener, then feed that voltage into analog pin, and then do ADC. This way current thru zener can be few uA instead few mA.
    Good idea! I have just found this part which is a bit of a "cheat", and quite cheap? - http://www.farnell.com/datasheets/1669371.pdf

    EDIT: Just realised that "amgen" already stated this

    microchip has a to92 voltage detector...... different voltages and draws 1 microamp....
    http://ww1.microchip.com/downloads/e...Doc/21434g.pdf
    Last edited by robbo78; - 26th February 2016 at 20:06.

Similar Threads

  1. How to use the HLVD module as a low voltage monitor
    By jellis00 in forum Code Examples
    Replies: 2
    Last Post: - 11th March 2013, 20:31
  2. Voltage monitor and PWM control
    By StoneColdFuzzy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th May 2009, 17:11
  3. Voltage monitor for car battery
    By passion1 in forum mel PIC BASIC Pro
    Replies: 50
    Last Post: - 23rd April 2008, 22:47
  4. voltage monitor
    By aftab in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 17th August 2007, 10:57
  5. Help with DS2436 Voltage monitor
    By vladimir059@hot in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th October 2006, 17:39

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts