Hello again,
In May 2024 I presented myself to this forum with my scale set-up.
Limited time and real life matters stopped me to further work on the project. Also I got a bear messing with my bees.
I’m sharing below my findings during the HX711 calibration.
My Hivemon Scale set-up is using Grafana Cloud at the moment because I have only one scale prototype. My intention is to build a few more and use InfluxDb and Grafana as local instances on my home server.
In the mean time I did some updating to the set-up:
Adding HX711 disconnect feature.
Adding median filtering on the HX711 reads.
But of course I suppose all these were already covered in the forum.
I think it would be useful to explain my problem with the scale and the solution I found.
Problem:
I observed a difference between the weight reported with the “calibration-sketch” and the weight reported by the “main-firmware” later.
For me as a beginnner in electronics and programming, it was like searching a needle in a haystack.
Initially the calibration was done with a simple sketch, the “calibration-sketch”, the circuit was powered by USB continuosly and the OFFSET and the SCALE_FACTOR parameters were read directly and then hardcoded into the “main-firmware”. In this operating conditions both parameters seemed to be correct, and the weight reported was ok.
In the “main-firmware”, HX711 is not working in the same “continuous power supply” regime. By design I want my sensor to be low-power (because I’m using a PV and 2X 18650 batteries). Basically HX711 power supply is controlled by a P-MOS controlled by the ESP32 pin (Deep-Sleep cycle and wake-up at 15mins). So HX711 sleeps 15 mins and is woken up only before measurement. After power-up, the module needs time to stabilize and the first measurements can be unstable.
Because of this, calibration values obtained in the simple “calibration-sketch” does not corresponded with the real operating conditions of the HX711 from the “main”. Basically in the the weight reported by the “main” sketch was not correct. I had no ideea that the operating conditions matters so much for the calibration.
Solution:
The calibration procedure must reproduce exactly the operating steps of the “main” firmware (below is the updated “calibration-sketch” with the actual timings):
- sensorPowerOn() from ESP32 pin
- delay pentru power-on stabilisation through P-MOS
- HX711 initialisation - initHX711()
- scale.power_up()
- delay for HX711 stabilisation
- discard first unstable readings
- RAW read no weight
- RAW read with a known weight
- OFFSET and SCALE_FACTOR parameters calculation
In this way the calibration is done in the same conditions as the normal sensor operation. Active power-gating, same stabilisation delays, same start-up sequence and same discarding of the first readings.
After this change the OFFSET and SCALE_FACTOR parameters became “compatible” with the “main-firmware”, and the weight reported started to correspond to the real weight.
Conclusion:
The HX711 calibration should not be done in an “idealized” operating regime, with the HX711 continously powered, but in the actual operating regime of the scale using same power-gating, delays and read sequence.
Additional findings:
-
My scale support set-up is quite heavy (I use 50X30 mm steel squares for the double H support- probably 15kg) so initially I thought that the manipulation of the support between calibration and positioning at the beehives location is causing the weight errors. Actually this should not be a problem, I have a 50g difference after the support manipulation, so no issues from that.
-
I changed a few HX711 modules (keeping the same calibration parameters) to see if there is a change of the readings, it is but minor, some 10 grams difference, probably for some modules will be bigger.
-
On every internet source I searched it says that HX711 24bit ADC is very sensible and the readings can be affected if it sits close to the ESP32 WIFI antenna. In my set-up HX711 sits within 1cm distance to the ESP32, the readings are fine once the calibration is done correctly.
Thank you for reading this long post.
I hope this helps.
Please feel free to ask any questions, I’ll try to answer the best I can.
Best wishes,
Octavian