SPRADL9 February 2025 CC1310
Figure 3-4 shows what the PIR signal looks like over time as the ambient temperature and the PIR sensor body temperature are fluctuating. There is no motion detect events here, just the signal drifting.
Figure 3-4 PIR Signal over timeThe PIR raw signal can be somewhat noisy due to environmental changes, such as temperature fluctuations or background interference. As a result, avoid using simple threshold on the raw signal because this can fluctuate up and down, leading to unreliable detections. Instead, we analyze the signal’s first derivative to measure how quickly the signal rises over time. A rapid change in the signal results in a high first derivative, which we then threshold to detect movements more reliably. Before applying this approach, we oversample the raw signal and use a moving average filter to smooth out small spikes.
Figure 3-5 Smoothed PIR Signal Versus Raw
SignalAfter smoothing the raw PIR signal, calculate the absolute value of the first derivative. This step allows the focus on the magnitude of changes in the signal, regardless of the direction of the variation. To detect movement, we set a software-defined threshold on this absolute first derivative. If the magnitude of the derivative exceeds the threshold, this indicates a rapid change in the signal, which corresponds to motion. This method provides a robust way to detect movements while minimizing false triggers caused by gradual signal fluctuations or environmental noise.
Figure 3-6 First Derivative of the
Smoothed Signal