3
\$\begingroup\$

I have been working to create a digital scale for IOT project, using HX711 ADC.

The problem

Since it is crucial to have wifi connection, I use Raspberry Pi, to control the scale.
Everything works well, when wires between Raspberry and the HX711 stay in 20cm range, but problems gradually start to occur, when wires get longer than that. The measurements are much more off in case of 50cm wires and absolute garbage at 100cm.

Tried the same configuration on Arduino UNO, no problems there.

Possible causes

I am not sure, if the system doesn't work, because

  1. I am using RaspberryPi with Linux based operating system, and that is not meant to controlling hardware.
  2. I am using Python library for the HX711 Github link for the library

Or maybe it is both. My own experience regarding issues like this is somewhat limited, maybe somebody could point out an elegant solution around this problem (cost of the solution is pretty important factor as well)

\$\endgroup\$
6
  • 2
    \$\begingroup\$ You talk about "wireless connection", and then you use the word "wire". So are you wireless or not? And regarding linux, there is literally nothing that linux cannot do (or something so exotic that no average person knows about it anyway :D ). It's always a question of how. \$\endgroup\$ – Ilya Feb 10 at 21:46
  • 1
    \$\begingroup\$ Do you use 3.3V or 5V supply to the HX711? \$\endgroup\$ – Dejvid_no1 Feb 10 at 21:54
  • 4
    \$\begingroup\$ The PI gpio does not have very strong drive capability as compared to the UNO. Nevertheless, it is not a good idea to have much distance between the controller and the hx711. As well, how you configure the wiring also has an effect. Since the load cell wiring is not carrying high speed digital signals, you are better off extending the wiring to the loadcell. You may also need to consider protection from lightning etc if it is run a long distance. I’d suggest using an esp32 rather than a Pi if you need WiFi. \$\endgroup\$ – Kartman Feb 10 at 21:55
  • 3
    \$\begingroup\$ You might like to (a) lower sample rate to see if performance improves, (b) use a "smaller" load cell for higher accuracy. You might also like to see some of my experiment blog posts: (1) How to read HX711 based weight scale - www.raspberrypi.org/forums raspberrypi.org/forums/viewtopic.php?f=37&t=227137 (2) Searched query: hx711 tlfong01 found 62 matches - www.raspberrypi.org/forums/search raspberrypi.org/forums/… Cheers. \$\endgroup\$ – tlfong01 Feb 11 at 2:15
  • 2
    \$\begingroup\$ @Dejvid_no1 I use 5V supply. \$\endgroup\$ – Andri Busch Feb 11 at 7:50
3
\$\begingroup\$

This is not a software issue, but a fact of data transmission. There are signal losses in wired just as in wireless signals. This is either due to the resistance/capacitance of the wire or the noise pickup from other signals.

You could experiment to see what could be done to improve it: higher current through the wires, shielding/twisted pairing.

\$\endgroup\$
7
  • \$\begingroup\$ Thanks, but how do you explain that everything works with Arduino? \$\endgroup\$ – mrts Feb 11 at 20:10
  • 2
    \$\begingroup\$ @mrts Arduino UNO's GPIOs maximum current is rated at 40mA at 5V, whereas RPi's is 3.3V at 16mA. \$\endgroup\$ – tanto Feb 11 at 21:37
  • \$\begingroup\$ Thanks for explaining! The original poster tells in comments that he is using 5 V supply with Raspberry Pi which seems to contradicting - any ideas how this is possible? \$\endgroup\$ – mrts Feb 12 at 12:53
  • \$\begingroup\$ @mrts he could mean a few things. Is he powering the Pi or HX with 5V? The issue is with the GPIO port ( the ones that transmit the data). They are limited to 3.3V 16mA. \$\endgroup\$ – tanto Feb 12 at 19:07
  • \$\begingroup\$ Thanks again, much appreciated! @andri-busch, can you comment? \$\endgroup\$ – mrts Feb 12 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.