Watch the test video to see how it works:
Runs in one of three modes: waiting, parking, and parked. "Waiting" is when no car has been detected for a while, and goes to a 2 second ping cycle, with deep sleep between pings. "Parked" is when a car is detected, but has not moved recently; then it goes to a 1 minute cycle. "Parking" runs an active delay loop at 100 ms. Red and green LEDs are constant, yellow LED flashes at a rate proportional to distance. LED flashing is controlled by timer interrupts, to avoid complicating the main loop.
STLs for a 3D printed enclosure is provided. Stand off holes are sized to self-tap with a #4 screw.
The PCB is suitable for reuse for any low power mobile Arduino-based project. Just remove the traces for the LEDs and their current limiting resistors and add your own components.
The schematic was mainly cribbed from the SparkFun Arduino Pro Mini and the LTC3525 datasheet. I chose an 8 MHz resonator because clock speed wasn't important and I wanted to reduce power consumption. I chose 5V because it is necessary for the SR04 sensor and it would complicate things to introduce separate rails, power down the 3.3V rail, etc. Also, those LTC3525 boost chips aren't cheap; more expensive than the microcontroller!
I finally got this sensor project up and running. While the LEDs seem to function properly to alert the driver of the distance, I seem to be having an issue with detecting when the vehicle is gone. After I move the vehicle, the red and yellow sensor LEDs seem to flash sporadically after the car is moved. What could be wrong? What should the unit be doing? When I re-park the car after 15-20 minutes, the sensor seems to be working properly to identify the distance. Please assist me with troubleshooting. Thanks!