Arduino Tutorial for Beginners 18 - Using the SONAR MODULE (HC SR04) Ultrasonic Distance Sensor

preview_player
Показать описание
Welcome to this video on Arduino Tutorial for Beginners. This video about Sonar Module (HC SR04) Ultrasonic Distance Sensor With Arduino.

This video shows how Sonar module work

The sonar module will transfer wave to object and then receive that reflected wave again . And we will base on this way to calculate the distance between object and module.

About TIME :
We call time transfer from module to object is t1
We call time receive echo wave from object is t2
Two time is approximate equal , so we can get the TIME = (t1 + t2 )/2

About SPEED :
The speed of sound is around 340-359 in our air, so i will take average is about 347.5 m/s
we will convert it to cm/us on google or divide be 100000 ,And we can get the SPEED

About DISTANCE:
Base on the formular , we have DISTANCE = TIME * SPEED (cm)

We can use the method above to get the distance or use the library on the internet

----------------------
Code :

pulseIn(_pin,HIGH)
This fuction will retrurn a INTERGER value of HIGH time in a pulse

pulseIn(_pin,LOW)
This fuction will retrurn a INTERGER value of LOW time in a pulse


Arduino programs, called “sketches”, are written in a programming language similar to C and C++. Many sensors and other hardware devices come with prewritten software – look on-line for sample code, libraries (of functions), and tutorials. Learn the Arduino platform and programming language to create robots, interactive art displays, electronic gadgets and much more.

#ProgrammingKnowledge #Arduino #ArduinoTutorial
★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
Рекомендации по теме
Комментарии
Автор

stupid question though....where do you insert the code you have written?

felixkimutai
Автор

How long distance it will work, 50m, 100m, ..., Nm?

bahramudinadil
Автор

It's not a sonar, it's a distance sensor.

KindaStrang