Faster than UNO?

Hi there,

I'm currently using an Arduino UNO with a load cell as part of my thesis.

I'm measuring load values against time, but the function that gets load values from the load cell takes .25 seconds to execute. This is a little too slow for what I'm looking for.

Could anyone recommend a more appropriate board that would speed up the execution time? Does the Mega just have more pins and memory?

Best,

Nev

Can you post the function? Since we don't know why it takes 0.25 seconds, we can't answer the question. It could be that it takes that long to read it - much like a DS18B20 temperature sensor.

I suspect there are a lot of delays and averaging going on.

Even a 4GHz processor will take 0.25 seconds if you take two readings with a delay( 250) between them...

Remove the line in your code that says delay(250).

I'm using this Load Cell library by Aguegu:

There is one delay in the code but I've removed that delay and its taking just under .25 seconds.

ardulibs/hx711 at 3cdb78f3727d9682f7fd22156604fc1e4edd75d1 · aguegu/ardulibs · GitHub
There is one delay in the code but I've removed that delay and its taking just under .25 seconds.

The hx711 is a very accurate (24bits!) but very slow A-D converter (10 or 80 samples/s)
The library you reference, by default, uses an average of 32 samples each time you call averageValue(), so I'm surprised that it goes as fast as 0.25s. Or are you using getValue() instead? Do you have the RATE pin set to 0 or 1? Reading teh two channels on the chip at 10S/s would give you the "just under .25s" rate you're seeing. It's hard to tell without seeing your code, or the wiring...

But in any case, it's not the Arduino itself that is causing the slowness.

Thanks for your reply westfw. I'm somewhat new to all of this!

westfw:
The hx711 is a very accurate (24bits!) but very slow A-D converter (10 or 80 samples/s)

I'm actually using this board which is based on the HX711 I think. How can I tell whether 10 or 80 samples/s are selected? Ideally, I'd like 80.

westfw:
The library you reference, by default, uses an average of 32 samples each time you call averageValue(), so I'm surprised that it goes as fast as 0.25s.

I'm using getGram(), which subsequently calls averageValue(). I had it set to take an average of 25 values as opposed to 32 which would explain the .25 seconds. Reducing this value speeds everything up, something I had overlooked. However, what effect does reducing this value to say, 5, have one the accuracy of the values recorded?

Thanks again.

Why ask us? Take a bunch of measurements and look at the means and standard deviations of each type 25 vs 5. The means should be about the same, but the standard deviation will be wider.

Look at the values, given the actual mean would any of the samples introduce to much error?

For example, if you take about 20 5-sample measurements and the mean is 1 and one of your measurements is .8 would .8 be unacceptable?

what effect does reducing this value to say, 5, have one the accuracy of the values recorded?

The multi-sampling is usually used as a way to filter out noise. Whether it will have a big impact on your system depends on how much noise is present (which is dependent on the hardware design and environment), and whether the higher-level algorithms (and people) in your code also do anything to handle the noise. For example, I've seen rocket motor thrust measurement setups that apparently plot the raw data, and let human perceptions do the noise filtering (

I'd work backwards - try adjusting your sampling to whatever sample rate you actually need (or even several times that), and see what it looks like. (it may depend on communications speed and memory availability. Best case is to record all of the 80 samples/s if you can - you can ALWAYS do the averaging in post processing, right? (I guess you haven't said whether you have a post-processing phase, or are doing things in real time...)

How can I tell whether 10 or 80 samples/s are selected?

Ugh. Awful documentation on that module. The rate is controlled by the RATE pin on the IC (pin 15) - GND for 10s/s, VCC for 80. From the DFRobot schematic, it LOOKS like they have 10k resistors going to both VCC and GND, and probably only one of them should be present; but the photo of the module shows them both present (I think; they're not labeled!) Grr. It's all self timed; if you're averaging 25 readings in 0.25s, it MUST be doing 80s/s, right?