Arduino Help: Load Cell Tare / Data Bouncing

The Rocketry Forum

Help Support The Rocketry Forum:

Wschmiedlin

Well-Known Member
Joined
May 29, 2018
Messages
46
Reaction score
9
I'm currently building a motor test setup using the popular HX711 amplifier from Sparkfun and running it with an Arduino. I have built my version off of the popular "Model Rocket Engine Dynamometer" code from Nick Cinquino.

I am having a hard time getting my load cell to read a constant "zero". The data rate is set to 80Hz. I have attempted to adjust the calibration factor and have it close. I know that the data will vary each time the "scale.get_units(),2;" line is read, but my data is jumping around like crazy.

Is this amount of bouncing normal for the HX711 amplifier?

How do people use these to get a constant reading when using it as a static scale?

Code is Attached:
 

Attachments

Voyager1

Well-Known Member
TRF Supporter
Joined
Oct 23, 2015
Messages
674
Reaction score
215
Location
ACT, Australia
Short answer: No, I’ve not experienced data that is that noisy with the HX711 @ 80 Hz. At a very quick glance at your code, your acquisition loop possibly runs much faster than the 80Hz of your HX711. Does the scale.get_units() function have any delay associated with it? Otherwise, you may need a delay in your acquisition loop. I’ll check my code and the library.
 

OverTheTop

Well-Known Member
TRF Supporter
Joined
Jul 10, 2007
Messages
5,137
Reaction score
2,425
Location
Melbourne Australia
I haven't checked your code, but is your zero load voltage very close to the supply rail or ground? If so then any noise around zero becomes non-gaussian and averaging the "zero" point gives a skewed result because of the clipping. Make sure you have enough margin on the zero so you are not against a rail.

You can cure this by adding an offset in the electronics and subtracting it out later in the code.
 

Wschmiedlin

Well-Known Member
Joined
May 29, 2018
Messages
46
Reaction score
9
Short answer: No, I’ve not experienced data that is that noisy with the HX711 @ 80 Hz. At a very quick glance at your code, your acquisition loop possibly runs much faster than the 80Hz of your HX711. Does the scale.get_units() function have any delay associated with it? Otherwise, you may need a delay in your acquisition loop. I’ll check my code and the library.
Interesting thought! The clock speed of the Arduino Mega is 84Mhz. So, should I set a "delay(12.5)" to force the loop to only read once every 1/80 sec.?

I'll have to give it a try and see.
 

UhClem

Well-Known Member
Joined
Feb 6, 2009
Messages
1,782
Reaction score
261
Interesting thought! The clock speed of the Arduino Mega is 84Mhz. So, should I set a "delay(12.5)" to force the loop to only read once every 1/80 sec.?
The HX711 indicates that new data is available by driving data out low. The library code waits for this so you want to call it faster than the sample rate. You can miss samples by calling too slowly but you cannot go too fast.
 

Wschmiedlin

Well-Known Member
Joined
May 29, 2018
Messages
46
Reaction score
9
I haven't checked your code, but is your zero load voltage very close to the supply rail or ground? If so then any noise around zero becomes non-gaussian and averaging the "zero" point gives a skewed result because of the clipping. Make sure you have enough margin on the zero so you are not against a rail.

You can cure this by adding an offset in the electronics and subtracting it out later in the code.
I'm a little bit lost on this. Sorry, I'm a mechanical guy and even at this level out of my comfort zone.

I do have both the VCC and VDD tied to the +5v of the Arduino. Should I have a separate power supply to power the amp? The ground is also tied directly to the Arduino.

I do not have a separate power supply hooked up to the Arduino. The board is getting all the power from the USB connection. I have hooked up a 5v supply to the input, but I am not sure it makes a difference. Does that just keep everything happy if the USB can not supply enough current?

Or, are you saying that with nothing on the load cell that the input voltage is equal to the output and will bounce? I have not tried starting up the program with a load on it (Tare for the weight of the setup) and seeing if it is more stable.

Sorry, lots of questions.
 

OverTheTop

Well-Known Member
TRF Supporter
Joined
Jul 10, 2007
Messages
5,137
Reaction score
2,425
Location
Melbourne Australia
If the zero voltage of the loadcell that is being fed into the ADC input is near zero, and the noise gets clipped by the fact it is hitting the GND rail, it skews the statistics on that zero reading. Have a look at the ADC readings when the cell is at zero load, plot it and if the noise looks one-sided then you need an offset.

Is this a vertical test stand, or horizontal? For a vertical stand facing up the offset would possibly be provided by the mass of the motor being tested or some additional mass added just to provide offset.
 

Wschmiedlin

Well-Known Member
Joined
May 29, 2018
Messages
46
Reaction score
9
If the zero voltage of the loadcell that is being fed into the ADC input is near zero, and the noise gets clipped by the fact it is hitting the GND rail, it skews the statistics on that zero reading. Have a look at the ADC readings when the cell is at zero load, plot it and if the noise looks one-sided then you need an offset.

Is this a vertical test stand, or horizontal? For a vertical stand facing up the offset would possibly be provided by the mass of the motor being tested or some additional mass added just to provide offset.
Gave this a try last night. Put a dummy mass on the LC, fired it up so zero was offset. Placed my 45lb bar onto it and the reading was fairly close.

Will have to play with it a bit more to see how accurate the calibration is. My zero even with the offset still bounces around quite a bit. I think I will get another ADC from Sparkfun. This one goes crazy wild when I exhale on it. I don't think the chip is sealed. May try potting it at work, or sealing it in Silicone.
 

UhClem

Well-Known Member
Joined
Feb 6, 2009
Messages
1,782
Reaction score
261
If the zero voltage of the loadcell that is being fed into the ADC input is near zero, and the noise gets clipped by the fact it is hitting the GND rail, it skews the statistics on that zero reading. Have a look at the ADC readings when the cell is at zero load, plot it and if the noise looks one-sided then you need an offset.
The load cell is a bridge sensor so the output voltages will be centered in the power supply range. The PGA/ADC common mode range certainly includes that.
 

OverTheTop

Well-Known Member
TRF Supporter
Joined
Jul 10, 2007
Messages
5,137
Reaction score
2,425
Location
Melbourne Australia
The load cell is a bridge sensor so the output voltages will be centered in the power supply range. The PGA/ADC common mode range certainly includes that.
Thanks. I am not familiar with the particular configuration of your front-end. I have seen people get the zero noise thing wrong so I mentioned it. Subtleties really matter when you have a 200dB dynamic range on the signal processing like we do at work sometimes.
 
Top