I have a ESP32, and have 4 digital signals. At the beginning all 4 are low, and as soon as any one of those goes high, the other 3 follow up. I would need to measure the time between the first one and the other three.. The problem is that the time delta is very small. The other input should be high between 0.0003 ms and 0.023 ms. I am trying to measure the time sound takes to travel inside a 15 cm steel plate (about 3150m/s).

Is there any way (also with cheap external components) to measure such tiny intervals?

  • \$\begingroup\$ How much resolution/accuracy do you require? \$\endgroup\$
    – Dave Tweed
    May 25, 2021 at 11:17
  • \$\begingroup\$ @DaveTweed at least 1mm, hence the 0.0003ms.. \$\endgroup\$ May 25, 2021 at 11:24
  • 1
    \$\begingroup\$ 300ns. The RMT module should be able to do that easily. \$\endgroup\$
    – Kartman
    May 25, 2021 at 11:26
  • \$\begingroup\$ thank you, should I keep polling the inputs and measure the time? or how would it be done with the RMT module? \$\endgroup\$ May 25, 2021 at 11:37
  • 1
    \$\begingroup\$ @sharkyenergy By my computations, \$\frac{15 \:\text{cm}}{3150 \frac{\text{m}}{\text{s}}}\approx 48\:\mu\text{s}\$. And \$1\:\text{mm}\$ resolution does say about \$320\:\text{ns}\$. Which I'd cut in half to create a design goal. So I'd use \$150\:\text{ns}\$. In addition, digital inputs to any MCU have a sampling uncertainty to them, relative to clocking. I'd be zeroed in on the specs there. (Haven't looked. Just putting it on top of the table in plain view.) Anyone disagree so far? \$\endgroup\$
    – jonk
    May 25, 2021 at 16:37


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.