Sensor Event Detection on ESP32
Posted: Fri May 31, 2024 11:27 pm
Hey guys,
I am working on some code to detect sudden changes in a sensor value (temperature, humidity, etc.) on ESP32. Currently, my strategy for this is to store a rolling array of the last 20 data points. Then, I calculate the average of the 20 data points as well as the standard deviation. If a data point is more than 5 standard deviations away from the mean, I am reporting it as an anomaly/event. For the most part, this works well (whenever I touch the sensor it reports an event), but it gives me false positives every few minutes, especially when the data points are very close to each other, which is a serious issue for my project. Do you have any ideas or advice? Does anyone know of a more precise algorithm to use?
I would be very grateful for any ideas or feedback.
--rrwatt
I am working on some code to detect sudden changes in a sensor value (temperature, humidity, etc.) on ESP32. Currently, my strategy for this is to store a rolling array of the last 20 data points. Then, I calculate the average of the 20 data points as well as the standard deviation. If a data point is more than 5 standard deviations away from the mean, I am reporting it as an anomaly/event. For the most part, this works well (whenever I touch the sensor it reports an event), but it gives me false positives every few minutes, especially when the data points are very close to each other, which is a serious issue for my project. Do you have any ideas or advice? Does anyone know of a more precise algorithm to use?
I would be very grateful for any ideas or feedback.
--rrwatt