RobTillaart / HX711

Arduino library for HX711 24 bit ADC used for load cells and scales.
MIT License
88 stars 29 forks source link

Multiple HX711 using MCP23017 #43

Closed middlegrey closed 1 year ago

middlegrey commented 1 year ago

Firstly, thanks for all your work!

Is it possible to connect multiple HX711 chips to an Arduino using MCP23017 port expanders?

RobTillaart commented 1 year ago

Never tried. Technically I think it would be possible however the library does definitely not support it. The library would need drive the clock and data line with mcp23017 calls. So the lowest level of the library needs to be replaced.

RobTillaart commented 1 year ago

Have a look at the HC4052 multiplexer. It would allow one HX711 object talk to 4 devices. Just set the channel to 0..3 to select device. Less complex for sure.

middlegrey commented 1 year ago

Thanks for the quick response.

I've tested the MCP23017, HC4051 and HC4052 but can't seem to get any to work. The HX711 seems to calibrate in the setup but then just prints the same (incorrect) value in the loop. With the MCP23017 the value changes if I add weight at the exact moment it performs a read, but it's not changing constantly like when I connect the HX711 directly to the Arduino.

I'll keep trying when I have some more time.

RobTillaart commented 1 year ago

Mmm, of course (bright moment of insight) Every HX711 has its own calibration / tare so when changing channel these should be adjusted too.

Alternative(?) Use a co processor? Using a 2nd UNO to connect a number of HX devices and provide their values over Serial?

Id, weight
0, 0
1, 123
2, 0
3, 509
Etc

The receiving end can request a specific number by sending the id to the co-processor. If the co-processor caches the last vslues, it can respond within milliseconds.

An UNO should be able to handle at keast 5 Hx711 devices. Using the analog pins for io could make that probably 9

middlegrey commented 1 year ago

I'm needing to read 32 load cells so will go with an Arduino Giga to simplify things.

RobTillaart commented 1 year ago

Not tested my library with the GIGA board but I see no reason why it should not work. I'm interested if the library works well with the GIGA so please let me know.

RobTillaart commented 1 year ago

Any progress with the GIGA board?

middlegrey commented 1 year ago

Still finalising the hardware, hopefully next week

RobTillaart commented 1 year ago

Any progress with the GIGA board? Can the issue be closed?

RobTillaart commented 1 year ago

@middlegrey As there is no progress reported, I assume the problem is solved and I close the issue. Feel free to reopen the issue if there are problems with the Giga