Thanks for posting that code Langue. Unfortunately it was unsuccessful. However, I did get things working by finding the point and editing the code, the original long (very long) pages of code. I got rid of the formatting and now have just basic data, ie. grams being presented to the serial bus. This is good.
However, now that that has worked, I've changed the sample rate to 80Hz (which is what I want) and have seen some weird readings. I'll try to be brief.
I get some "random" readings which are way off scale. Everything else if perfect, but within a period of a minute or so recording, there can be 3 to 4 samples that are way off, like -3,995 grams, or +17,591 grams etc. Although not many, I can't use it this way.
I can't see that this is a software issue, to me that's a hardware fault. I'll continue this conversation in the SFE forum if I still have the mental strength (I've put too much time into this) and I do appreciate your time.
@Eugene D Thanks Steve, I'll use a metal ball to test the scale.
Yep, a good idea Eugene. I am intrigued by exactly what it is you are doing.
The tests I did were reasonably precise. I made an apparatus to hold the steel ball. I used a magnet, then pulled it away to ensure that the ball dropped from the same height (+/- 0.1 mm I would say). Posted below is the final results. An average of 10 tests at each sample rate.
The results are very clear. A higher sample rate has more of a chance of recording the impact of when the ball hits the load cell, and when the AD conversion is taking place.
Although, it does throw up a few questions regarding chance and probability. There is no reason that after doing 10 tests of each that the ball hitting the load cell just happened to strike at the exact same time the ADC reading was taking place (at 100Hz) and with the 250Hz tests, the ball hit the load cell inbetween when the reading took place.
If that happened (which it could), then the above graph would look the opposite, and I would be wondering why. (but I now do know why).
Fortunately the tests confirmed what I thought. You can clearly see the "overthrow" with the 250Hz tests (red line). The load cell was loaded with 400grams (for both tests) and the mass itself is moved. This aligns with the "theoretical", but given a number of tests, then by pure chance, I can't see why the results couldn't show the opposite at the "right" point in time.
If you get what I mean.