Go Down

### Topic: ac current meter using acs758 hall sensor (Read 17352 times)previous topic - next topic

#### hozone

#15
##### Nov 20, 2012, 10:16 am

1. In the plot you provided in reply #9, at the 6.4A setting, what are the ADC readings at the high and low peaks?

2. How do you know that the current is 6.4A?

1. @6.54A 547max 480min (it's 6.54A sorry)
+ @3.65A > 547max 512min
2. multimeter (not true RMS)

#### dc42

#16
##### Nov 20, 2012, 10:41 amLast Edit: Nov 20, 2012, 10:43 am by dc42 Reason: 1

1. @6.54A 547max 480min (it's 6.54A sorry)
+ @3.65A > 547max 512min
2. multimeter (not true RMS)

6.54A * 1.414 * 2 = 18.5A peak to peak

(547 - 480) * 5 / (1024 * 0.04) = 8.1A peak to peak

So, if my calculations are correct and your meter is to be believed, the sensitivity of your device is only about half what it should be. Are you sure you have the 50A version and not the 100A version of the ACS758?

I would tidy up the code like this:

Code: [Select]

const double sensitivity = 0.04;
const uint16_t numSamples = 100;
float current;

...

long acc = 0;
for(uint16_t i=0; i<numSamples ; i++) {
_delay_us(100);
}
const float meanSquare = ((float)acc)/((float)numSamples);
current = sqrt(meanSquare) * (5 / (0.0016 * 1024.0)) - 0.5;

While writing this, I noticed that you were dividing by the number of samples after taking the square root instead of before. That explains a factor of 10 in why the sensitivity appeared to be incorrect.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### hozone

#17
##### Nov 20, 2012, 11:20 am
damned paranthesis!

later i will use #define or const for my code, code here is only for test purpose

my new code has a simple filter for adc to remove offset

Code: [Select]
uint16_t i = 0;
for(i=0; i<100; i++) {
//digital high pass filters to remove offset.
ssum += s;
_delay_us(100);
}
d = sqrt(ssum/100) * 5 / (0.018 * 1024.0);
ssum = 0;

now with a sensitivity of 0.018 (0.036 (close to 0.04) /2) things seems right from 0.5A to 12A
my chip is ACS758 LCB-050B

because
d = sqrt(ssum/100) * 5 / (0.018 * 1024.0);
is like
d = 2 * sqrt(ssum/100) * 5 / (0.036 * 1024.0);

isn't that there is a 2 multiply left?

#### dc42

#18
##### Nov 20, 2012, 11:26 am

my chip is ACS758 LCB-050B

Is that actually printed on the chip?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### hozone

#19
##### Nov 20, 2012, 11:49 am
yes, printed on chip.

i change the ratiometric change in sesitivity derived from my voltage (page 16 acs758 datasheet)
SENSnew = (Vin / 5v) SENSdatasheet
my board supply is 4.70V so the sensitivity should be 37.6mV, next 0.036 / 2 = 0.018.. ?

#### dc42

#20
##### Nov 20, 2012, 12:00 pm
The extra factor of 2 does seem odd, that's why I suspected that you might have the 100A version of the sensor. Did you get it from a reputable supplier?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### hozone

#21
##### Nov 20, 2012, 12:04 pm

Did you get it from a reputable supplier?

Absolutely not  ebay seller from china did you think it is a fake or wrong printed chip?

#### dc42

#22
##### Nov 20, 2012, 12:09 pm
It might be a remarked chip, perhaps a -100B that has been remarked as a -050B by mistake. How well do the markings match the ones shown on the last 2 pages of the datasheet?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### hozone

#23
##### Nov 20, 2012, 12:34 pm
to me seems allegro official, but may not be.
see attached pic

#24