I would like to know is if this schematic would function as I imagine it or a flop. The premise is based from the datasheet for the HC-SR04 here. Datasheet
The sensor works by sending 8 40KHz pulses when the trigger pin receives a 10us pulse. If an object is picked up by the receiving sensor, the "Echo" pin goes high between 150us-25ms (38ms if no object detected). I was thinking for the fun of it, to use a pwm signal from a 40106 to a 4017 counter. If I could activate the 4017 for whatever the Echo pin signal width time would be, I could output a fractional voltage which could be sent to an ADC etc. Here's is the working idea. Assume output 3-9 continue the fractional voltage. I left them open to not bog down schematic.
The pins on the spice model are confusing, however assume R=reset, C=Clock inhibit. When "Echo" pin from HC-SR04 goes high, 4017 is initiated and reset. The outputs will toggle from the 263Hz which should cycle based on min-max Echo signal time. Since the trigger would only be activated once every few seconds (to scan), whichever 4017 output was high when Echo pulse ended would freeze until the next sensing pulse; ideal for using that voltage for other applications. Here is the idea behind the Trigger/Echo function.
Any and all feedback is welcome. Just an idea, not sure if it's feasible or missing important variables. Thanks for viewing. Cheers.