Voltage Monitoring


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    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

  2. #2
    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.

  3. #3
    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

  4. #4
    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

  5. #5
    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

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


    Did you find this post helpful? Yes | No

    Default Re: Voltage Monitoring

    Thanks Charles. Points noted. Very useful information. I am going to go ahead and try to play with Analog settings a little. Thanks again.

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


    Did you find this post helpful? Yes | No

    Default Re: Voltage Monitoring

    Just a quick question to re-confirm my understanding.

    I will be using a 3V fixed voltage regulator for my PIC. Now I just to know that, If the setting of ADCON1 can be "1110" ?

    I am planning to use supply voltage as reference and by using a voltage divider, send the battery voltage to PortA.0.

    PIC is - 16f877a

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


    Did you find this post helpful? Yes | No

    Default Re: Voltage Monitoring

    First - if you read the datasheet, the 16F877A is not rated to run below 4.0V unless you choose the "LF" version.
    Second, why do you need a voltage regulator at all? If you are running off batteries, and the battery voltage doesn't go above 5.5V, then using a voltage regulator will DECREASE battery life.

    If you want to have the longest battery life AND be able to measure battery voltage, then connect VDD directly to the battery. No voltage regulator.
    Connect your 2.8V signal to AN0 and ADCON1 to %01001110 . Read AN0. If it is above 716, then your battery is below 4V.
    Charles Linquist

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