ADC Buffering?
Philldapill
Posts: 1,283
I'm making an object for an ADC. There will actually be two ADC's that will read two seperate voltages. The problem is that these readings fluctuate a good bit. I've tried nearly everything hardware side, so I need a software solution too. I'm thinking about making a dedicated cog to run the sampling of these two ADC's. Would it be a good idea to make a buffer of say, 100 longs, and take a sample, add it to the buffer, take another sample x amount of time later, add it, sample, etc. until the buffer is filled, then take the average of the buffer? This should give me a smoother reading, shouldn't it?
Comments
value := (7*value + newsample)/8 or similar equation. It takes a few samples before the value evens out but its then a running average of the last 8 samples. You can increase the number of samples you average over but it then takes longer to react to changes.
By the way, I'd like to convert my code to assembly to boost the samples/sec. I have no experience with assembly and need someone that would code for hire.
A FIR filter is just an average that is applied with each and every new sample but still including a fixed number of previous samples. This is the rolling or running window.
One more effect can be applied on top of that - each data point in the window can have it's own individual multipler. So, it's not just a bland divide by the number of data points. The standard average, ie: divide by number of data points, is also called a "flat" or "box" FIR filter.
I imagine there has been topics in here covering this in the past ...
Evan
It's prolly not unlike the sigma-delta process.
Evan