Result of my comparison of the AM312 and HC-SR501 sensors.
The HC-SR501 triggers detection much faster, with a release time of 1.1 seconds compared to 2.5 for the AM312. This speed would be ideal for my needs…
However, the HC-SR501 has many false negatives, making it unsuitable. It looks like the HC-SR501 has an issue with the Wi-Fi. During my test, the sensor was 20 cm away from the ESP32.
I would recommend the AM312 instead.
Ping @justdude