0Pricing
Arduino & IoT Academy · Lezione

Come funziona la misurazione a ultrasuoni

Invii un ping e misuri il tempo dell'eco per calcolare la distanza.

Come funziona la misurazione a ultrasuoni è una lezione Arduino & IoT Academy gratuita su CoddyKit. Questa è la lezione 1 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Arduino & IoT Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Arduino & IoT Academy include 4 lezioni in totale.

Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.

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. ✅

Domande Frequenti

La lezione «Come funziona la misurazione a ultrasuoni» è gratuita?

Sì — il testo completo di «Come funziona la misurazione a ultrasuoni» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Arduino & IoT Academy, passa a CoddyKit PRO. Il corso Arduino & IoT Academy include 4 lezioni in totale.

Cosa imparerò in «Come funziona la misurazione a ultrasuoni»?

Invii un ping e misuri il tempo dell'eco per calcolare la distanza. Eserciti Arduino & IoT Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.

Ho bisogno di esperienza per iniziare Arduino & IoT Academy?

Non è richiesta alcuna esperienza precedente. Arduino & IoT Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 1 di 4.

Quanto tempo richiede la lezione «Come funziona la misurazione a ultrasuoni»?

La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.

Posso scrivere ed eseguire codice in questa lezione Arduino & IoT Academy?

Sì. Ogni lezione Arduino & IoT Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.

Tutte le lezioni di questo corso

  1. Come funziona la misurazione a ultrasuoni
  2. Collegare Trigger ed Echo
  3. Usare pulseIn per misurare l'eco
  4. Costruire un allarme di prossimità
← Torna a Arduino & IoT Academy