We used the Adafruit Ultimate GPS Module v3 to collect raw GPS data. The raw data was too noisy to be used directly in our design, so we investigated the use of two different processing strategies to achieve precise and accurate GPS data.

Moving Average:

A moving or rolling average is a method of continuously calculating the average of a small set of values at a certain point or time within a larger data set or stream. For example, in this project we used a 5 point moving average to “smooth” the path of travel given by a set up GPS coordinates. The equation used is below, where the moving average at the index value i of the set n is the sum of the five most recent measurements ( n[i-4], n[i-3], n[i-2], n[i-1], and n[i] ) divided by 5.

MA_5 = ( n[i] + n[i-1] + n[i-2] + n[i-3] + n[i-4] ) / 5

By averaging over five points, each new output is less sensitive to individual variations in GPS data, effectively reducing noise and making underlying trends in position more apparent.

Kalman Filter:

Kalman filters are a set of mathematical equations that estimate the state of a linear dynamic system from a series of noisy measurements. The filter is essentially used to predict the future state of a process, integrate new measurements, and correct the estimates based on these measurements in a ‘predictor-corrector structure.’ The key benefit of the Kalman filter is its ability to work in real time and reduce the influence of random noise (in our case GPS error) while extracting the signal, thus improving the accuracy of the result.

Measurement noise and process noise represent the two primary sources of uncertainty in any modeled system. Measurement noise refers to the errors that occur in the process of capturing data, due to the limitations of the measurement devices or environmental factors affecting sensor outputs. We modeled this noise as Gaussian and it is denoted as R in our equations. Process noise represents the uncertainty in the prediction model itself, from the assumptions and simplifications made about the system’s dynamics that do not entirely model its real-world behavior. This noise, which we also modeled as Gaussian, is denoted as Q in our equations. Both types of noise are crucial in the Kalman filter’s design; they influence the filter’s gain and, ultimately, the confidence in the estimates produced.

The core of the Kalman filter operation can be described with two sets of equations: the prediction equations and the correction equations. The prediction equations are used to estimate the current (k) state and error covariance based on the previous (k-1) state, while the update equations adjust these predictions based on new measurements.