Hi again,
You probably dont need a diode anymore for rectification because you
can do that in software. The output signal is entirely above ground,
you just have to find the center and calculate the dc average. The
number of samples has to be large enough to guarantee a small error,
but with your requirement of 0.5 to 1 full second reaction time you can
certainly get enough cycles in there for a 50 or 60 Hz line.
If you can get 100 samples in one cycle and you have 50 cycles in one
second that is 5000 samples total, which should certainly be enough.
Even 2500 samples would probably do it with good enough accuracy.
Round to the nearest power of 2 gives us 2048 samples, to make the
division fast.
For the low end of your measurement range, 125ma, at 100mv per amp,
that means you will only get 0.0178v out of the sensor, which with a
5.12v reference and a 10 bit ADC that will be 3 counts, which
means you wont get good accuracy at the low end of the range.
At the high end, 2.5 amps, the sensor will put out 0.354v, which is a
count of 70, also not too good but possibly doable.
The problem with the low end measurement is that the average value
may be hard to calculate. If the output of the sensor with 0 amps is
2.500v, then the output peak with 0.1 amps is 2.514v. That's only a 14mv
difference and that is a little bit of a problem because that's only 2 or 3
counts. At 0 amps the count would be 512, and at 0.1 amps the count
would be about 515, which isnt much to work with. If the samples
come at randomly placed intervals, we might get a good average, but
still we would not be able to make a distinction between 107 ma and 125ma
because at 107ma we get a count of 3 peak (over the center) and with
143ma we get a count of 4.
I dont know if this would work out in real life because there are things
like noise and drift to consider. With a setting of 107ma one time the
next hour later it might turn into a 143ma set point instead.
What you might have to do is use an op amp and automatic zero
detector (averager) to get some amplification AFTER the zero is
subtracted from the output of the sensor. This might not be too
hard to accomplish, but you would have to add an op amp stage.
Sound ok or no?
The amplification factor would be about 6, where a 2.5 amp peak would
provide the ADC with a voltage of 2.1v (plus the zero offset value) and
that would represent a count of 420 (plus offset count) and for the
0.125 amp peak it would be a voltage of 35, which is getting a lot more
reasonable.
Possibly going with an active rectifier (as i think you considered once before)
combined with the auto offset compensator (possibly all in one op amp)
we can turn the 0 to 2.5 amp range into maybe 0 to 4.5v, and obtain even
more accuracy...about twice as good as before meaning the low end
count is abut 70 (not bad).
So i guess the big question is, can you add an op amp stage?
Also, and i should have asked this last time, how many bits is your ADC?