HX711 - which lib should I use?
Re: HX711 - which lib should I use?
machine.idle() just serves the purpose of avoiding a busy loop. time.sleep_ms(1) works as well.
Edit: I see machine.idle(). May you should use the daily build firmware. It progresses fast at the moment.
Edit: I see machine.idle(). May you should use the daily build firmware. It progresses fast at the moment.
-
- Posts: 3
- Joined: Sun Feb 14, 2021 6:45 pm
- Location: London, UK
Re: HX711 - which lib should I use?
Thanks the latest update appears to have fixed that issue, I have it working now for the scales.py file, with GPIO 16 as the data pin and GPIO as the clock pin. when I tried to run your hxtest.py example I am getting the following terminal message:
This is the only change I have made so far:Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "/lib/hx711_spi.py", line 9, in __init__
TypeError: extra keyword arguments given
Code: Select all
from hx711_spi import *
hx = HX711(16, 18, 19)
Re: HX711 - which lib should I use?
The driver uses the SPI call logic of pycom. You have to change that line in hx711_spi.py to:
self.spi = SPI(0, mode=SPI.MASTER, baudrate=1000000, polarity=0,
phase=0, sck=Pin(spi_clk), mosi=Pin(pd_sck), miso=Pin(dout))
Please note that the SPI clock will NOT be connected. The HX711 will be clocked by the mosi pin.
self.spi = SPI(0, mode=SPI.MASTER, baudrate=1000000, polarity=0,
phase=0, sck=Pin(spi_clk), mosi=Pin(pd_sck), miso=Pin(dout))
Please note that the SPI clock will NOT be connected. The HX711 will be clocked by the mosi pin.
-
- Posts: 3
- Joined: Sun Feb 14, 2021 6:45 pm
- Location: London, UK
Re: HX711 - which lib should I use?
Thank you Robert. I think I have it working now. I am using GPIO 16 as the data (miso) pin and GPIO 19 as the skc (mosi) pin.
Now to turn it into meaningful results! The plan is to make a data logger which I can use with load cells for work.
Now to turn it into meaningful results! The plan is to make a data logger which I can use with load cells for work.
Re: HX711 - which lib should I use?
I'm working with a high school robotics team that want's to use the hx711 with a pico to design some "smart" exercise equipment.
Would you be willing to share some samples of your code?
Jeff
Would you be willing to share some samples of your code?
Jeff
Re: HX711 - which lib should I use?
The repository contains samples of the code. At the moment, the SPI version is the best to use. But I can also make a PIO version, which makes use of the PIO state machine and should perform better. Just give me a day or two for set-up.
Re: HX711 - which lib should I use?
There is a variant now of the driver using the RP2040's PIO at https://github.com/robert-hh/hx711
Like the GPIO version it uses two pins only, but unlike GPIO, once started the timing cannot be affected by interrupts.
Like the GPIO version it uses two pins only, but unlike GPIO, once started the timing cannot be affected by interrupts.
Re: HX711 - which lib should I use?
Hi there Robert!
I’m using the https://github.com/robert-hh/hx711-lopy library to measure the weight from a load cell connected to a HX711 board with a ESP32 board(Huzzah32 from Adafruit).
I’m using de SPI version. The code does not return any kind of errors, but the value returned varies a lot even from negative to positive values.
Can you give any advice?
Thanks in advance
I’m using the https://github.com/robert-hh/hx711-lopy library to measure the weight from a load cell connected to a HX711 board with a ESP32 board(Huzzah32 from Adafruit).
I’m using de SPI version. The code does not return any kind of errors, but the value returned varies a lot even from negative to positive values.
Can you give any advice?
Thanks in advance
Re: HX711 - which lib should I use?
What is the range of the variation?
Did you connect the load cell properly?
Did you connect the load cell properly?
Re: HX711 - which lib should I use?
Thanks for you reply.
Changed to the GPIO version and all is good.
Will try the spi version soon
Thanks again
BTW do you think it possible and accurate (+-2g) to display weight variations per second?
Changed to the GPIO version and all is good.
Will try the spi version soon
Thanks again
BTW do you think it possible and accurate (+-2g) to display weight variations per second?