Open jagannathmurali opened 2 years ago
I also get some spikes
I do think it's an issue in how Write/Read cycles are handled by the library. It chokes on itself from time to time...
It's pretty unusable imo
Meanwhile I bought another chip on Ali which doesn't have this issue (ads1232ipwr).
You can median filter them out easily:
static inline void swap(float &a, float &b) { float t = a; a = b; b = t; }
static inline float medianFilter(float value) {
static float acc[3] = {0, 0, 0};
static int pos = 0;
acc[pos % 3] = value;
if (pos < 2) return value;
pos++;
if (acc[0] > acc[1]) swap(acc[0], acc[1]);
if (acc[1] > acc[2]) swap(acc[1], acc[2]);
return acc[1];
}
I found a workaround for this issue. You can simply power down the chip between each reading. It removes all the spikes for me but significantly reduces the acquisition frequency.
This issue still persists. I think that's a fault in the chip design itself.
EDIT: What I've discovered, however, is that when a spike arises, the next ADC value needs a longer time than usual. This could be used to filter out most of these spikes.
Originally posted by @Fusseldieb in https://github.com/bogde/HX711/issues/83#issuecomment-844327053