I was trying to test my ultrasonic sensor by measuring a distance of 10cm until 100cm and using an oscilloscope to look at the echo pin output signal. My oscilloscope is set at 0.5 time/div.

At first, my ultrasonic sensor couldn't work properly, but after some tweaking around, I can finally get my ultrasonic sensor working. But the strange thing was, the measured distance I got was always less than a half of the real distance value. For example, for a distance of 70 cm, I got 27.2 cm from the calculation. This is the output signal for a distance of 70 cm (3.2 DIV * 0.5 ms/DIV = 1.6 ms).

Echo output signal at a distance of 70 cm with TIME/DIV of 0.5

Basically, all I do is, I calculate the HIGH time by multiplying how many DIVs appeared and then I multiply it by TIME/DIV (I set TIME/DIV = 0.5 for all measurement). Then I multiply the time with velocity of sound (340 m/s)and then divide it by 2. Because the HIGH time appeared in oscilloscope is the time to travel back and forth.

Distance = (T*Vsound)/2

Why did I got such a large discrepancy between the experiment result and the actual value? I've followed the standard procedure. I connected the Trig pin with function generator of 40 kHz frequency, the Vcc pin with 5 Volt, GND pin with ground, and the echo pin with the oscilloscope. Also my ultrasonic sensor is a brand new one, never used before.

So what possibly I did wrong?


1 Answer 1


enter image description here

Figure 1. Oops!

It appears that your scope horizontal trace is not in cal mode so all your readings are unscaled.

There should be a cal test point - usually a 1 V, 1 kHz signal. Hook up the probe and check that everything is in order.

  • \$\begingroup\$ good eye! The "cal" position often includes a tactile "click", but that's not always the case. I suspect that OP's time-measuring method may have a flaw as well. \$\endgroup\$
    – glen_geek
    Oct 27, 2017 at 16:20
  • \$\begingroup\$ Ah... I just noticed that. I just remembered that I have calibrated the oscilloscope before. But then, because I can't get the sensor working, I was quite frustrated and tried to turn every knob I can. Hahaha. So if the horizontal position (SWP.VAR) wasn't calibrated correctly, the reading got real bad like that? I don't know about that before. Thank you for pointing that out. \$\endgroup\$ Oct 28, 2017 at 0:57
  • \$\begingroup\$ I just got this from a document about oscilloscope "When SWP UNCAL is out the SWP VAR control reduces the sweep rate." I catch what you really mean now. Thank you so much :)) \$\endgroup\$ Oct 28, 2017 at 1:09
  • \$\begingroup\$ Good. Are your readings correct now? Don't forget to accept the answer if it is correct. \$\endgroup\$
    – Transistor
    Oct 28, 2017 at 8:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.