M5Unit Miniscale Questions

  • I recently bought a bunch of M5 hardware and I included the MiniScale just to try out (it was cheap!)...

    I am using it with a M5Stack Fire 2.7 controller, and once I got the code up and running, I noticed some weird behavior:

    • The weight reading drifts upward over time. I would estimate it gains a gram every 15-20 minutes. Is this just the nature of the sensor?
    • I don't have calibration weights, but I may be able to track some down and run a calibration sketch on it. However, I have also seen an example sketch (SettingGap.ino) in the library referenced on the docs page (https://docs.m5stack.com/en/unit/Unit-Mini Scales). Is there any documentation of what the gap value meaning is?
    • Is there an example sketch/program that operates like the video embedded near the end of the docs page I referenced above? It uses an animated scale graphic...

  • @spiff72 Many bathroom scales require you to TAP the scale to boot up.
    This not only saves battery but re-calibrates it every time you go to use it.
    The continued rise may be

    1. weight settling mechanically or
    2. the thin film resistors of the Wheatstone Bridge may be slightly heating or nearby electronics throwing of a little heat and losing calibration.

  • I partially answered my own question about the "gap" value. I realized that there was some info on the i2c protocol document that clarified that the gap was equal to (ADC100g - ADC0g)/100
    (where ADC0g = the rawADC value with 0g on scale, and ADC100g = rawADC value with 100g on scale)

    I had a period of time while I was doing some various programming tweaks and found the weight value displayed was climbing much more quickly (maybe 1g every couple of minutes). The battery was very low at that point, so I did an overnight test where I just left it running while it was charging and found that the displayed weight value on the display was less than 1g. Really weird! I wonder if the low voltage was the cause of the rapid drift?

    I also did some experimenting with the various filter settings (LP Filter, Avg Filter, and EMA filter). Avg filter seems self-explanatory, LP filter is presumably a low-pass filter (either enabled or disabled), and I had to google what an EMA filter was (exponential moving average).

    I just wish I could find some more documentation on this thing! I see some interesting behavior:

    • Weird oscillations when you remove a weight rapidly -- the value drops quickly, overshoots past zero to go slightly negative, and then settles back close to zero (after a cycle or two).
    • If you lift the scale by the measurement platform, I would have expected the value to go negative, but it actually goes positive instead. Since I could see it would go negative during the previously mentioned oscillation this caught me my surprise.
    • I need to figure out how to use the serial plotter in Arduino IDE so I can watch the oscillations. I swear I see some slow oscillation of the weight reading over longer periods of time (with a constant weight or zero weight on it).

  • As spiff72 also pointed out, negative weights are displayed as positive. That's quite confusing for our students. For now, I've addressed this by using the raw ADC data as a zero point after an offset (tare). If the value during a measurement is greater than the zero point, then the value of 'scales.getWeight()' is positive. If the value is smaller, then I multiply 'scales.getWeight()' by -1.
    I hope that issue is solved in the next library update.