An A/D converter is required for the weight sensors (load cells). Unlike other boards, such as the Arduino or the ESP32, the Raspberry Pi has no integrated A/D converter. An A/D converter converts the analog signal into digital values. Therefore we need this 3 Euro component for the Raspberry Pi.
Number of load cells per Raspberry Pi
The HX711 has two channels (A and B). This allows two load cells to be connected to one HX711 and two hives to be measured. Depending on the number of free GPIOs on the Raspberry, it is also possible to connect multiple HX711s. This means that at least 3 HX711s can be connected to one Raspberry Pi. In the maintenance mode the GPIOs of the boards can be set.
HX711 to Raspberry Pi:
- VCC at pin 02/5V, but better to a free 3.3V pin
- GND at pin 06/Ground
- DT at pin 29/GPIO5
- SCK at pin 31/GPIO6
Load cell (Bosche H30A) at HX711:
- Red at E+ (input)
- Black at E- (input)
- Green at A+ (output)
- White at A- (output)
Load cell (Banggood) at HX711 (has completely different assignment), see picture):
- Black at E+
- White at E-
- Red at A+
- Green at A-
Some load cells have the following colours:
- Red at E+
- Black at E-
- Grey at A+
- Green at A-
Does the HX711 always measure just 0kg?
Then the cables are probably not connected correctly or the load cell is defective. The cables are easy to check. To check whether the load cells are defective, we recommend the following video:
The HX711 measures wrong values?
That’s because you need to calibrate the load cell. See the article “Calibrating the load cell” to see how this works.
Improve measurement results of the HX711 module
- If there is still a 3.3V PIN free on the Raspberry Pi, or if you can use a 3.3V PIN twice thanks to the breadboard/plug-in board, we recommend connecting the VCC of the HX711 to a 3.3V PIN instead of a 5V PIN. Tests have shown that there are fewer outliers when measuring.
- There are different HX711 boards. Optimally the resistance between E- and GND should be zero. If this is not the case with this HX711 module, you can help by connecting a short cable between E- and GND. Further information can be found at the Arduino colleagues: https://beelogger.de/?page_id=195802_id=195802
- Some load cells, such as Bosche’s, have a fifth, thicker cable. This is the cable shield. You should put the cable screen on the housing. You can use it to attenuate external interference. Actually the housing is connected to the GND.
- The Green HX711 boards have one channel A and one channel B. The measurement results on channel B have a higher noise. We therefore recommend connecting several HX711 boards for several scale sensors. These are not expensive and the Raspberry has enough free GPIO.
- Experience has shown that there are cheap HX711s that don’t work well. If you buy a higher quality HX711 module ?, for example, you will also get measurement results. In addition, GND is already connected to E there.
- Outliers in the measurement can also occur because the surfstick is too close to the HX711 and interference occurs. A USB cable increases the distance.
Timing problems at Raspberry Zero with green HX711
With the Raspberry Zero, timing problems may occur during transmission to the HX711. Therefore the weight is not measured correctly and regular outliers or repeated measurements are the result.
A workaround is to lift pin 15 of the HX711 and connect it to VCC so the conversion runs more often and you have much better constancy in the values. (see picture above)
Furthermore, it helps to deactivate debug mode (this setting is in maintenance mode) and do not plug in an HDMI cable.
Translated 28.07.2019 by JK