RobTillaart / ACS712

Arduino library for ACS Current Sensor - 5A, 20A, 30A
MIT License
129 stars 35 forks source link

investigate float midPoint #29

Closed RobTillaart closed 1 year ago

RobTillaart commented 1 year ago
RobTillaart commented 1 year ago

investigation.

results

what PROGMEM RAM
before 2650 423
after 4062 437
diff +1412 +14

observations

For an Arduino UNO this is quite some extra RAM for a possible small improvement of accuracy.

Performance wise there is no advantage as samples are taken for a fixed time e.g. 20 millis. In fact the float operations cause less samples to be taken due to the float math overhead.

conclusions (prelimenary)

Replacing midpoint uint16_t ==> float does not improve the library enough to implement.

RobTillaart commented 1 year ago

Some thoughts

1 ADC step for an Arduino UNO ADC ~ 0.1% ~ 0.005 volt Datasheet ACS712 states the error < 1.5% Improving midpoint with 0.05% will likely have little effect on accuracy.

The noise of the ACS712 is default 0.021 volt ~ 4 x 0.005 volt ~ 4 steps Improving midpoint with 0.05% (half step max), might improve a bit on the noise level measurements. ==> half step on 4 steps ==> 1/8th == 12%. on average probably half of that ==> 6%

As small currents are just above noise level there might be a gain at those levels. in theory at 8x noise level the gain could be 12%/8 = 1.5% so the effect of the error margin is equally large. 8x noise range ~ 30 steps which is the bottom 3% of the range (assuming 1023 steps) On average the effect might be affecting only the lowest 1% of the measurements.

RobTillaart commented 1 year ago

Might redo some investigation with external ADC? release 0.3.4


no time