- The car was sold to us with a (aftermarket?) backup alarm that beeps loudly as you back towards an object. The closer you get, the faster it beeps.
- The beeping comes from a piezo buzzer in the trunk, which is powered by the car's 12V and gated by... something? I have no idea where the brain for this is. It doesn't matter because...
- I snipped the leads to the piezo buzzer and rerouted them into my circuit. They are hooked up to the LED side of an octocoupler (the original build used a relay)
- The "switch" size of the optocoupler is used to pull a microcontroler pin low - a Seeeduino XIAO in this case.
- The microcontroller measures the elapsed time between falling edges on the trigger pin, and uses that value to choose a sample from one of three buckets: kinda close (500ms > x > 250ms ), pretty close (x < 250ms), and too close (no falling edge for > 1s).
- The samples are played using a DFPlayerMini Module with an SD card. This has a built in amp, so it's hooked directly up to a 4ohm, 3W speaker.
- Code written in CirctuitPython [source incoming]