HX711 produces noisy data with Boron

boron
Tags: #<Tag:0x00007fe2202a3348>

#1

Ever since I got my Borons 6 months ago, I’ve been having trouble getting good stable readings from my HX711 weigh sensors. With my Electrons, the readings were always rock-solid. This is a typical example of measurements using the HX711ADC library where I’m averaging 20 readings (constant weight, but no offset applied).
weight%20with%2020%20average
When I reduce the number of times the data are averaged to 1 (i.e. no averaging), the output is considerably more stable, but the outliers are greatly exacerbated (constant weight, offset applied). Clearly the risk of a bad data point increases with the number of reads.
BB1%20with%20filtering
I have investigated many possible causes, incl.:

  1. RF interference. I’ve experimented with placing the antenna at increasing distances from the Boron, incl fitting external antennas up to 3m away. No difference.
  2. Tried different Borons (six) – no difference
  3. Tried different HX711 ADC’s (eight) – no difference
  4. Tried different strain gauges (six) – no difference
  5. Tried different libraries (both Particle community libraries as well as a library I uploaded myself. Used standard example code too – no difference
  6. Tried slowing down the rate at which bits are clocked in. This is apparently a problem with MCUs which have fast clock speeds (see here). However, as I understand it, the Boron’s clock speed is slower than the Electron (64MHz vs 120MHz resp)? In any case, adding extra 1ms delays between clocking in bits did not stop the outliers.
  7. Tried swapping pins on the Borons (from D3 and D4 to A2 and A3) - no difference
  8. Tried filtering out bad data points with an IF statement. That helped considerably but new bad values still occur, and besides, this doesn’t get to the root of the problem.
    At this stage, I’m out of ideas as to what could be causing the outliers and what the fix might be. Has anyone else been having problems with Boron and HX711 outliers? Any help greatly appreciated!

Boron GPIO provides less current than Electron's GPIO?
#2

Hi, did you ever identify the cause of the problem?


#3

No, not yet! I’m still keen on hearing from anyone who is using the HX711 weigh sensor with any of the mesh devices.


#4

I don’t have a definitive cause or solution yet, but thanks to @blub, I do have an adequate work around. The work around involves using median values to effectively filter out the spikes. See post #46647.
Some sample data to show how well it works:

Single_raw Av_raw (50) Median_raw(50) Calibr_Wt (kg)
-55 516215 -51 0.00
-32 50972 -15 0.00
8307487 22228 -1 0.00
-2 59 8 0.00
-30 254021 -29 0.00
87 48455 -9 0.00
-81121 23 12 0.00
-41 20 -6 0.00
-81121 9980 -12 0.00
-38 -6 -26 0.00
-6 415389 -1 0.00
-11 65 -32 0.00
69 415412 -10 0.00
-55 22235 6 0.00
76 22 9 0.00
19 5 1 0.00
-81121 27 0 0.00
-50 857 8 0.00
2 205729 18 0.00
-10 30 51 0.00
-20 23094 31 0.00
-81121 100 54 0.00
51 2560 74 0.00
64 2575 33 0.00
89 -4008 47 0.00
77 22222 39 0.00
-26 214931 57 0.00
63 424561 32 0.00
10 59 48 0.00
26 100838 71 0.00
64 45 43 0.00
72 9332 40 0.00
25 57480 28 0.00
-81121 2632 60 0.00
102 63 56 0.00
53 32 66 0.00
40 96815 51 0.00
103 48410 51 0.00
34 621085 46 0.00
14 22232 54 0.00
8307487 75 78 0.00
4113183 129 59 0.00
114 353 110 0.01
113 191 130 0.01
213 145 139 0.01
202 415490 118 0.01
145 195 147 0.01
77 172 135 0.01
86 1086 119 0.01
169 1075 132 0.01
162 2665 140 0.01
212 135 130 0.01
8307487 233 155 0.01
8307487 141 135 0.01
159 148 149 0.01
119 133 137 0.01
152 268 139 0.01
108 161 118 0.01