TubeSum ← Transcribe a video

Video KGwtit2bFyo

0h 04m video Transcribed May 27, 2026 Watch on YouTube ↗
Beginner 4 min read For: Beginners interested in Arduino and electronics projects.

AI Summary

This video explains how to use an ultrasonic sensor with an Arduino, covering its working principle, wiring, coding, and a bonus project. The sensor uses sound waves to measure distance by emitting ultrasound and detecting the echo.

[00:00]
Ultrasonic sensor overview

The module uses sound waves to measure distance of solid objects. It's popular and easy to use with Arduino.

[00:12]
How it measures distance

Transducer emits high-frequency sound waves (ultrasound) that hit an object and bounce back. The receiver detects the echo. The module outputs a high signal when sound is emitted and low when echo is received. Arduino reads pulse length to determine distance.

[00:41]
Distance formula

Distance = speed × time. Speed of sound is 343 m/s. Pulse length is 0.001 s. Total distance is divided by 2 to get one-way distance.

[01:07]
Wiring the sensor

Four pins: VCC (5V), Trig (digital pin, e.g., 10), Echo (digital pin, e.g., 11), Ground.

[01:38]
Coding the sensor

Initialize variables for duration and distance. Set echo as input, trig as output. Initialize serial. Set trig low, then high for 10 microseconds, then low. Read echo pulse duration. Calculate distance: duration × speed of sound / 2. Display on serial monitor.

[02:22]
Sensor limitations

Accurate within 3mm, range 2-400cm, works only with 5V. For greater range/accuracy, consider LiDAR.

[02:47]
Bonus project: Sona scanner

Ultrasonic sensor on a servo rotates back and forth, graphs detected objects on computer. Uses Arduino, servo, sensor, jumpers. 3D printed bracket or hot glue. Code and files linked in description.

[03:33]
Another project variant

Rotates and stops, turns on buzzer and LED when intruder detected. Uses RGB Duino with built-in buzzer and lights.

The ultrasonic sensor is a simple and effective way to measure distance with Arduino, with limitations in range and accuracy. The bonus project demonstrates a practical application.

Clickbait Check

90% Legit

"Title accurately describes the content: a tutorial on using ultrasonic sensor with Arduino, including a bonus project."

Mentioned in this Video

Tutorial Checklist

1 01:07 Connect VCC to 5V, GND to ground, Trig to digital pin 10, Echo to digital pin 11.
2 01:38 Initialize variables for duration and distance. Set echo as input, trig as output. Start serial communication.
3 01:50 Set trig pin low, then high for 10 microseconds, then low again.
4 02:00 Read the duration of the echo pulse using pulseIn() in microseconds.
5 02:10 Calculate distance: duration * 0.034 / 2 (speed of sound in cm/us is 0.034). Display on serial monitor.

Study Flashcards (10)

What does the ultrasonic sensor use to measure distance?

easy Click to reveal answer

Sound waves (ultrasound).

00:12

What is the formula for distance?

easy Click to reveal answer

Distance = speed × time.

00:41

What is the speed of sound?

easy Click to reveal answer

343 meters per second.

00:41

Why do we divide the total distance by 2?

medium Click to reveal answer

To get the one-way distance from sensor to object.

00:53

What are the four pins of the ultrasonic sensor?

easy Click to reveal answer

VCC, Trig, Echo, Ground.

01:07

What voltage must VCC be connected to?

easy Click to reveal answer

5 volts.

01:22

How long should the trigger pulse be?

medium Click to reveal answer

10 microseconds.

01:50

What is the accuracy of the ultrasonic sensor?

medium Click to reveal answer

Within 3mm.

02:22

What is the measurement range of the sensor?

medium Click to reveal answer

2 to 400 cm.

02:22

What alternative sensor is suggested for greater range or accuracy?

hard Click to reveal answer

LiDAR.

02:35

🔥 Best Moments

💡

How ultrasound works

Clear explanation of echo principle using high-frequency sound waves.

00:12
💡

Sona scanner project

Practical demonstration combining servo and sensor to create a radar-like visual.

02:47
💡

Intruder detection variant

Shows a creative application with buzzer and LED using RGB Duino.

03:33

Full Transcript

Download .txt

[00:00] This is how to use an ultrasonic sensor with an Arduino. It's a pretty popular module which uses sound waves to measure the distance of solid objects. In this video, you'll learn how it works, how to connect it to an Arduino,

[00:12] and a bonus project that you can make. So, how does this measure distance? This part is the transducer, which emits high-frequency sound waves called ultrasound. These sound waves will hit an object and bounce back.

[00:25] This is known as echoing. The echoed pulse will then be detected by the receiver. When the sound is emitted, the module will output a high signal When the echo is received, the output will go low The Arduino will read the length of this pulse and determine the distance based on the speed of sound

[00:41] The formula for distance is speed multiplied by time The speed of sound is 343 meters per second And the pulse length is 0.001 a second This will give us the total distance

[00:53] However, we don't want to find the total distance We only want the distance from the sensor to the object So we divide the total distance by 2 And so that gives us our final distance in meters which we can then change the units if we want

[01:07] And that's the working principles. Now here's how to wire it up. The ultrasonic sensor has four pins. VCC, Trig, Echo and Ground. VCC and Ground are power pins. VCC must be connected to 5 volts and

[01:22] and ground must be connected to ground. Trig is the trigger to emit the sound waves. It must be connected to a digital pin, which are all of these ones, so let's use pin 10. Echo is the output pin, which is the one that sends the timing pulse. Echo must be connected to a digital pin as well,

[01:38] so let's use pin 11. Now that it's all wired up, here's how to code it. We'll start by initializing variables for duration and distance. We'll set up the echo and trig pins, designating echo as an

[01:50] input and trig as an output. Then serial communication is initialized to display the distance on the serial monitor Ensure the trig pin is set to low initially and then trigger a high signal for 10 microseconds before setting it low again Then we read the duration of the echo pulse in microseconds Now we almost done

[02:10] We just got to calculate the distance by multiplying the duration by the speed of sound and dividing it by two. Finally, we display the calculated distance on the serial monitor. Great, now it works.

[02:22] However, there are some limitations to the sensor that you should be aware of. This sensor is accurate within 3mm and can only measure from 2 to 400cm. This module will also only work with 5V.

[02:35] If you need a greater range or more accuracy, consider looking at LiDARs. Anyways, let's build a simple project to demonstrate the use of ultrasonic sensors. All the code and 3D files will be linked in the description.

[02:47] This is a Sona scanner. The ultrasonic sensor is connected to a servo that rotates it back and forth. The sensor is constantly checked and will graph what it sees onto the computer. This project requires an Arduino a servo motor an ultrasonic sensor and jumpers First we attach the ultrasonic sensor to the servo motor I designed a 3D printed bracket but hot glue works just as well Now let connect everything

[03:13] and upload the code. Nice! This radar graphic is made using Processing IDE,

[03:33] which is a development environment for making easy graphics. Here's another variant of this project. It will rotate but will stop and turn on a buzzer and an LED when it detects an intruder. I'm using the RGB Duino instead of an UNO

[03:49] because it has a built-in buzzer and lights, which is pretty cool. Now you know how to use ultrasound sensors with an Arduino. If you want to get the components, you can check out the Robonix store below, supporting yourself and the channel at the same time. But anyways,

[04:03] Have fun.

⚡ Saved you 0h 04m reading this? Transcribe any YouTube video for free — no signup needed.