Interface 3kg loadcell with HX711 module using Nucleo-F746ZG

thanks

Hello,

Good news I received the package with my HX711 and load cell yesterday.
I already test it and I faced same issue like you but after few test I found it is communication issue. It is strange because it is very simple and just over digital pins.

It seems like the main issue is the library was ported from β€œslow” Arduino for a slow Mbed target but it was not properly tested on boards with better performance like STM32F7XX is. And this is the issue, the F7 seems to be too fast for that communication and need to be more controlled.

In the Datasheet of HX711 is written…
image
With high performance MCU it is probably possible to achieve higher speed of pin toggling and then the representation of code (like below) can be unseen for HX711 times to times.

  sck=1; 
  sck=0;

So I add some delay (like blow) and it is working now.

  sck=1; 
  wait_us(2);
  sck=0;
  wait_us(2);

You can import already modified library (example is in readme file) - JohnK1987/Mbed_lib-HX711_LoadCell: Library for interfacing ADC HX711 with a Load cell under MbedOS (github.com)

BR, Jan

1 Like

OK, I found same behavior and same solution in Arduino library. Also few threads about this issue around ESP32 and another boards with similar performance.
So it seems like good catch and confirmation that I was right.

I hope it helps to understand and solve your issue.

BR, Jan

Any progress?

BR, Jan

@JohnnyK

This Library is working perfectly fine. I really appreciate your efforts for helping me out. Now the output values I am getting are close and more accurate.
Thanks

Thank you for feedback.

BR, Jan

1 Like

hi johnny i used MbedOS 5 version this same library
load cell value( with out Weight )its giving wrong value.

`n of correct calibration factor value
Weight: -4010.54g, calib: -702.00
Weight: -6020.20g, calib: -702.00
Weight: 1347.58g, calib: -702.00
Weight: -2349.68g, calib: -702.00
Weight: 4169.42g, calib: -702.00
Weight: 920.88g, calib: -702.00
Weight: -3764.71g, calib: -702.00
Weight: -1876.87g, calib: -702.00
Weight: -6049.83g, calib: -702.00
Weight: -1595.41g, calib: -702.00
Weight: 920.84g, calib: -702.00
Weight: -2230.30g, calib: -702.00
Weight: 1347.44g, calib: -702.00
Weight: -1923.55g, calib: -702.00
Weight: -2281.39g, calib: -702.00
Weight: 1343.14g, calib: -702.00
Weight: -6430.57g, calib: -702.00
ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :HX711 calibration sketch
Remove all weight from scale
After readings begin, place known weight on scale

                                                                                                                   If you see incorrect weight, then use math Rule of three for calculation of correct calibration factor value
                                  Weight: 2338.31g, calib: -702.00
                                                                  Weight: 1091.31g, calib: -702.00
                                                                                                  Weight: 2640.68g, calib: -702.00
                                                                                                                                  Weight: -1093.03g, calib: -702.00
                                                                                                                                                                   Weight: 1498.63g, calib: -702.00
      Weight: 2119.02g, calib: -702.00
                                      Weight: 201.05g, calib: -702.00
                                                                     Weight: 591.19g, calib: -702.00
                                                                                                    Weight: 146.39g, calib: -702.00
                                                                                                                                   Weight: 2634.12g, calib: -702.00
                                                                                                                                                                   Weight: 935.96g, calib: -702.00
     Weight: 566.56g, calib: -702.00
                                    ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :HX711 calibration sketch
Remove all weight from scale
After readings begin, place known weight on scale

                                                                                                                   If you see incorrect weight, then use math Rule of three for calculation of correct calibration factor value
                                  Weight: -0.00g, calib: -702.00
                                                                Weight: -0.00g, calib: -702.00
                                                                                              Weight: -0.00g, calib: -702.00
                                                                                                                            Weight: -0.00g, calib: -702.00
                                                                                                                                                          Weight: -0.00g, calib: -702.00
                                                                                                                                                                                        Weight: -0.00g, calib: -702.00
                         Weight: -0.00g, calib: -702.00
                                                       Weight: -0.00g, calib: -702.00
                                                                                     ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :ΓΏ

Select The case :HX711 calibration sketch
Remove all weight from scale
After readings begin, place known weight on scale

                                                                                                                   If you see incorrect weight, then use math Rule of three for calculation of correct calibration factor value
                                  Weight: -0.00g, calib: -702.00
                                                                Weight: -0.00g, calib: -702.00
                                                                                              Weight: -0.00g, calib: -702.00
                                                                                                                            Weight: -0.00g, calib: -702.00
                                                                                                                                                          Weight: -0.00g, calib: -702.00
                                                                                                                                                                                        Weight: -0.00g, calib: -702.00
                         Weight: -0.00g, calib: -702.00
                                                       Weight: -0.00g, calib: -702.00
                                                                                     Weight: -0.00g, calib: -702.00
                                                                                                                   Weight: -0.00g, calib: -702.00
                                                                                                                                                 Weight: -0.00g, calib: -702.00
                                                                                                                                                                               Weight: -0.00g, calib: -702.00
                Weight: -0.00g, calib: -702.00
                                              Weight: -0.00g, calib: -702.00
                                                                            Weight: -0.00g, calib: -702.00
                                                                                                          Weight: -0.00g, calib: -702.00

`

Hello,

I have no idea for now. I will check that probably today but later, I have no access to the hardware at the moment.

BR, Jan

ok johnny i will wait for your valuable feedback,

#define SCALE_VALUE 259.79 //multiple propre Γ  chaque hardware
what is the SCALE_VALUE ,how will Calculate in HX711.

This is a default constant what is overridden during your calibration via
setScale method. Look to example code in README

BR, Jan

It is how I expected. I see no differences between usage of MbedOS 6.17 or MbedOS 5.15.9. I am able easily measure weight of two coins (9g + 8g) individually or together with stable result.

BR, Jan