超声波测距原理
发送脉冲并测量回波时间,从而计算距离
超声波测距原理 是 CoddyKit 上的免费 Arduino & IoT Academy 课时。 这是第 1 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Arduino & IoT Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Arduino & IoT Academy 课程共包含 4 节课。
本课时的部分内容尚未翻译,以英文显示。
Seeing with Sound
An ultrasonic sensor measures distance the way a bat does: it sends out a sound pulse and listens for the echo bouncing back. 🦇
Too High to Hear
The pulse is ultrasonic, around 40 kHz, far above what your ears can detect. The sensor works silently while still using real sound waves.
Send, Then Listen
The trick is timing. The sensor fires a quick ping, then starts a stopwatch and waits for that same sound to return after hitting an object.
The Round Trip
The sound travels out to the object and all the way back, so the measured time covers a round trip, twice the actual distance to the target.
Sound Has a Speed
Sound moves through air at about 343 meters per second. Because that speed is known, time can be turned directly into distance.
Time to Distance
Distance equals speed times time. Knowing how long the echo took, you can compute exactly how far the sound traveled before bouncing.
// distance in cm, time in microseconds
distance = duration * 0.0343 / 2;Why You Divide by Two
Since the echo covers the path twice, you halve the result. That single division converts a round trip into the real one-way distance.
Microseconds Matter
These pulses return in microseconds, so the sensor times very tiny intervals. Tinier time differences simply mean a closer object.
The HC-SR04
The popular HC-SR04 module does all this for you. It has one transmitter that chirps and one receiver that catches the returning echo.
Its Useful Range
This sensor reliably reads from about 2 cm to 400 cm. Closer than 2 cm or farther than that, and the readings stop being trustworthy.
Where Echoes Fail
Soft or angled surfaces can scatter the sound away, so a flat, solid target gives the cleanest, most accurate distance readings.
Quick Check
Think about the path the sound takes.
You Get It Now
Ultrasonic ranging is just timed echoes: ping, wait, and convert the round-trip time into distance. Next you will wire the sensor up. ✅
常见问题解答
「超声波测距原理」课时是免费的吗?
是的 — 「超声波测距原理」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Arduino & IoT Academy 课程的其余内容,请升级到 CoddyKit PRO。 Arduino & IoT Academy 课程共包含 4 节课。
「超声波测距原理」这节课中我会学到什么?
发送脉冲并测量回波时间,从而计算距离 你通过在浏览器中直接运行的动手代码来练习 Arduino & IoT Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。
学习 Arduino & IoT Academy 需要有经验吗?
无需任何先前经验。CoddyKit 上的 Arduino & IoT Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 1 节课,共 4 节。
「超声波测距原理」课时需要多长时间?
大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。
我能在这节 Arduino & IoT Academy 课中编写并运行代码吗?
能。每节 Arduino & IoT Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。