Here is an example Arduino project;
https://create.arduino.cc/projecthub/onyx/ultrasonic-sensor-alarm-1ec0f3
The amount of memory used by the program is small, only 15% of the space the Arduino UNO used in that example has.
An Arduino Nano would be OK, as would a Arduino Pro Mini. The Pro...