I originally set out to build a LiDAR starting from just a laser diode and photodetector, but opted to start with something simpler where we can sample the full wave and do filtering digitally. Behold my rendition of an AMCW Ultrasound Ranging Device.
The envelope is 100hz [can be configured in top.v], which in air has a half-wavelength of about 1.7 meters. The envelope is modulated onto a 40kHz carrier.
LTSpice schematics for the Tx and Rx circuits are in the asc files in this repo.
This design is for the CMOD A7-35T FPGA, which features a 12-bit 1MSPS ADC that can read 0-3.3V.
I created a 1.32V virtual ground using 300k ohms of resistance on +3.3V and 200k on ground to center our wave at 1.32V so it can be fully sampled by the XADC. I also added in two 10nF capacitors in parallel from ground to the virtual ground to make it a smoother 1.32V.
This is the transducer pair used: https://www.jameco.com/z/40TR12B-R-Jameco-ValuePro-Ultrasonic-Sensor-Set-40Khz-Transmitter-and-Receiver_139492.html
Take a look at the concept in action here: https://www.desmos.com/calculator/yvtrkkh6al
C is a model of the 125-element Integrate-and-Dump filter, chosen to match the 40kHz carrier.
Program the FPGA and then launch test.py in your terminal. You may have to change COM4 to the actual port name.
The beam width of this transducer is very wide, over 90 degrees. So although you will get a phase shift reading and you can verify that it is different when placed in different spots (MAKE SURE THERE ARE NO MOVING OBJECTS NEARBY!), and that it is stable when held still, the value will probably not correspond to an actual distance.
You can observe this by moving your hand in the periphery and observing the turbulence in the phase shift chart.


