I have four HX711s load cell amplifiers and each one reads one load cell. I was using the 10 Hz mode, however, this was making my application very slow, as I needed to take five readings and take the average.
When I put the 15 RATE in 1 there is a lot of noise, despite having sped up the reading of the weights; sometimes the variation is up to 3 digits at the end.
See the code for reading the modules where I already show the weights in kg:
n = 6;
for (int x=0; x<n; x++) {
v1[x] = CELL1.read();
v2[x] = CELL2.read();
v3[x] = CELL3.read();
v4[x] = CELL4.read();
}
v1m = 0;
v2m = 0;
v3m = 0;
v4m = 0;
for (int x=1; x<n; x++) { // sum of array
v1m = v1m+v1[x];
v2m = v2m+v2[x];
v3m = v3m+v3[x];
v4mv= v4m+v4[x];
}
// mean array
v1m = v1m/(n-1);
v2m = v2m/(n-1);
v3m = v3m/(n-1);
v4m = v4m/(n-1);
p1 = p;
p = ((v1m-v10)/(M[1]) + (v2m-v20)/(M[2]) + (v3m-v30)/(M[3]) + (v4m-v40)/(M[4]))/2.5; // show the weight in kg
p = p*o.7+p1*0.3; // convert to kg
// ... i print the p (weight in kg) now...
-
Please show your complete code, wiring and which deviations you actually get in comparison between 10 and 80SPS settingchrisl– chrisl2020年04月03日 20:27:53 +00:00Commented Apr 3, 2020 at 20:27
1 Answer 1
I had a very similar problem with 4 load cells. I ran 10,000+ readings at 80Hz, copied the serial monitor into MS Word to find my string (text) value labels and replace them with nothing. This lets me keep the numbers. If you copy that into Excel and make a scatter plot graph you can see where your highs and lows are and their magnitudes. I was able to simply write an IF condition to reject those outliers. Interestingly the outliers are very large (positive or negative) and they weren't just random values. They were also occurring at a specific frequency that may have more to do with my application rather than being an element to your solution.
-
1Your answer could be made more complete by including the part of your code that does the filtering for outliers, or by describing it in more detail. Did you use some kind of median filter or something different?StarCat– StarCat2023年08月17日 13:21:02 +00:00Commented Aug 17, 2023 at 13:21