Regulating spikes in analog signal

I am using a HX711 and a load cell to obtain a weight value between 0-2000grams. I am able to get an accurate reading, but am experiencing random interference causing spikes in the weight value reading. I am looking for some advice regulating these spikes and maintaining a steady accurate weight value.

scale1_val = (scale1.get_units());  
scale1_val = constrain(scale1_val, 0, 2000);

How are you powering the Arduino. And the HX711.
Leo..

Hi Leo, The Arduino is powered with 5v through a Pololu Dual MC33926 Motor Driver Shield that is connected to 12v. The HX711 is powered from the Arduino.

Got some data to look at?

This may afterall, depending on the size of these "spikes" may be down to simple limitations of both the sensor and the ADC giving some fair reliability issue.

Do you also get these spikes when the Arduino is powered from USB.
And you don't power the motor shield.
Leo..

Wawa:
Do you also get these spikes when the Arduino is powered from USB.
And you don't power the motor shield.
Leo..

Still spikes connected via usb

Johnny010:
Got some data to look at?

This may afterall, depending on the size of these "spikes" may be down to simple limitations of both the sensor and the ADC giving some fair reliability issue.

Its setup to display the value on an lcd right now. The spikes are random usually going from 0 to 2000 back to 0 within a second and occasionally will make a quick jump by about 50 grams.

Im thinking there should be a way to ignore these spikes with some code, just not sure the best method to use for this.

Try averaging/[u]smoothing[/u] and/or you can throw-out any obvious outliers.

This sounds like a possible timeout when reading the sensor/ADC?

What is the HX711's max readout speed and what are you refreshing at?

It may be returning a null value when queried causing your spikes.

The datasheet says it is either 10SPS (10 signals per second) or 80SPS depending on a setting you choose. The difference between setting I can only assume is to do with accuracy (maybe sub-sampling?) or resolution.

So if you are querying that ADC anywhere more than 10 times a second, then it will run in to issues.

ink44:
Im thinking there should be a way to ignore these spikes with some code, just not sure the best method to use for this.

Probably not.
Any digital device will put spikes on the power rail.

You need individual decoupling caps close to the pins of each digital ic.
Post ix and circuit diadrams if you can.

24 bit convertors need careful design

You should use the running Median and use an array size of 7 (my guess)
It automatically throws away the outliers and returns the middlest measurement which is a real measurement. (average is always affected by outliers, because to determine the outliers one need to calculate the average, circular dependency)

Check - Arduino Playground - RunningMedian

ink44:
Hi Leo, The Arduino is powered with 5v through a Pololu Dual MC33926 Motor Driver Shield that is connected to 12v. The HX711 is powered from the Arduino.

Motor driver shields can have problems , do you have an oscilloscope available to monitor the voltage outputs

Ink44 try using a battery, and linear reg if necessary to eliminate problems from the supply.

Load cell circuits are by nature quite sensitive.

Did you power the load cell from the HX711 reference or from Arduino's 5volt rail.
Leo..

Thanks for the responses. This is currently how I have this wired:

Load cell -> HX711 -> 6ft USB cable -> (+ -)direct to 5v power supply, (sda, slc) to arduino

Even without the usb(scale) connected I am getting large spikes.

I am going to try to use decoupling capacitors to see if that will solve the issue. I'm wondering where in the circuit I should place the caps. I also have 6 of these load cells connected to the arduino, so would I need to use a cap for each load cell?

Boardburner2:
Probably not.
Any digital device will put spikes on the power rail.

You need individual decoupling caps close to the pins of each digital ic.
Post ix and circuit diadrams if you can.

24 bit convertors need careful design

My ic's are not connected and am still getting spikes.

I have my arduino in a project box, and have a female usb cable connected to the pins that the HX711 will use(A03,A04,5v,gnd), the HX711 is not even connected yet and I am getting spikes. I am not using any capacitors yet, so I am wondering where I need to put them, should I just put a 1uf capacitor between 5v and gnd at the point where my usb cable meets the pins of the arduino.

Any help the greatly appreciated, thanks

ink44:
Thanks for the responses. This is currently how I have this wired:

Load cell -> HX711 -> 6ft USB cable -> (+ -)direct to 5v power supply, (sda, slc) to arduino

Even without the usb(scale) connected I am getting large spikes.

Does you usd cable have lumps on both end ? (Ferrites )

They can pickup a surprising amount of interference.

How are you measuring the spikes ?

Oscilloscope ? What is the bandwidth of your scope ? Can you post pix ?

ink44:
Thanks for the responses. This is currently how I have this wired:

Load cell -> HX711 -> 6ft USB cable -> (+ -)direct to 5v power supply, (sda, slc) to

What 5v supply ?
If its the one on the shield i would be very suspicious of that