current sensor interfacing


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2006
    Posts
    37

    Default current sensor interfacing

    Hi!
    I want to interface a current sensor ADS712 with 16F877A.It outputs 2.61V with 0A and rises as 66mV/A.I am using AtoD with 10 bit res & using 2.61 as -Vref and 5 as +Vref. Now how do I scale the voltage to current conversion.I used different formulas but result is far from accurate.Using 0V as -Vref makes it even more difficult to scale the voltage to current conversion.
    any ideas.

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


    Did you find this post helpful? Yes | No

    Default

    When the output is less than 2.61V it merely means the current is flowing in the opposite direction.

    If using a 10 bit ADC and 0-5V, each bit represents 1/1024 of the total so 2.61V should give you 534 bits (0.004883V per bit). For readings > 534, subtract 534 and multiply by 0.004883 to get the voltage then divide by the chips sensitivity (mV per Amp). For readings < 534, subtract the reading from 534 and and multiply by 0.004883 to get the voltage then divide by the chips sensitivity (mV per Amp).

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    With Vref- of 2.61 the total A/D range is 2.39V. (5-2.61)
    Divide that by 1024 = 0.0023362 volts per step.

    Drop the leading 0's and decimal point, to make it 2336

    Then ...
    Code:
    Amps = 2336 * ADvalue
    Amps = DIV32 660       ; sensitivity * 10
    
    LCDOUT "A=",DEC AMPS/100,".",DEC2 AMPS //100
    Final resolution is .035 A per A/D step.
    And you can only read positive currents.

    hth,
    DT

  4. #4
    Join Date
    Jun 2006
    Posts
    37


    Did you find this post helpful? Yes | No

    Default thanks guys

    darrels' method is working well.I tried with 5V as Vref+ & Vss as vref- as suggested by dhouston but reading are all over the place.

  5. #5
    Join Date
    Jun 2006
    Posts
    37


    Did you find this post helpful? Yes | No

    Default one more question

    Hi!
    The circuit with ADS712 works well. The only problem is while measuring current their is lot of variation between readings.e.g while measuring 1A current the PIC will display 0.88 to 1.12A on LCD.How do I stabalize the reading so that it displays constant reading.Is this due to noise or something else.
    thanks

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


    Did you find this post helpful? Yes | No

    Default

    Try a capacitor between the ADC pin and ground(zero).
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    and maybe play with the acquisition time + perform some kind of result averaging of few ADC reading.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default

    I generally average 6-10 samples when the input is noisy. If the noise is predominately 60 Hz, then you should average the samples across 16.6 ms (one cycle), Something like -

    Code:
    ADCSUM = 0
    For X = 1 to 10
       ADCIN 1,ADCVAR
       ADCSUM = ADCSUM + ADCVAR
       PAUSEUS 960    ; Depending on device one Convert + add takes about 700uSec
    Next X
        ADRESULT = ADSUM/10
    Charles Linquist

  9. #9
    Join Date
    Jun 2006
    Posts
    37


    Did you find this post helpful? Yes | No

    Default

    Capacitor has no effect,i already tried that.

    I am generating Vref- = 2.5V from LM 723 and Vref+ =5 from 7805. LM723 is giving stable output but when 16F877A(@16MHz) is introduced in the circuit the 2.5 line gets noisy. what are possible solutions for this.

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Well, without your schematic I would guess you forgot to install some decoupling capacitor here and there?

    Usually 0.1uF(ceramic) + 10uF (Tantalum) do some good results.

    Messy breadboard connection, layout and contacts are also good noise sources..
    Last edited by mister_e; - 29th January 2009 at 04:58.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Reducing PIC current to as low as possible...
    By FromTheCockpit in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th November 2009, 04:28
  2. Replies: 8
    Last Post: - 5th May 2009, 20:10
  3. Current Sensing Resistor
    By manumenzella in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th February 2007, 16:04
  4. 16F628A current high during sleep
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th October 2006, 10:21
  5. Current Meter
    By mikefox in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 18th September 2006, 06:15

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