News:

;) This forum is the property of Proton software developers

Main Menu

ACS714 Current Sensor Scaling ?

Started by Craig, Jun 22, 2023, 09:38 AM

Previous topic - Next topic

Craig

I am doing some DC testing at this stage on an ACS714 Current Sensor From Pololu -30A to +30A Item No: #1187
This unit is running at 5vdc and has a Idle Rate of 2.5vdc when there is no current passing through it which reads about 850 on the 10 Bit ADC Resolution Scale of a Pic18F47Q10 which is running on 3.3vdc.

It leaves very little room for scaling and accuracy, I have tried various iterations in the code but all give a similar result.
As an Example if I pass 1.6Amps DC through the Current sensor I will get a 40mA Increase on my Current readings from the Idle State.
I will attach the sample code I am using to test.
 
'=======================================================================================
' Set "ADC" - A/D Convertor
' Setup the ADC peripheral
' Input     : None
' Output    : None
' Notes     : ADC - Set for 10-bit operation
'---------------------------------------------------------------------------------------
    Proc ADC_Setup()
        ADLTHL  = %00000000
        ADLTHH  = %00000000
        ADUTHL  = %00000000
        ADUTHH  = %00000000
        ADSTPTL = %00000000
        ADSTPTH = %00000000
        ADRPT   = %00000000
        ADCAP   = %00000000
        ADCON1  = %00000000                                 ' ADDSEN disabled, ADGPOL digital_low, ADIPEN disabled, ADPPOL VSS
        ADCON2  = %00000000                                 ' ADCRS 0, ADMD Basic_mode, ADACLR disabled, ADPSIS ADRES
        ADCON3  = %00000000                                 ' ADCALC First derivative of Single measurement, ADTMD disabled, ADSOI ADGO not cleared
        ADSTAT  = %00000000                                 ' ADAOV ACC or ADERR not Overflowed
        ADREF   = %00000000                                 ' ADNREF VSS, ADPREF VDD
        ADACT   = %00000000                                 ' ADACT disabled
        ADCLK   = 1                                         ' FRC
        ADACQ   = %00000000
    EndProc
  '--------------------------
    Dim ADchold  As Word
    Dim Volts    As Float
    Dim CurrentA As Float
  '--------------------------

    PMD2.5    = 0                                                                               ' Enable ADC - "ADCMD = 0"
    ADPCH     = %00001011                                                                       ' RB3/ANB03 - Battery Voltage Level Monitoring
    ANSELB    = %00001000                                                                       ' Analogue ANB3 - Select channel ANB3
    ADCON0    = %10010100                                                                       ' ADC on, Right justify, FRC oscillator
   '-------------------------------------
    DelayMS 150                                                                                 ' Wait for sample/hold capacitors to charge//
    Set ADCON0bits_GO_DONE                                                                      ' Start a conversion
    DelayCS  1                                                                                  ' Delay for 1 cycle after setting the Go_Done Bit
    While ADCON0bits_GO_DONE =  1 : Wend                                                        ' Wait for a conversion to complete
    ADchold.LowByte  =  ADRESL
    ADchold.HighByte =  ADRESH
   '------------------------------------
    Select ADchold

     Volts = (ADchold * 0.004887585)     ' 5v/1023 = 0.004887585 - Convert ADC Resolution to Volts
     Volts = (Volts - 2.5)               ' Deduct the Idle voltage of 2.5v Off the actual Volt Reading from ADC
     CurrentA = (Volts * 0.66)           ' Convert to Current (Volts * 0.66mV/Amp Default Factor for ACS714 @ 30Amps)

     Print At 10,20,"ADC Raw:",Dec ADchold
     Print At 10,40,"Volt:",Dec2 Volts, " V"
     Print At 10,80,"Ca:",Dec2 CurrentA, " A"

    End Select 
    DelayMS 250
    Return
   '------------------------------------------

Any Help in the right direction will be very much appreciated?
Regards
Craig

John Lawton

Do you need to read current in both directions, and what is your maximum current?
You could apply an offset to the sensor output and/or scale the sensor signal up or down with a gain stage or a potential divider.


ricardourio

#3
Hello,

     You have two points to consider :
- First of all, place a delay at beginning of the program and after it read sensor with no current to check real zero.
- Scale to 1024 points as it goes from 0 - 1023 (2^n)

Ricardo Urio

Craig

#4
Hi John I am only reading the + positive side, the one unit will draw 2 amps and the other 500mA, I did put a Negative offset in on the ADC reading to get an Idle state where there is no current being drawn in one of my tests to zero the reading and compensate for the 2.5v Idle state. I am doing some initial tests just using DC but, this will be used for 240vac to measure the current in an element 150Watt and 500Watt all at 240vac where I will only measure above 0 as I just want to read if the element is drawing Current or not? I could use an LTC1966 RMS to Dc Convertor Chip to measure the Ac Sine Wave Correctly but, for this it wont be necessary and I still need to get the scaling correct on the ACS714. There is probably a better way to simply check if the element is working, I could use a Temp sensor but it will be better to measure the current then I know if it is working properly. 

Craig

Thanks Ricardo and Flosigud will look at the article, I might have to put an op amp in after the Sensor board to get more scaling.

RGV250

Hi Craig,
for what you are doing I plan to do something similar, I want to start dust extraction if a power tool starts.
I plan to use a small Current transformer similar to this https://coolcomponents.co.uk/products/non-invasive-current-sensor-30a-1 and just do a simple comparison on the analog input.

Bob