Kalman filtering-smoothing is a fundamental tool in statistical time series analysis: it implements the optimal Bayesian filter in the linear-Gaussian setting, and serves as a key step in the inference algorithms for a wide variety of nonlinear and non-Gaussian models. However, using this kind of filter in small embedded systems is not a good choice due to the computational intensive maths. For that reason there are several variations of the original Kalman filter which may fit well in your problem and keep the maths as little as possible.

The following example (in Matlab, but easily ported in C/C++) is a simplified approach to FastKalman filter.

t = [.....] signal = [.....] procNoiseCov = 48; measNCov = 48; estErrCov = 0; value(1) = 0; for i = 2:length(t) estErrCov = estErrCov + procNoiseCov; kalmanGain = estErrCov / (estErrCov + measNCov) value(i) = value(i-1) + kalmanGain * (signal(i) - value(i-1)); estErrCov = (1 - kalmanGain) * estErrCov; end