I am new to the Arduino, but I have a project that I am working on. I would like to use and HC-SR04 with an UNO to monitor the distance between a stationary object and a parked vehicle. I would like to store the distance in a variable when I trigger a switch and then compare the current distance with the saved distance and trigger an alarm when the distance moves apart. Accuracy isn't critical, say within a foot.
I have located code to interface with the HC-SR04 but the measurements I am getting seem to fluctuate widely at times. Sometimes I get large spikes. How do I go about getting a steady figure to use for my comparisons?
I have read about the Kalman filter and think it may be useful, but I'm not a math whiz and it really doesn't make any sense to me. That's why I'm here.