What you're looking for is an averaging or low pass filtering solution or the means of calculating statistics of a signal.

In statistics you commonly have noisy data and you want to find out what the meaningful tendencies and patterns are in the data regardless of the noise.

The statistical mean or average is : mean = (value1 + value2 + value3 + ... valueN) / N

where N is the total number of samples collected in a particular measurement set. The mean (or common "average") shows a result that is meaningful when the data points tend to cluster noisily around some central value.

https://en.wikipedia.org/wiki/Arithmetic_meanThe statistical median is the middle value among a discrete set of values when those values are sorted.

https://en.wikipedia.org/wiki/MedianThe statistical mode is the most common value among the values

https://en.wikipedia.org/wiki/Mode_%28statistics%29Signal filtering applies a mathematical convolution of a filter transfer function with the signal samples to accentuate some of the frequency components in the original signal and to attenuate others. So a low pass filter passes mostly lower frequencies while cutting mostly higher frequencies. Low pass filters are good for noise reduction. Inversely, high pass filters pass high frequencies with little attenuation but block low frequencies. Band pass filters pass a certain range frequencies about a center frequency while rejecting others, you could imagine a filter that passed only a certain musical note frequency but blocked others.

In technical terms two common types of signal filters are called FIR (finite impulse response) and IIR (infilite impulse response).

Here is information about FIR filters:

https://en.wikipedia.org/wiki/Finite_impulse_responseHere is an example of using IIR filters:

http://www.cypress.com/documentation/application-notes/an2099-psoc-1-psoc-3-psoc-4-and-psoc-5lp-single-pole-infiniteA simple FIR filter is the moving average FIR filter that calculates the arithmetic average of the last N data points to yield the result at a given point. It is probably a good thing to consider for your needs with N being perhaps from 4 or more of the last samples.

https://en.wikipedia.org/wiki/Moving_average