3
\$\begingroup\$

I am using Raspberry Pi Pico, HX711, stepper and RFID. I want to make PCB for it. My system can work with or without HX711.
If system has HX711, stepper spins until the weight value of HX711. If system doesn't have HX711, stepper spins a certain turn (for example 5 turn).

So my code needs to find out, if HX711 is connected or not connected. How can I detect if HX711 is connected to my microcontroller or not? (Maybe with jumper some how but I don't know the technique.)

I am using this module HX711 (Amazon link).
This is my microcontroller: Raspberry Pi Pico.
I am using these on Arduino IDE.

\$\endgroup\$
0

3 Answers 3

3
\$\begingroup\$

If you have a pullup resistor on DOUT then you can attempt to start a conversion with a time out if it does not go low within the maximum conversion time allowed.

If it times out you can assume there is no HX711 or it is not operating correctly. I don't see a specified maximum in the HX711 datasheet, so you could use some reasonable multiple of the typical like double.

This is good practice anyway- so if the conversion fails for some reason during normal operation it will be detected and not just freeze in a loop waiting for the conversion to complete.


Since you have added a photo of the module, we can see that there is no pullup on the data out evident. Perhaps you can enable a GPIO pullup in your MCU module.

\$\endgroup\$
3
  • \$\begingroup\$ Thank you. I didn't think it is this much easy (If I understand it correctly). I used my MCU for pull up resistor and then I read it with digital. If hx711 connected to MCU, it return 0, if hx711 not connected to MCU it returns 1. Again, thank you. \$\endgroup\$ Commented Sep 13, 2022 at 14:20
  • 1
    \$\begingroup\$ pinMode(14, INPUT_PULLUP); Serial.println(digitalRead(14)); \$\endgroup\$ Commented Sep 13, 2022 at 14:29
  • \$\begingroup\$ My suggestion is to use this function from the Arduino HX711 library: "Non-blocking mode It is also possible to define a maximum timeout to wait for the hardware to be initialized. This won't send the program into a spinlock when the scale is disconnected and will probably also account for hardware failures" The DOUT input pin is already defined as having a pullup for non-Expressif chips so you should be okay without doing anything, according to my reading of the Arduino library source code. \$\endgroup\$ Commented Sep 13, 2022 at 15:31
3
\$\begingroup\$

If you send a clock signal and get data back (dout line changes) then this is a good indication that the hx711 is there. You would then have to do checks in the data too see if it is valid

\$\endgroup\$
0
1
\$\begingroup\$

The best diagram I can find is in the HX711 data sheet: -

enter image description here

This will be somewhat similar to the module you have bought. Options for detecting the presence of the module: -

  • Do a dummy read of data
  • Monitor the current in the Vsup line to see if there is a level of a few mA
\$\endgroup\$
0

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.