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 ?
@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.