[SOLVED] ASC758 50AMP Unidirectional Random Values

Guys,

I’ve been trying to figure out what is going on with this sensor(s).

I have bought a ASC758 Uni-Directional Sensor, This one:

I have wired it to my Arduino and when I start reading I get ‘120’ and I guess that’s normal given that the Uni-Directional specs state that on 0 load, the sensor will output 0.6v, and sure thing, I checked with my multi meter and I am getting 0.6v.

Problem lies when I put a load, The values will bounce in a wave fashion.

In the attached Screenshot i have enumerated the pattern
1: Right when I turn ON a hair dryer I have as load.
2: You can see the values go up as expected and reach a peak of 175
3: Value start decreasing?? back to Low of 66
4: Values start going back up again

I guess this is only happening on the Uni-Directional sensor?

Has any one used a Uni-directional ASC758?
I know I must be doing something wrong, but Can’t find out what.

Note The output i’m logging is just raw from the analogRead function.

Thanks guys!

Is the hair dryer AC powered?

Yes, 120v 800w

I have the sensor hooked to a extension cable that i have split the positive.

Quick & Dirty drawing of how I have it wired up

Is the current reading going up and down about 60 times per second? If you wanted to measure AC, you should have gotten a bi-directional model.

I'm reading at 10 times per second

In the specs it says that the ASC758 family chips are AC and DC capable. am I wrong?

here is the quick sketch

void setup()
{
  Serial.begin(9600);  
}
void loop()
{   

double currentValue = analogRead(A0);
    Serial.println(currentValue);

    delay(100);
}

Maybe I should have got a Bi-directional model and not have this problem but I'm curious as of why this is happening or what I'm doing wrong and to have a Post documented with a possible solution for a poor soul that buys that model like me lol.

Did you plan on measuring AC? You should have gotten a bi-directional model.

I haven’t done the math on the 10 samples per second. I’ll presume that is why the up and down readings. The current will vary positive and negative depending on the voltage cycle of the AC.

Well if the Unidirectional model only works with DC, that will suck.

I bought the 30Amp ACS712 Bi-Directional as a workaround but I will really like to get to the bottom of the Uni-directional fluctuations, I will hook it up to a DC load and see if I get better readings.

In the mean time, If some one has come up with this issue before or is experiencing the same post your thoughts and/or findings.

To obtain useful data from trying to read an AC waveform, you need do to a lot more calculation than what you have in your little program, which is not going to display current, but just pure ADC values between 0 and 1023. You don't need or want to use a double when reading an unsigned integer such as from an analog read.

Remember, the AC waveform is always changing at a rate of 50Hz or 60Hz depending on where you are on this pale blue dot. You need to integrate many samples over time at a much faster rate than the line frequency to obtain data. You then need to perform an RMS function to then get a true representation of the current passing through the load.

For DC loads, a uni-directional device is more desirable, while for AC measurements you will need a bi-directional device.

Also, read the data sheet on these devices and you will see the reason the output it sits above zero volts with no load.

Search this forum and you will also find some code to do the RMS calculation.


Paul

Ha!

That totally worked brotha!

I actually found a post about it but with a different chipset from the same manufacturer (ACS712)

Here is the code

const int currentPin = 0;
const unsigned long sampleTime = 1000UL;
const unsigned long numSamples = 250UL;
const unsigned long sampleInterval = sampleTime/numSamples;
const int adc_zero = 121;

void setup()
{
 Serial.begin(9600);
}

void loop()
{
 unsigned long currentAcc = 0;
 unsigned int count = 0;
 unsigned long prevMicros = micros() - sampleInterval ;
 while (count < numSamples)
 {
   if (micros() - prevMicros >= sampleInterval)
   {
     int adc_raw = analogRead(currentPin) - adc_zero;
     currentAcc += (unsigned long)(adc_raw * adc_raw);
     ++count;
     prevMicros += sampleInterval;
   }
 }
 
 float rms = sqrt((float)currentAcc/(float)numSamples) * (60 / 1024.0);
 Serial.println(rms);
}

const int adc_zero = 121; comes form the 0 load value (121) that the chip outputs
and the 60 from :
float rms = sqrt((float)currentAcc/(float)numSamples) * (60 / 1024.0);
Is the sensitivity as with the specs.

I will verify the readings against my multi meter and make adjustments based on the results.

So, if some one ever buys this Uni-Directional ASC758 and wants to measure AC , you need to calculate the RMS like rockwallaby said

Thanks rockwallaby!! and SurferTim!!