I use a SiPy board for a connected hive.
I'd like to use a HX711 for the load cell but I don't find any example in Micropython.
Is there somebody who has already used this HX711 board with a Pyboard ?
Thanks for any help ?
@Monkeyjacob17 i tried with robert-hh repository and it's working for me
@Monkeyjacob17 I have used the HX711 with a LoPy (and other) device. The repository is here: https://github.com/robert-hh/hx711-lopy
There are two variants. One is using GPIO bit-banging, the other SPI.
I uses both, but the SPI variant seemed a little bit more reliable. But it requires to specify a third PIN, which is not used.
The hxtest.py script uses the SPI method, whereas the example in the README uses the bit bang variant.
Did you succeed to use the modul HX711 with Sipy? I would to do the same with a Lopy.
Thanks a lot,
@robert-hh , Thank you for these informations.
I make a test and give you feedback as soon as possible ...
@lefebvre The typical duration of a pulse created with pin(1), pin(0) is 6 µs, with some pulses being longer. The longest pulse seen was about 24 µs when irq was disabled for the pulse and 90 µs when irq was enabled.
from machine import Pin, enable_irq, disable_irq from utime import sleep_us pin = Pin("P12", Pin.OUT) while True: state = disable_irq() pin(1) pin(0) enable_irq(state) sleep_us(500)
@lefebvre If you look at forum.micropython.org and search for HX711, you'll find a thread about the HX711. The problem was, that the clock pulse high period must not exceed 50 µs. Os if you do that with Pin functions, be sure to bracked the whole I/o with machine.disable_irq() and machine.enable_irq(), and use for the high pulse the shortest sequnce, like:
I can check later whether this is shorter than 50 µs. Unless there is a cache page fault between these two statements, it should. The timing would be better using SPI, but the chip uses the number of clock pulses as method for configuration. You have to send exactly 25 - 27 clock cycles, which is not possible with SPI, which sends data in multiples of 8 bits.