tatobari / hx711py

HX711 Python Library for Raspberry Pi.
Apache License 2.0
210 stars 153 forks source link

Random values on Jetson nano #55

Open Gitanjali-apet opened 10 months ago

Gitanjali-apet commented 10 months ago

@tatobari hx711 for raspberryPi working Fine. Same code with hx711 -for jetson nano getting random values on adding or removing weight. I am stuck here. Could you please help? board used - Jetson nano developer kit, load cell -5kg, HX711

tatobari commented 6 months ago

I don't have a Jetson Nano so I can't test it, sorry. I've updated the code to improve a few things, maybe you could take a look at the new README.md file and test using the new version, which has its own example file.

However, bare in mind that connecting the HX711 directly to a CPU that's running an multi-threaded OS is not a good idea. Polling the bytes is a very time sensitive process and if the OS needs to do something else while polling the bytes from the HX711, it will and then the polling could go wrong because the timing between pulling a pin up and then down could vary too much, generating unexpected behavior from the HX711.

The best is to use an MCU such as an Arduino, Raspberry Pico or any RP2040 based, an ATTiny, a PIC, etc, and connect them to the Raspberry Pi, Jetson Nano or any other multi-threaded OS through an I2C interface.

To keep is small, I'd recommend using an ATTiny85 with SpenceKonde/ATTinyCore and bogde/HX711 or queuetue/Q2-HX711-Arduino-Library.

I'm trying to find time to make my own implementation with this the Raspberry Pi -> MCU -> HX711 schema. I might have some free time to do this in a couple weeks.