Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    HX711

    Scheduled Pinned Locked Moved SiPy
    hx711 sipy micrpython load cel
    7 Posts 4 Posters 1.7k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Offline
      lefebvre
      last edited by

      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 ?

      robert-hhR 2 Replies Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @lefebvre
        last edited by

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

        1 Reply Last reply Reply Quote 2
        • robert-hhR Offline
          robert-hh @lefebvre
          last edited by

          @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)
          
          L 1 Reply Last reply Reply Quote 1
          • L Offline
            lefebvre @robert-hh
            last edited by

            @robert-hh , Thank you for these informations.
            I make a test and give you feedback as soon as possible ...

            1 Reply Last reply Reply Quote 0
            • M Offline
              Monkeyjacob17
              last edited by

              Hello,

              Did you succeed to use the modul HX711 with Sipy? I would to do the same with a Lopy.

              Thanks a lot,

              robert-hhR Q 2 Replies Last reply Reply Quote 0
              • robert-hhR Offline
                robert-hh @Monkeyjacob17
                last edited by

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

                1 Reply Last reply Reply Quote 1
                • Q Offline
                  quentho @Monkeyjacob17
                  last edited by

                  @Monkeyjacob17 i tried with robert-hh repository and it's working for me

                  1 Reply Last reply Reply Quote 1

                  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
                  • 1 / 1
                  • First post
                    Last post

                  Pycom on Twitter

                  Pycom