What might be the professional way of filtering out noise from ADC readout in code? I was thinking of taking say, two samples then averaging them. Then when having two averaged values substract them and see if the remainder is less than measured noise, do not update the value to for example display or wherever you might be using it.
The professional way - in my eyes - is to
* use a proper analog filtering (anti alias filter). Without anti alias filter it´s impossible to filter away the (random) alias frequencies at software side.
* then to anylyze where the residual noise comes from.
Best is to remove the cause not the symptom.
Klaus
added:
Often when I want reliable readings from an ADC: I run an ISR in background to sample ADC continously, filter them and put them in a variable.
When I need the value I just read the variable contents (this is fast: no need for ADConversion to finish) and are very stable.
Once programmed (maybe 10 lines of code) you may forget about the ISR.