HX711
-
Hello,
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 ? -
@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:
clk_pin(1)
clk_pin(0)
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. -
@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.
Test script: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) -
@robert-hh , Thank you for these informations.
I make a test and give you feedback as soon as possible ... -
Hello,
Did you succeed to use the modul HX711 with Sipy? I would to do the same with a Lopy.
Thanks a lot,
-
@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. -
@Monkeyjacob17 i tried with robert-hh repository and it's working for me
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login