Measuring Volts and Amps digitally


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Thanx for the links skimask. Lol, "datasheets", should have thought of that 1 first.

    dhouston, i get half of that. Yes i would use 10 bit rather than 8 for more accuracy. I understand "5/1024=0.004882812 or ~4.88mV per bit." but i just want to be clear about the 5. 5 is Vref but what is Vref? I think Vref is the maximum voltage that the PIC will accept on the ADC pin.

    In this example the PIC chip's ADC input should range from 0 to 5 in steps of 0.004882812. I think so far this is exactly the same as what i would do if i was using a resistor instead.

    Now for the Allegromicro ACS712 chip. +/- i take it means it can accept the current in either way or as AC. Does that make 5A the maximum current rating for this chip?

    Vcc/2 makes sense because as far as i know the PIC chip's ADC can only accept a positive number. So a value below Vcc/2 means negative current and a value above Vcc/2 is positive current.

    What is the sensitivity? I dont really understand that part

  2. #2
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    5 is Vref but what is Vref?
    Read the ADC section of your PIC's datasheet.
    Does that make 5A the maximum current rating for this chip?
    That's what +/-5A means.
    What is the sensitivity?
    That means the output voltage will increase/decrease 185mV for a 1A current.

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I think i understand it now. If 5A is the maximum and the output increases by 185mV for each amp then the output range should be 0-925mV. If vcc is 5 then you add 2.5 giving 2.5-3.425V for positive so the entire range must be 1.575-3.425V.

    Ive read a datasheet for a PIC that has ADC but i didnt see anything about the lowest input voltage (unless i missed it or didnt understand it). Would i be right in saying that you take the output from the other chip and lower it so the range becomes 0-1.85V and set the PICs Vref to 1.85V? I think this is what the amplifier thing was about that i read somewhere. I think the idea is to stretch the 1.85V so the range goes from 0V all the way up to 5V so the PIC can read it easier

    I dont think i should have this problem using the resistor method because i can set the PICs Vref to the vdd pin (5V) then use the potential divider circuit to make sure its output is 5V when a little over the maximum amount of amps are being drawn (im making it a little over so i can add overload warning and safety cutoff)

    Where does 30 come into it? On the main page it said +/- 5A to 30A

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Where does 30 come into it? On the main page it said +/- 5A to 30A
    Different chip versions....

    Ioannis

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Ahh, I see. I was getting confused before because it looked like the range of the chip was 5-30. I see now at the bottom of the other page there are 3 versions of that chip with different ratings

  6. #6
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    You have some options:
    1. Use +5V Vdd as Vref and use it as is with reduced sensitivity
    2. Use a lower external VRef (which could be as simple as a voltage divider from Vdd)
    3. Use Vdd as Vref and an opamp setup for DC gain to amplify the signal

    However, all this is the easy part. When measuring AC voltage/current you will need to sample both many times per half-cycle (what frequencies are you dealing with?) and average the readings over each half-cycle. This also means you'll need to detect zero crossing.

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I think for the actual project im going to use vdd because the potential divide part can change its value to make use of the full 5V (i dont have any outputs 5V or less).

    The frequency is 50Hz (UK AC) but because its DC ripple i guess that makes it 100Hz. As i said before im going to only take the highest value. If i sample it at about 400 times a second then at least one sample will be extremely close to the absolute max. Because of DC ripple it also has 2 chances per second to get as close as possible. I can then discard all the lower readings. The highest value will be reset after each 400 samples so it can detect a drop in current.

    Im not sure if a PIC chip can check the ADC chanels that fast though. I might need a higher resonator. If using 10-bit then the chip can detect 1024 different voltage levels. At 5V max each level is 4.8828125mV. As long as the input value is within 4.8828125mV of the highest point in the DC ripple i should get an accurate reading. The good thing about DC ripple (or any kind of sinewave based line) is that it stays near the top for a longer period of time than any other point in the wave but still i might need more than 4 sample points on each bump. To make it even worse the pic chip will have to deal with 8 ADC pins. It might be an idea to split the work between multiple PICs

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