Unprecise measurements with HX711 and Wemos D1 Mini v4

Hi all,
have read quite a bit about the HX711 in combination with a Wemos D1 mini, but haven't really gotten anywhere yet so looking here for support.

Starting my summary from a hardware side, as I am pretty sure this is core to the problem. I am using a Wemos D1 mini v4. To this device, I have connected:

  1. 1.3" I2C OLED display (PIN 5, PIN 4, 3.3V & GND)
  2. HX711 (Purple Board Load Cell Amp) with 750g Load Cell (PIN 12, PIN 13, VBUS & GND)
  3. Reed Sensor (PIN 2 + GND)
  4. TTP223 Capacitive Touch Button (PIN 14, 3.3V & GND)

The Wemos is hooked up via USB-C to an iPad charging adapter (which I would hope does not produce much noise).

The load cell is connected directly to the HX711 inside the housing of the scale, so wires are shortened. They are not twisted which I read in the HX711 ADC library on Github. Would I twist the two DOUT + SCK cables and the two 5V + GND? I wasn't able to find info on that.

I am using a 30AWG (4 core) wire for the digital connection between the HX711 and the Wemos D1 mini and a 30AWG (2 core) wire for the connection to the reed sensor.

The issue: Readings are super inconsistent. The same object might weigh 200.8 g once and then 199g. Also values tend to move up by .1g steps so that the weight is steadily increasing. The scale also does not go back to zero. I am planning to use it as a coffee scale, so I want to get this as precise as possible. The issue persists with the HX711 from bogde (github) and HX711_ADC from olkal (gitub).

Hope the info helps to understand the setup. Where should I start? Is there any site that summarizes HX711 + Load Cell "best practices"? All tutorials appear to just be connecting the load cell to the HX711 and it "just" works... No special wiring, etc... Thanks a lot in advance!

i would not recommend to drink a cup coffee made from 200g coffee beans

1 Like

Please post schematics and the code according to this link: How to get the best out of this forum - Using Arduino / Installation & Troubleshooting - Arduino Forum

Take a look in the datasheet for the sensor. Look for repeatability. You have calibrated the setup but there's always an inaccuracy, told in the datasheet.
200.8 - 199 == 1.8. 1.8 / 200 gives and error of 0.9 percent. That's good numbers! Remember the half digit error in all digital readings.
What do You expect to read?

How did you power your HX711 (hand-drawn diagram).
Most HX711 boards are 5volt only (for the 4.3volt regulator for the load cell to do it's job).
A WeMos D1 mini is 3.3volt-logic (an ESP8266 doesn't like 5volt on it's I/O).

Sparkfun is AFAIK the only manufacturer that sells HX711 boards with split supplies.
5volt for the load cell part and 3.3volt for the logic part.
If you can solder, then you can try to mod a common HX711 for dual supply.
Schematics are on the Sparkfun site.
Leo..

Hi, first of all thanks a lot for the responses. I have figured it our yesterday and the issue was much simpler then expected... While I was looking into shielding wires, etc... The screws that mount the load cell to my 3D printed housing were just too tight :upside_down_face: Loosening them has led to significant improvements.

I have tried the tools listed under Railroaders link, but the components appear to not be available in any of the CAD tools. So here is the "hand drawn" diagram of the load cell connection.

My load cell sometimes still does not go back to zero, but goes to .1/.2 or -0.1/-.2 - I believe there might be better codes than what I am using (see below). Any guidance on this would be highly appreciated. Also: I have bought the load cell for 3€ + shipping. Would be willing to spend a bit more if I get something better. Any hints where to find higher quality load cells?

@Wawa - Do I understand you correctly that you would recommend using 3.3V from the D1 and 5V from the power source?

if (scale.wait_ready_timeout(200)) {
    // Read the raw scale value
    float rawReading = scale.get_units();

    // Apply the moving average filter
    readings[readingsIndex] = rawReading;
    readingsIndex = (readingsIndex + 1) % 5;

    float filteredReading = 0.0;
    for (int i = 0; i < 5; i++) {
      filteredReading += readings[i];
    }
    filteredReading /= 5.0;

    // Update the display if the filtered reading is different from the last one
    if (filteredReading != lastReading){
      reading = filteredReading;
      updateDisplay(); 
    }
    lastReading = filteredReading;
  }
}

It's best practice to post complete code AND use code tags.

That module only has one power connection (VCC).
You should use a Sparkfun board, which has two power connections.
Analogue VCC, which connects to 5volt, and digital VDD which connects to 3.3volt.

The way you have it wired now works, but is potentially dangerous for the WeMos pins,
because you're shoving 5volt-logic into a 3.3volt logic processor.
Don't be surprised if the WeMos fails.
Leo..

Thank you very much, that is very good to know. If I get the SparkFun Amp, would it be fine to connect the VBUS Pin to VCC and the 3.3V Pin to VDD of the HX711?

And one more question:

Then VCC and VDD just need to be hooked up to 2.7-5V and GND to ground on your microcontroller.

see Sparkfun
They hook both up to 5V in their own diagram and don't use the 3.3V Pin? This setup would be the same as mine, or not?

They even say in their example code in the link above

The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.

Yes.

In the hookup example they use a 5volt-logic redboard. Then VDD also needs to be 5volt.
It would have been better if they had shown that their HX711 board also can be used with 3.3volt logic processors.

Don't know where in the document.
The HX711 chip can be powered with 2.7volt to 5.5volt, but that doesn't mean that a HX711 board can be powered with that. The board has a 4.3volt regulator included, for the supply of the load cell. That voltage regulator should not be powered with less than 4.5volt.
Leo..

1 Like

Ok, thank you - I will order this board from Sparkfun.

Besides the power supply: Is there any good overview for best practices and algorithms? E.g. which wires should be twisted between the load cell and the HX711 as suggested in the HX711_ADC library on github (I assume the two data cables in one pair and GND+VDD+VCC in the other? Do I need a shielded wire for the digital connection between HX711 and Wemos D1 or is that not that big of a deal?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.