HX711 sometimes gives wrong reading to MQTT broker

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kaczmar1989
Normal user
Posts: 13
Joined: 02 Jun 2022, 12:12

HX711 sometimes gives wrong reading to MQTT broker

#1 Post by kaczmar1989 » 22 Feb 2023, 13:44

Hi, I have a problem with readings from HX711 to Wemos D1 mini - The system is a beehive scale with two sensors.
System description:
Wemos D1 mini

scale 1 - first HX711 - pins SCK - D7 and DAT - D6 - Measurement Channel A - gain 128,
scale 2 - second HX711 - pins SCK - D1 and DAT - D2 - Measurement Channel A - gain 128.
Waga - forum.png
Waga - forum.png (14.01 KiB) Viewed 1651 times
Waga - forum 2.png
Waga - forum 2.png (15.56 KiB) Viewed 1651 times

The system starts every 15 minutes and reads 2 scales from 2 different HX711, the reading interval HX711 is 10 sec.

Problem with readings - the system sometimes sends values ​​significantly different from the correct reading to the HA MQTT controller, e.g. a correct reading of 14 kg, without changing the load, the system suddenly gives a reading of -3,8 kg and then again 14 kg.
HA2.png
HA2.png (26.82 KiB) Viewed 1651 times
Is it possible to apply rules to reject, for example, the largest and smallest result that will be passed to the controller?

Or do you have any other ideas to solve the problem?

Thank you in advance for your help
Last edited by kaczmar1989 on 22 Feb 2023, 14:05, edited 3 times in total.

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: HX711 sometimes gives wrong reading to MQTT broker

#2 Post by Ath » 22 Feb 2023, 13:54

What version of ESPEasy do you have installed on your ESP?
/Ton (PayPal.me)

kaczmar1989
Normal user
Posts: 13
Joined: 02 Jun 2022, 12:12

Re: HX711 sometimes gives wrong reading to MQTT broker

#3 Post by kaczmar1989 » 22 Feb 2023, 13:57

Build: ESP_Easy_mega_20221224_collection_A_ESP8266_4M1M_VCC Dec 24 2022

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: HX711 sometimes gives wrong reading to MQTT broker

#4 Post by Ath » 22 Feb 2023, 14:16

Please download the ESP8266 zip file from this Github Actions run, and install the same Collection A build (via Tools/Update Firmware button).
I've fixed a few issues with the HX711 plugin recently (multiple plugin-instances, dual-channel support, stability), that's already merged but not yet released.

You will need a (free) Github account to be able to download that file.
/Ton (PayPal.me)

kaczmar1989
Normal user
Posts: 13
Joined: 02 Jun 2022, 12:12

Re: HX711 sometimes gives wrong reading to MQTT broker

#5 Post by kaczmar1989 » 22 Feb 2023, 14:23

Thanks, I'll test it and let you know if it works.

kaczmar1989
Normal user
Posts: 13
Joined: 02 Jun 2022, 12:12

Re: HX711 sometimes gives wrong reading to MQTT broker

#6 Post by kaczmar1989 » 22 Feb 2023, 15:40

It doesn't work properly - after Deep sleep first it sends 0 kg to the MQTT broker and next step send the correct weight.
HA po zmianie.png
HA po zmianie.png (20.57 KiB) Viewed 1628 times

In domoticz it correctly sends the weight to controlers.
domoticz.png
domoticz.png (92.48 KiB) Viewed 1628 times

kaczmar1989
Normal user
Posts: 13
Joined: 02 Jun 2022, 12:12

Re: HX711 sometimes gives wrong reading to MQTT broker

#7 Post by kaczmar1989 » 23 Feb 2023, 21:18

Do you have any idea how to solve the problem of sending value 0 after deep sleep?
HA-3.png
HA-3.png (49.4 KiB) Viewed 1567 times
In domoticz it correctly sends value.
domoticz - 2.png
domoticz - 2.png (114.29 KiB) Viewed 1567 times

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: HX711 sometimes gives wrong reading to MQTT broker

#8 Post by Ath » 23 Feb 2023, 21:27

kaczmar1989 wrote: 23 Feb 2023, 21:18 Do you have any idea how to solve the problem of sending value 0 after deep sleep?
That will probably need a new setting, to suppress the first value after startup. After initialization of a plugin, the Plugin_Read event is fired, as if an Interval has passed.

I assume it is often used with a 0 starting point, so that it doesn't matter that the initial measurement is 0...
/Ton (PayPal.me)

kaczmar1989
Normal user
Posts: 13
Joined: 02 Jun 2022, 12:12

Re: HX711 sometimes gives wrong reading to MQTT broker

#9 Post by kaczmar1989 » 23 Feb 2023, 21:41

When there is a load on the scale all the time - the weight of the hive - a reading of 0 is misleading and destroys the graph.

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: HX711 sometimes gives wrong reading to MQTT broker

#10 Post by Ath » 23 Feb 2023, 21:43

kaczmar1989 wrote: 23 Feb 2023, 21:41 When there is a load on the scale all the time - the weight of the hive - a reading of 0 is misleading and destroys the graph.
Yes, that's clear. I only recently worked on the code of that plugin, it has been in ESPEasy for longer then I have been using/working on ESPEasy :D
/Ton (PayPal.me)

kaczmar1989
Normal user
Posts: 13
Joined: 02 Jun 2022, 12:12

Re: HX711 sometimes gives wrong reading to MQTT broker

#11 Post by kaczmar1989 » 23 Feb 2023, 21:47

If you solved my problem i would be very happy.

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: HX711 sometimes gives wrong reading to MQTT broker

#12 Post by Ath » 23 Feb 2023, 22:40

I have created a pull request #4517 to this effect. It is available from this Github Actions run in a short while, for you to test.
/Ton (PayPal.me)

kaczmar1989
Normal user
Posts: 13
Joined: 02 Jun 2022, 12:12

Re: HX711 sometimes gives wrong reading to MQTT broker

#13 Post by kaczmar1989 » 24 Feb 2023, 13:50

Now correctly reports the value to the mqtt broker. I will leave a few days for testing without changing the load - we'll see if it works stably.
Ha-4.png
Ha-4.png (20.78 KiB) Viewed 1502 times

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: HX711 sometimes gives wrong reading to MQTT broker

#14 Post by Ath » 24 Feb 2023, 19:37

Thanks for the feedback ;)

Looks really promising 8-)
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: HX711 sometimes gives wrong reading to MQTT broker

#15 Post by TD-er » 24 Feb 2023, 23:25

Those load cells and HX711 can be somewhat sensitive to temperature, so keep that in mind when you experience some drift without changing the load.

kaczmar1989
Normal user
Posts: 13
Joined: 02 Jun 2022, 12:12

Re: HX711 sometimes gives wrong reading to MQTT broker

#16 Post by kaczmar1989 » 25 Feb 2023, 10:49

Yes, I know, I noticed temperature-dependent changes in the indication, but the values ​​change very little. It works fine for now. There are no big jumps in value. Such accuracy is enough for the weight of the hive.
HA-5-Waga.png
HA-5-Waga.png (12.81 KiB) Viewed 1433 times

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 45 guests