Using TSOP17 and 555 to measure distance

I am trying to design a simple circuit that measures distance.

I will use an IR emitter and an IR reciever photodiode, and just measure the time between the moment the pulse was sent and when it was received, after bouncing back from the object to measure.

From what I read, it would be useful to use an TSOP1738 at 38KHz as the receiver to avoid interference from other sources.

So some people use a 555 to generate the 38KHz square wave. I have some questions:

• What considerations should I take?
• How should I do the time measurement? I've thought about a resistor and a transistor connect to the microntroller.
• Any consideration for the microcontroller?
• Should I take a whole different approach?

I just have to explain the schematic for class. I don't have to build it, don't have see the software part so far.

• Have you considered how short the time of flight is going to be? Light is fast. One microsecond is 300 meters.
– JRE
Commented Jul 6, 2021 at 15:58
• LIDAR is far too fast to use anything as imprecise as a 555. And a microcontroller wouldn't give you adequate resolution either; you need dedicated hardware for this. Commented Jul 6, 2021 at 16:00
• It takes around 10 cycles at 38kHz for the TSOP1738 to detect the signal. Say that is +/-1 cycle. Then your resolution will be about +/-80km. Seems a bit unlikely to be very useful. Commented Jul 6, 2021 at 16:12
• I would suggest picking a different goal. Commented Jul 6, 2021 at 16:23
• That kind of an IR receiver has a band pass filter that will very much influence its delay. It’s not even close to being suitable for this application. Commented Jul 6, 2021 at 18:02

The way you measure distance depends on the speed of light – 3·10⁸ m/s.

So, to measure something with an accuracy of say, 0.3 m, your measurement system needs to be able to measure time with a resolution of 10⁻⁹ s = 1 ns; that means the bandwidth of the measurement system will be in the region of gigahertzes = 10⁹ Hz = 10⁹ 1/s.

The transceiver you're looking at, and the NE555, are devices with bandwidths in the region of 10³ Hz.

So, you're off by a factor of 10⁶. For comparison, an especially slow snail is a factor of 10⁶ slower than the fastest plane ever made by humankind; trying to estimate distances with accuracy below meters with a receiver like yours is quite similar to asking a snail to outrun that plane.

So, wrong approach. You need faster measurement, AND you need slower propagation. Try with sound instead of light, and with "modern" logic ICs instead of the ancient 555: that's how these cheap 2€ ultrasonic distance modules work. Still, a big project, and it seems the physics basics aren't that familiar to you yet – maybe start with something that demonstrates you know these basics. I'd recommend looking into what cross-correlation is, and how you can produce white noise with your computer's speakers and then see how the difference in length of different reflection paths is. That way, you get to do the math you'd need to implement in hardware / firmware later on a PC with a recording that you can work on for as long until it works.

• Thanks for the answer. I would sincerely appreciate if you could give me any idea. I have to use direct time of flight for this assignment (Measure time from emission until reception). Should I use components with higher frequencies? Thank you Marcus Commented Jul 7, 2021 at 0:51
• I think the answer was pretty clear with respect to what was recommended. What is described at the end of the answer is a time of flight sensor, and you really need to get more accustomed to the mathematical-physical basics of what you are doing.
– mmmm
Commented Jul 7, 2021 at 9:43