RobTillaart / HX711

Arduino library for HX711 24 bit ADC used for load cells and scales.
MIT License
88 stars 29 forks source link

Value gives "nan" #26

Closed gekke111 closed 2 years ago

gekke111 commented 2 years ago

Hi, We are working on a school project. We are making a cocktailmachine. We are using the code of the kitchen scale example. If we use the example, it works perfectly. But if we implement it in our own code it gives us the value "nan". We are using a arduino nano v3. Do you maybe know what the problem is?

Thank you, Debroyer Sander & Niels Wellens GIP_barduino.zip

RobTillaart commented 2 years ago

Quick look but I don't see differences in the code except the clock/data pin of the HX711. So I assume it is interference with one of the other devices connected. (too little information to make an educated guess)

What you could do to analyze is

This should work as it is identical (except pins) as the example.

Then

One thing that might happen is that the motors generate noise that disrupt the communication with the HX711. (which measures very tiny voltages).

You might improve the signal quality by using pull up resistors (2K2) on both the data line and the clock line of the HX711.

Other tips

Hopes this helps to get started.

RobTillaart commented 2 years ago

update

I compiled your sketch - no HX711 connected -- and I get NAN too, so I should double check the pins used.

RobTillaart commented 2 years ago

As I see no more remarks I close the issue. If the problem persists feel free to reopen it.