HX711 Raspberry pi pico

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
neveregret
Posts: 28
Joined: Sun Aug 08, 2021 5:48 pm

HX711 Raspberry pi pico

Post by neveregret » Wed Aug 11, 2021 12:56 pm

Hello guys,I am new for using micropython and i want to use loadcell. I found this library https://github.com/robert-hh/hx711 .Thıs library literally says everything .But as i said earlier, i m new with these projects so i want to konw how can i scale this. Because there is a lot of video about arduino with hx711. But i really dont know if i use Robert's rp2040 ' code can i measure reall value of things? If ican't measure reall value how can i scale it.Thank you for everything ,again sorry for noob question.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: HX711 Raspberry pi pico

Post by Roberthh » Wed Aug 11, 2021 1:06 pm

Hello @neverregret, The lib just returns a number, which is the output of the internal ADC. It is proportional to a force on a sensor, but the scaling has to be done by yourself, once you have the mechanical set-up ready with the load cell. The HX711 does not know the properties of the load cell and the setup it is used in. It could be a weight, it could be the force at any mechanical construction. That's all up to you. For instance, if it is a weight, you have to put a well know load onto it (like 10kg) an than you have a factor between weight and HX711 reading.

neveregret
Posts: 28
Joined: Sun Aug 08, 2021 5:48 pm

Re: HX711 Raspberry pi pico

Post by neveregret » Wed Aug 11, 2021 1:17 pm

Roberthh wrote:
Wed Aug 11, 2021 1:06 pm
Hello @neverregret, The lib just returns a number, which is the output of the internal ADC. It is proportional to a force on a sensor, but the scaling has to be done by yourself, once you have the mechanical set-up ready with the load cell. The HX711 does not know the properties of the load cell and the setup it is used in. It could be a weight, it could be the force at any mechanical construction. That's all up to you. For instance, if it is a weight, you have to put a well know load onto it (like 10kg) an than you have a factor between weight and HX711 reading.
Okay @Roberthh, thanks a lot i ll try that tomorrow.I ll try to scale it.I hope i can do that.But if couldn't can i ask for help to you ?
Thanks again, this is my first project with rp2040 before this i used arduino to use servo.

GioH
Posts: 1
Joined: Tue Oct 19, 2021 5:13 am

Re: HX711 Raspberry pi pico

Post by GioH » Tue Oct 19, 2021 5:19 am

Hi neveregret. Were you able to correctly execute the code and get the correct measurement?. :cry: :?: :?: :?: :?: :?: :?:
In advance thanks for your help.

neveregret
Posts: 28
Joined: Sun Aug 08, 2021 5:48 pm

Re: HX711 Raspberry pi pico

Post by neveregret » Tue Oct 19, 2021 5:34 am

GioH wrote:
Tue Oct 19, 2021 5:19 am
Hi neveregret. Were you able to correctly execute the code and get the correct measurement?. :cry: :?: :?: :?: :?: :?: :?:
In advance thanks for your help.
Hi, I am using hx711 now and I am getting correct values. https://github.com/SergeyPiskunov/micropython-hx711 you can use this. It is easy. Install hx711.py and scales.py.
My scales is working like this but you need to set yours with known weight too.

Code: Select all

val = (scales.stable_value()*(0.0005)*8)/100
print(val)

the original code bottom side:

Code: Select all

scales = Scales(d_out=5, pd_sck=4)
    scales.tare()
    val = scales.stable_value()
    print(val)
If you have any problem, you can ask.

fatih_aydemiir
Posts: 3
Joined: Tue Feb 15, 2022 1:45 pm

Re: HX711 Raspberry pi pico

Post by fatih_aydemiir » Tue Feb 15, 2022 1:53 pm

Hi,
I am beginner about raspberry pi pico and I want to try HX711 but I get this message. Could you help me?

message:
Traceback (most recent call last):
File "<stdin>", line 38, in <module>
File "<stdin>", line 25, in stable_value
File "<stdin>", line 31, in _stabilizer
File "<stdin>", line 31, in <listcomp>
ZeroDivisionError: divide by zero

Best regards.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: HX711 Raspberry pi pico

Post by Roberthh » Tue Feb 15, 2022 2:03 pm

Which hx711 lib do you use?

fatih_aydemiir
Posts: 3
Joined: Tue Feb 15, 2022 1:45 pm

Re: HX711 Raspberry pi pico

Post by fatih_aydemiir » Tue Feb 15, 2022 2:09 pm

Thanks for reply.
I use of SergeyPiskunov hx711 lib file.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: HX711 Raspberry pi pico

Post by Roberthh » Tue Feb 15, 2022 3:54 pm

Hard to tell. It looks more like no data is read from the HX711. Check the wiring. It should be GND, Vcc, Din, CLK.

fatih_aydemiir
Posts: 3
Joined: Tue Feb 15, 2022 1:45 pm

Re: HX711 Raspberry pi pico

Post by fatih_aydemiir » Wed Feb 16, 2022 7:13 am

I will check my connection. Thanks for reply.

Post Reply