Calculating barometric pressure trend
This gist is a response to a Discord question. It explains my approach to deciding whether barometric pressure is rising, falling or remaining steady.
I do the trend calculation in Arduino (ESP8266) code. I tried to mimic the idea of setting the reference needle on a real barometer, waiting an hour, then seeing which way the pressure needle had moved with respect to the reference. The wrinkle is that "the last hour" is a moving window that updates every 10 minutes.
The BMP085 sensor is polled every 10 minutes. Until there are six observations (eg after a reboot) the code returns "training".
After that, the code does a least-squares regression on the last six observations (ie the last hour of data) to find the linear equation of best fit. In effect, the algorithm assumes that knowing the time (independent variable on the X axis) at some point in the past hour would permit the pressure at that time (dependent variable on the Y axis) to be estimated with some degree of