Using a micro-controller to generate the transmitted signal is easy. No so sure about counting the time of flight though.
You can measure time as the rate of change of an electrical parameter in a circuit. The http://ww1.microchip.com/downloads/en/A ... 01375a.pdf
CTMU device module can measure time by the voltage on a capacitor that's charged from a constant current source. (resulting in a linear ramp of voltage over time)
It's only good to about 1 foot resolution in a measurement of several thousand feet so measuring possible changes in the speed of light over time as the universe changes might be a problem.
The CTMU is a constant current source that can be turned on and off in less than 1 nanosecond (ns). This current can be converted to a time-dependent voltage with the addition of a capacitor, using the following standard equation:
I = C(dV/dT)
Solving for dT and integrating
T = (C/I)V
I is the output current (typical value ~0.55uA) of the CTMU current source, C is the input capacitance (typical less than 4 pF if the ADC input Mux is disabled) of the ADC plus any stray capacitance, and V is measured by the ADC. This results in the ability to calculate what T is.
The current output is connected to the 12-bit ADC. So, we have a current source that can be turned on and off in much less than 1 ns and an ADC with a fixed capacitance for an input. The analog-to-digital input is charged for an unknown amount of time, after which a voltage measurement is made using the ADC. Knowing C and I, and measuring V, we can calculate T. We can then discharge the capacitor with another switch and restart the process.
https://www.flickr.com/photos/nsaspook/ ... 477730187/
Typical waveform generated by the CTMU as Capacitance is varied but Time is constant. If we have constant Capacitance and I (current) and vary Time we get a ramp voltage to calculate the value of T.
The first pulse (light transmit pulse) closes the switch, starts the charging of the analog-to-digital input capacitor and creates a linear voltage ramp The second pulse (light receiver) opens the switch and stops charging the analog-to-digital input capacitor. The voltage can now be measured and the time calculated.