Voltage Monitoring


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Location
    London
    Posts
    251

    Default Voltage Monitoring

    I have a RFmodule & a PIC (16F877A). They both can run upto 3V to 5V. One pin of the RF module gives a constant voltage of 2.8V.

    I plan to run the PIC on 4 AA batteries, rechargeable. (appx 1.2v - 1.3v when fully charged).

    I want to take this lower voltage (2.8V) as a reference and check when battery pack reaches 3.6. Can someone please guide me how I can take the lower voltage as a ref and check the supply voltage. Thanks

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Voltage Monitoring

    One way would be to use a voltage divider on the battery pack so when it reaches 3.6 the divider returns 2.8.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Voltage Monitoring

    If you set Vref to Vdd and read the A/D, you will find that the constant 2.8V will give you an A/D count of LARGER than 716 when the battery voltage drops below 4V. No resistors needed.
    Charles Linquist

  4. #4
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default Re: Voltage Monitoring

    Quote Originally Posted by Charles Linquis View Post
    If you set Vref to Vdd and read the A/D, you will find that the constant 2.8V will give you an A/D count of LARGER than 716 when the battery voltage drops below 4V. No resistors needed.
    Since it is a battery powered application. This seems a better option. Could you please explain more. I not an expert on this subject.

  5. #5
    Join Date
    Nov 2009
    Location
    London
    Posts
    251


    Did you find this post helpful? Yes | No

    Default Re: Voltage Monitoring

    What setting of ADCON1 should I choose and what to connect where? I need maximum number of PortA pins as digital. Thanks

  6. #6
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Voltage Monitoring

    I think you can read the datasheet as far as ADCON1 goes.

    Most PICs let you choose between two sources of Vref. You can choose AN3 or Vdd. If you choose AN3, then you must connect a reference voltage to that pin. All A/D readings will be compared against that reference.
    If the reference is 3.0V the a 10 bit A/D will read 3.0V on any other A/D input as 1023. The "count" (1023) is equal to (input/reference) * ((2^10) - 1).
    If you apply 2.0V to an A/D input, and the reference is 3.0V, the count will be 2/3 * 1023 = 682.
    Everything is compared AGAINST the reference.

    If you set Vdd as your reference, then every A/D conversion will be compared to Vdd.
    Since your external chip puts out a constant 2.8V, if Vdd (the reference) is 5.0V then the A/D will output 2.8/5 * 1023 = 573
    If Vdd drops to 4.0V, then the A/D will output 2.8/4 * 1023 = 716
    If Vdd drops even further, the A/D output will go higher than 716


    If you set
    Charles Linquist

  7. #7
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Voltage Monitoring

    Additionally, if you have any other voltages to measure, connect your 2.8V to AN3. You can change Vref on the fly. Set Vref to AN3, and you can measure the other voltages accurately without regard to the battery voltage. Then set Vref to Vdd and measure the battery voltage, switch it back and measure your other voltages...

    I use this technique often when reading absolute voltages (which must be compared against a constant reference) and ratiometric sensors, whose output varies as a percentage of their supply voltage (such as Hall-effect current sensors).
    Charles Linquist

  8. #8
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Re: Voltage Monitoring

    Quote Originally Posted by Megahertz View Post
    I have a RFmodule & a PIC (16F877A). They both can run upto 3V to 5V. One pin of the RF module gives a constant voltage of 2.8V.

    I plan to run the PIC on 4 AA batteries, rechargeable. (appx 1.2v - 1.3v when fully charged).

    I want to take this lower voltage (2.8V) as a reference and check when battery pack reaches 3.6. Can someone please guide me how I can take the lower voltage as a ref and check the supply voltage. Thanks
    I didn't check the Data Sheet for the 16F877A to see whether it has an HLVD module or not. If it does, you can easily use the technique I described in an article on this forum to check the supply voltage. Check it out at: http://www.picbasic.co.uk/forum/cont...oltage-monitor . It has schematic, layout, code, et al. Hope this helps.

Members who have read this thread : 0

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