2
\$\begingroup\$

I have two circuits (green and brown) featuring a load cell, HX711, and ESP32-C3:

Photo of boards

The HX711 and ESP32-C3 go on top of those round female pin header.

The only difference between them is that one is using a 10 µF capacitor and 0.1 µF capacitor, which are connected to the VCC and GND of the HX711. People suggested I do this to keep the noise from the ESP32-C3 from distorting the load cell readings (especially when the ESP32-C3 connects to Wi-Fi.)

These are the readings of both circuits with no load applied (and with the ESP32-C3 connected to Wi-Fi and sending POST requests):

Graph of deviation of brown and green values from zero

(Y = deviation from 0 in grams, X: the reading number.)

I think that variance is normal. Am I wrong? I'm confused. How come the capacitors aren't making any difference in my circuits?

Also posted here.

\$\endgroup\$
18
  • 7
    \$\begingroup\$ It's impossible to draw any useful conclusion from 10 samples with unknown period between them - think of it as "extreme aliasing", the signal could be doing anything between the samples. You'd be much better off trying to use (borrow?) an oscilloscope to actually inspect the signals. \$\endgroup\$
    – Attie
    Commented Jul 17 at 12:58
  • 1
    \$\begingroup\$ If the capacitors you're referring to are on the perfboard, then they're likely the wrong choice (high ESR for the electrolytic), and too far away (long legs, pin interconnects) to be useful. \$\endgroup\$
    – Attie
    Commented Jul 17 at 13:00
  • 1
    \$\begingroup\$ Doesn't the HX711 already include it's own very high PSRR regulator onboard? If so I'd expect additional filtering to make little difference. \$\endgroup\$ Commented Jul 17 at 13:38
  • 1
    \$\begingroup\$ Both boards have already 10uF capacitors that probably are sufficient for the few tests that you did. Maybe an additional one is not needed 99% of the time, but could be that time to time the ESP32 needs more power than normal, the supply is not responding fast enough and the wind is blowing from the north. Then to have an additional cap close to the board could help. Or maybe is never needed. \$\endgroup\$
    – Gos
    Commented Jul 17 at 13:42
  • 1
    \$\begingroup\$ The HX711, that I suppose that could be more affected by power disturbances produced by the ESP32 when there is high WIFI activity or whatever. Could be that the onboard capacitors are enough, but to add another one just in case will not hurt. \$\endgroup\$
    – Gos
    Commented Jul 17 at 14:07

1 Answer 1

3
\$\begingroup\$

Decoupling capacitors are important. And they are a cargo cult. We put them in in the hopes that they prevent us from having problems. And they can do the job. You'll just never know if you needed all of them or even if you needed them at all (which is also a bit of a prevention paradox).

Also, measuring noise sometimes borders on black magic. Noise is really hard to measure. It's even harder to measure the results of noise because there could be countless other factors influencing the result.

So, decoupling parts with digital signals is always a good idea. Seeing a result is mostly a question of statistics. Statistics with many measurments over bigger spans of time. Eight measurements is by far not enough: I'd suggest to go to at least 1000 and do some statistical analysis if you want to get a usable result.

It's very well possible that you won't see a difference. But you can be almost 100% sure that you'll see a difference between a proper PCB and a prototyping board!

So I'd suggest getting the cap as close to the load as possible. Use two caps to be sure (ceramic or foil, maybe 10n or 100n) and a 10u one in parallel. The small one to get the high frequencies, the bigger one to get the slower stuff. Consider putting a small resistor in series to the load:

schematic

simulate this circuit – Schematic created using CircuitLab

This way you get a nice little filter... you can also replace the resistor with an inductor.

Will it be worth it? That's where we enter speculation territory. Maybe? Filtering is often done "just to be sure", "because someone has solved a problem like this in the past" and "because we've always done it that way". Also "because if it doesn't help, it doesn't hurt"...

\$\endgroup\$
6
  • \$\begingroup\$ Thanks for the suggestion. Sorry, by "as close to the load," you mean the HX711 or load cell? In my perfboards, the capacitors, the ones you suggested, are right next to the VCC and GND of the HX711 (which goes on top of those round female pin headers). Another question: why do I need a resistor? \$\endgroup\$
    – wyc
    Commented Jul 17 at 13:13
  • 1
    \$\begingroup\$ @wyc yes, as close to the HX711. What we do with the capacitors is basically creating a filter. But an filter with just a cpacitance is not filtering much. The filter constant is defined by the impedance of the source and the capacitance. Source impedance is normally pretty low so the cut off frequency gets relly hight (and since we don't know the input impedance we're just quessing. With the resistor we can get the cut off frequency down and controllable. \$\endgroup\$
    – kruemi
    Commented Jul 17 at 13:18
  • 2
    \$\begingroup\$ Today I learned what a "cargo cult" is. I second the "because if it doesen't help it doesn't hurt" \$\endgroup\$
    – S_G
    Commented Jul 17 at 14:18
  • \$\begingroup\$ @kruemi Sorry, so the left circle (Vcc 5V) is the HX711 and the right circle (MCU) is the ESP32-C3 (where my circuit is getting power from)? \$\endgroup\$
    – wyc
    Commented Jul 17 at 14:32
  • 1
    \$\begingroup\$ @wyc more generaly: left is the part that you want to protect from the noise of the right part... I've switched the Caps around btw because you want to have the small cap closer to the noise source... \$\endgroup\$
    – kruemi
    Commented Jul 17 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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