Robotics Training LESSON 16: Using the HC-SR04 Ultrasonic Sensor

preview_player
Показать описание
You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:

You can follow along at home using this Elegoo Robot Kit, Available HERE:
(affiliate link)

In this lesson we show how to use the HC-SR04 ultrasonic sensor for echolocation. In this video we show how to use the sensor to measure ping travel time. That is the time for a ping to leave the sensor, travel to target, bounce off the target, and then return. We show how to code the sensor up in arduino, and how to understand the measured values.\

We have included the code developed in this lesson at our WEB site HERE:

#Arduino
#Echolocation
#Tutorial
Рекомендации по теме
Комментарии
Автор

So glad this series is still continuing.

jumbo
Автор

I had to use your hints and i had to go back and watch your video on dimensional analysis. But i got it working. I have always struggled with this in physics and math. Thanks so much love all your video instruction. Stay safe.

Rasspor
Автор

I am a legend, thanks to your Arduino lessons I took first. Thank you, Paul.
for everyone who wants the code:
int Trig= 13; //The connection of your Trig pin can be different. Make sure you check the links on your car
int Echo = 12; //The link of your Echo pin can be other. Make sure you check the links on your car
int pingT;

void setup() {
// put your setup code here, to run once:
pinMode(Trig, OUTPUT);
pinMode(Echo, INPUT);
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
pingT = pingTime();
Serial.println(pingT);
delay(500);
}
int pingTime(){
int pingTravelTime;
digitalWrite(Trig, LOW);
delayMicroseconds(2);
digitalWrite(Trig, HIGH);
delayMicroseconds(20);
digitalWrite(Trig, LOW);
pingTravelTime=pulseIn(Echo, HIGH);
return pingTravelTime;


}

fatoumatabintadiallo
Автор

You are the great professor I ever seen in my life.
Your way of teaching is excellent sir Boom thanks a lot .

mohamedyasararafathkajamoh
Автор

Thank you for coming back to this series. It's one of my favorites

JohannPerezE
Автор

I am glad you are back and excited to help us learn what can be done with arduino. I worked the sensor on the robot.

'Speed of sound' formula. Well I did look this up on the internet, but just found a number to divide with then divide with 2.

I looked at the video that showed your formulas, but got lost in the cancellations.

gghutton
Автор

Very very happy to see you sir again after a long time for this excellent lesson. Thank you.

pralaymajumdar
Автор

I am glad you are continuing this series!

johnstephenson
Автор

Thanks for the lesson Paul. Fun seeing distances this way. Wikipedia will give you speed in feet per Next lesson at mach

paulmeistrell
Автор

Sir thanks a lot for bring this video , we are student, we likes your lesson, thanks

rabbiagyemang
Автор

At last you are back into teaching a great lessons.

anwar
Автор

Glad to see the Robot Car back in action. Looking forward to more. Happy Thanksgiving to you and your family, Paul.

opalprestonshirley
Автор

Hello Paul,

Great to see the continued awesome series on the smart car I know I am getting ahead of myself but look forward to lessons on line following. I have an application for line following and a camera with the smart car. However I find the driving real jerky and consequently the camera view is jerky. I look forward to maybe seeing your awesome math expertise to create a pid algorythm to the line following algorythm to solve the jerky line following problem. Always look forward to all your lessons and thank you again

rickbonari
Автор

Love the content. We are a bit behind. After the ultrasonic I have two projects. My son wants to control the car with a joystick so I'll need to learn to code that system up. Second project is to use the BNo055 for a bit better control. I'll keep you posted here how it goes. Especially the IMU. I've seen a lot of comments asking for it here. If I can figure it out I'll post a video with some code explanations and setup along with performance.

Not sure if the IMU will be good enough. Gyro drift could be an issue as well as magnetic interference from the current draw and other metal near the IMU.

nathanleopold
Автор

Paul, thank you. As usual, I enjoyed that. I was expecting it.

collengura
Автор

While you have been out I have be furiously trying multiple ideas for my robot car. One is the 433MHz transmitter. I sure have learned much alone the way. Since I use Linux and use clones I have the USB to serial problem. I have solved this problem for me with the executable script 'arduino-linux-setup.sh', which is found in the setup folder. Yummy I look forward to the sensor features.

gghutton
Автор

Love it cool video ! These sensors are the fun part of this not easy but fun!😁👍

wishicouldarduino
Автор

thank you so much for making more videos on this topic

premkumar-ypef
Автор

For anyone following this course who has version V4 of the robot car the trigger and echo pins connect to different pins on the Arduino i.e. Trig=13 and Echo=12. Hope that helps.

doctorzak
Автор

Ordered the kit today. I got a lot of catching up to do!

johnwright