Using Ultrasonic Distance Sensor HC-SR04 with Buzzer, LED and Arduino

  Рет қаралды 577,483

Maker 101

Maker 101

Күн бұрын

Пікірлер: 357
@maker101io
@maker101io 3 жыл бұрын
Source Code: create.arduino.cc/editor/mertarduinotech/b7022e05-f709-4003-b2a7-5c487ee25007/preview Recommended Items: Use Your Muscles in Project - amzn.to/3wdL45C​ 37 Sensor & Module Packages - amzn.to/3m66WeQ​ Try this Robot Arm - amzn.to/3fq8DCl​ Best Resin 3D Printer - amzn.to/39tY8KB​ Arduino Compatible Kits - bit.ly/2J2AFF7​ Banggood Spring Sale - bit.ly/3slMbOn​
@hyperandaimbot
@hyperandaimbot 2 жыл бұрын
Bro not uploading
@hyperandaimbot
@hyperandaimbot 2 жыл бұрын
Itt stops at 9 percent
@hyperandaimbot
@hyperandaimbot 2 жыл бұрын
Bro how can we do it without resister
@hyperandaimbot
@hyperandaimbot 2 жыл бұрын
Please send me code
@Cxpys
@Cxpys 2 жыл бұрын
what to do if i got an error message
@Kona-bona
@Kona-bona 5 жыл бұрын
i had this project as an exam in my informatics class , and it worked and i got straight A. thank you.
@PachaHooper
@PachaHooper 4 жыл бұрын
can u send the code pls
@mrbowlingalley
@mrbowlingalley 5 жыл бұрын
3 years later and we are still building this. I set safetyDistance to 25. With only LED and no buzzer. Detects my cat coming in the room. Pretty cool - I guess!
@lecongquyen2189
@lecongquyen2189 2 жыл бұрын
What a great detailed guideline! I followed step by step and it work. I will use it for my final electrical engineering project. Thanks a lot!
@AVolt
@AVolt 7 жыл бұрын
thank you so much it worked with me. your fan from middle east اخوك من الشرق الاوسط
@PachaHooper
@PachaHooper 4 жыл бұрын
he man can u send the code if u got it please
@y.osa269
@y.osa269 3 жыл бұрын
اخوي ممكن الكود ضروري الله يسعدك
@Epic_stickman90
@Epic_stickman90 8 ай бұрын
@@PachaHooper the code is in pinned comment
@muhammadfirdauz5272
@muhammadfirdauz5272 4 жыл бұрын
NICE!!! Saved me a thousand dlrs in school fees
@alvaronicolasgamarrapena5596
@alvaronicolasgamarrapena5596 Жыл бұрын
really good video man, code is great and when i tried it worked the first time, keep the great work bro
@AR-dy3fu
@AR-dy3fu 6 жыл бұрын
If anyone has any problems to get the code...just copy mine. // defines pins numbers const int trigPin = 9; const int echoPin = 10; const int buzzer = 11; const int ledPin = 13; // defines variables long duration; int distance; int safetyDistance; void setup() { pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input pinMode(buzzer, OUTPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); // Starts the serial communication } void loop() { // Clears the trigPin digitalWrite(trigPin, LOW); delayMicroseconds(2); // Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Reads the echoPin, returns the sound wave travel time in microseconds duration = pulseIn(echoPin, HIGH); // Calculating the distance distance= duration*0.034/2; safetyDistance = distance; if (safetyDistance
@eleanorrigby226
@eleanorrigby226 6 жыл бұрын
lol 9 year old army is everywhere
@issrasaid4822
@issrasaid4822 5 жыл бұрын
A R the
@maneesh2377
@maneesh2377 4 жыл бұрын
Tq, why we want to multiple with 0.034
@kinderparahahahah0616
@kinderparahahahah0616 Жыл бұрын
No fake
@quentinb9692
@quentinb9692 5 жыл бұрын
It came in a kit, first thing that I acutally got to work with my UNO. Thanks for thie vid.
@chaturbhujbiyani4633
@chaturbhujbiyani4633 6 жыл бұрын
wow...u did it ....u saved me....i used it in science project...
@eoz8985
@eoz8985 5 жыл бұрын
i also have a science fair can you explain and the coding
@shlb3692
@shlb3692 Жыл бұрын
OMG it works thank you so much, please keep sharing projects like this.
@HAYRISHEENVASUDEVANMoe
@HAYRISHEENVASUDEVANMoe 11 ай бұрын
thank you bro you are king of arduino
@Ganondalf_the_grey
@Ganondalf_the_grey 3 жыл бұрын
got the uno and this is a great tutorial. thanks.
@mohdnaqibhaiqal2974
@mohdnaqibhaiqal2974 Жыл бұрын
I lke the video because is short and easy to understand
@crinnovator9444
@crinnovator9444 7 жыл бұрын
East or west mert is the best...... Thanks
@theelectromaker6215
@theelectromaker6215 4 жыл бұрын
Thank you very much, i saw many vids but any of them din't work but your worked thank you very much.
@AdityaYadav-mk4ye
@AdityaYadav-mk4ye 6 жыл бұрын
Thank you very much i am starting to learn arduino and thanks to you i can learn the hardware and then i will work on software
@dylansworld54321
@dylansworld54321 2 жыл бұрын
Great project! Why is my buzzer clicking instead of buzzing though?
@SG-gr3fl
@SG-gr3fl 2 жыл бұрын
Did you ever figure it out?
@djeastreofficial
@djeastreofficial 3 жыл бұрын
Awesome 👌🏻
@tomanprasad8859
@tomanprasad8859 Ай бұрын
Such a beautiful project ❤
@marcelnalewajko3537
@marcelnalewajko3537 4 жыл бұрын
Thank you! This tutorial was very good and helped me a lot
@melihapa3884
@melihapa3884 2 жыл бұрын
Hello. There are already a lot of these examples on youtube. In your circuit the lights are either on or off. The sound either squeaks or it doesn't. I wish you had made a circuit where the intensity of sound and light increases as you get closer. :(
@ArzenikDev
@ArzenikDev 11 ай бұрын
Bro just recode it to do that it's not that hard
@jwf677
@jwf677 4 жыл бұрын
// defines pins numbers const int trigPin = 9; const int echoPin = 10; const int buzzer = 11; const int ledPin = 13; // defines variables long duration; int distance; int safetyDistance; void setup() { pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input pinMode(buzzer, OUTPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); // Starts the serial communication } void loop() { // Clears the trigPin digitalWrite(trigPin, LOW); delayMicroseconds(2); // Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Reads the echoPin, returns the sound wave travel time in microseconds duration = pulseIn(echoPin, HIGH); // Calculating the distance distance= duration*0.034/2; safetyDistance = distance; if (safetyDistance
@hyperandaimbot
@hyperandaimbot 2 жыл бұрын
Hi 2nd line from last do we have to write any number after serial.print(distance)
@איילהחלק
@איילהחלק Жыл бұрын
Is this a code that causes a bulb to light up at a certain distance?
@rushabhvaidya7930
@rushabhvaidya7930 3 жыл бұрын
Thanks a lot you did it man!!! Thank again
@Si-uy8qg
@Si-uy8qg Жыл бұрын
Nice video, by the way, i'm John Blas everyone.
@thomasalexander1563
@thomasalexander1563 8 жыл бұрын
Nice tutorial,, Luckily find it in instructable.. Thank you.. Keep it
@williamkakooza4603
@williamkakooza4603 6 ай бұрын
Well done Professor
@hkiceman001
@hkiceman001 7 жыл бұрын
very interesting , I change the LED to a servo motor, it works .... good According to your code information , it means can do anything when change the led or buzzer, thank you !
@AhmedHassan-qe2hs
@AhmedHassan-qe2hs 7 жыл бұрын
what is the code if i attach vibrator instead to led ???
@srikanthch5858
@srikanthch5858 7 жыл бұрын
Can u send me the source code
@Sheik_ULEM
@Sheik_ULEM 3 жыл бұрын
Thank you this was very clear and easy to understand
@kaipeen2523
@kaipeen2523 3 жыл бұрын
does it work?
@LhorKhan214
@LhorKhan214 Жыл бұрын
hi, can you explain where did you get this value 0.034? Edited: i did a google search, its the speed of sound (343 m / s)
@vishnutripathi2885
@vishnutripathi2885 2 жыл бұрын
great work....very helpful
@avishai827
@avishai827 4 жыл бұрын
‏i can't use the arduino file
@anannt7777
@anannt7777 4 жыл бұрын
yes
@haritahiranvasu8288
@haritahiranvasu8288 4 жыл бұрын
@Barna Lengyel Thanks!! Needed this, wasn't able to access it from link in description.
@purple_clouds3797
@purple_clouds3797 2 жыл бұрын
This is just what i needed and it's very simple😆😇😇🤤
@jacoblewis8543
@jacoblewis8543 4 жыл бұрын
Nice Job Ur Great with the tutorial which is very understandable and the code. One problem is that when I went to the source code to look it took me to ur website with no code
@y.osa269
@y.osa269 3 жыл бұрын
Did you get the code? If yes please send it to me
@jacoblewis8543
@jacoblewis8543 3 жыл бұрын
@@y.osa269 no i did not get it
@AyushRaj-me8ly
@AyushRaj-me8ly 4 жыл бұрын
I like your video, is very useful for our project. Keep making these videos :)
@ArzenikDev
@ArzenikDev 11 ай бұрын
I edited your script a bit so it goes beep stop beep stop within a set range thank you for the video
@Sore_YT
@Sore_YT Жыл бұрын
My Circuit Isn't working, can somebody help?
@pizzulgaming6253
@pizzulgaming6253 3 жыл бұрын
Hi .... Can explain to me about this project that use of what system ? Hopefully in full description
@giancarlosgza
@giancarlosgza 7 жыл бұрын
Amazing video!!!!
@MarkSmith-rb5mc
@MarkSmith-rb5mc 7 жыл бұрын
Thanks for a well laid out and easy to understand tutorial. Keep up the good work!
@deadchords4919
@deadchords4919 7 жыл бұрын
digital pin 13 has a build in resistor so why to put another one?
@williammichael3913
@williammichael3913 6 жыл бұрын
Hey! I love this project tysm. But I was wondering How would I increse/decrese the range so that it will turn buzzer on when someone is more farther away? Thanks!
@Kirtymonma
@Kirtymonma 5 жыл бұрын
William Michael did you ever figure out?
@alejandroacosta6495
@alejandroacosta6495 4 жыл бұрын
Just look the code, he configured the "Safe Distance to 5", if you want to make it in different length just change the safe distance to a greater number
@cheshire793
@cheshire793 Жыл бұрын
@@alejandroacosta6495yeah, my friend and i are trying that and it's not working. do you have any other suggestions?
@stemtube8006
@stemtube8006 7 жыл бұрын
My buzzer is sounding like a Geiger counter??? it’s working but not properly, is it the buzzer or count I fix that somehow
@Thajoeee
@Thajoeee Жыл бұрын
to change the sound of the buzzer you need to replace the original piece of code with "if (safetyDistance
@andreisantos5088
@andreisantos5088 4 жыл бұрын
i'm brazilian and liked very good so much your video, congratulations!!!
@namithss7966
@namithss7966 5 жыл бұрын
thanks this was good work
@nurinqasrina7826
@nurinqasrina7826 5 жыл бұрын
Why my led keeps on and the sensor is not working 😣
@emersonrocha1097
@emersonrocha1097 8 жыл бұрын
ola,fiz esse projeto com seu codigo. mas ele ficou aprando com led vermelho sem nada na frente,como se houvesse um obstaculo sem ter.
@emilusfiogbe3450
@emilusfiogbe3450 6 жыл бұрын
merci beaucoup c'est astronomiquement instructif!!
@ikramnazri6748
@ikramnazri6748 10 ай бұрын
What type of resistor you use?
@kevinpriadinata1184
@kevinpriadinata1184 Жыл бұрын
can u make a vidio how to modify the distance
@iqratareen-mh4xw
@iqratareen-mh4xw 7 ай бұрын
Thank u sir ❤❤its working
@afnanrahman6905
@afnanrahman6905 Жыл бұрын
it is working only on time if i remove the obstacle then it is still alarming and blinking led
@MohamedAzizYazidi
@MohamedAzizYazidi 4 ай бұрын
why do when i check the monitor to see the distance every time it put the disance then a 0 again and again and that makes the buzzer make noise even when the is nothing infront of the sensor
@STudyTime4UVikasMishraSir
@STudyTime4UVikasMishraSir 2 жыл бұрын
Thank you for your nice and easy video editing Surely helpful for beginners
@cubebrix5801
@cubebrix5801 2 жыл бұрын
hi. can you help me, im only using led and its only blinking
@InkByt3
@InkByt3 6 ай бұрын
@@cubebrix5801 If you're only using the LED that is what it is supposed to do.
@cassandraservo
@cassandraservo 5 жыл бұрын
Where do u write the code?
@katianuriu7506
@katianuriu7506 11 ай бұрын
What type of buzzer did you use?
@Khichri7086
@Khichri7086 Жыл бұрын
What type of jump wires
@ArzenikDev
@ArzenikDev 11 ай бұрын
It doesn't matter what type as long as it's male to male
@HotDoggyStand
@HotDoggyStand 5 жыл бұрын
any reason why mine is reading out distances in the 2ks. I used the code you provided us with.
@ahmedomaar
@ahmedomaar Жыл бұрын
Thanks for your helping, I make it
@G.V.Ramnivedan
@G.V.Ramnivedan 7 жыл бұрын
While coding should we connect the arduino board to the bread board please tell me soon
@assampwd
@assampwd 8 жыл бұрын
digital pim 13 already has a resistor attatched to it. So need of that extra resisitor
@applefinn3933
@applefinn3933 5 жыл бұрын
how do you change the distance of when the buzzer starts
@AvighnaDaruka
@AvighnaDaruka 3 жыл бұрын
Hi bro, did you use passive or active buzzer?
@harshithraj6055
@harshithraj6055 2 жыл бұрын
Only we have to do this code with computer only or we can use cellphone
@TusharSharma-is1mi
@TusharSharma-is1mi 7 жыл бұрын
Great job yaar I needed this help and....
@JaydiEntenia
@JaydiEntenia 9 ай бұрын
yey it worked, but how do i make it so that it'll have longer distance?
@dhirajmandal715
@dhirajmandal715 3 жыл бұрын
thanks it help a lot ❤❤
@yoMyoM-k6q
@yoMyoM-k6q 2 жыл бұрын
Why I can't use "serial.print/In" and "distance"
@belaaa522
@belaaa522 3 ай бұрын
THNKYOUU ITS WORKS
@aryansuratkar1980
@aryansuratkar1980 5 жыл бұрын
My project was unsuccessful can you help me please
@AakashAakash-xr6qb
@AakashAakash-xr6qb Жыл бұрын
Can we use capacitor and what is the purpose ?? Bro
@ArzenikDev
@ArzenikDev 11 ай бұрын
Why would you add a capacitor???? That just holds energy and shoves it in bursts
@linmgkhine344
@linmgkhine344 2 жыл бұрын
I would like to know How much Safety factor ? How to calculate? Thanks
@ibrahimEditzFootball
@ibrahimEditzFootball Жыл бұрын
Can we make it without led
@shrutiverma9077
@shrutiverma9077 4 жыл бұрын
Can we directly use the led on pin 13
@Dofusvidss
@Dofusvidss 7 жыл бұрын
Thank yoou very much for your tutorials ! I'm a beginner on arduino, why don't you connect the buzzer (+) on VCC ?
@mohammadabas3890
@mohammadabas3890 2 жыл бұрын
How can I connect two sensors in series in this case?
@phonepaseuthkhounthachack9459
@phonepaseuthkhounthachack9459 3 жыл бұрын
It is work. Thanks bro
@gunjanchoudhary5310
@gunjanchoudhary5310 2 жыл бұрын
Sir Mera coda upload nhi ho rha h uske liye mujhe library download Karna padega but Kon sa library download karu ye nhi samjh me aa rha
@mehrozali2886
@mehrozali2886 7 жыл бұрын
sir, how to increase and decrease distance range ??? please please please reply
@chaturbhujbiyani4633
@chaturbhujbiyani4633 6 жыл бұрын
hatt
@Joe-xq6on
@Joe-xq6on 6 жыл бұрын
lettuce
@SMARTS-mv4nh
@SMARTS-mv4nh 7 жыл бұрын
what the problem i can't able to run this either the buzzer continuously sounds or sometimes not sounds ,i removed the light section from it
@rhythms7500
@rhythms7500 5 жыл бұрын
Same here What's the solution for that?
@millertalkstv2525
@millertalkstv2525 5 жыл бұрын
remove the cover on the buzzer..
@azajshaik9044
@azajshaik9044 6 жыл бұрын
without ohm resistor the will work or not
@azajshaik9044
@azajshaik9044 6 жыл бұрын
i mean led will work or not
@kutlupolat7036
@kutlupolat7036 6 жыл бұрын
if you do not use resistor,it's probably LED burning out. Resistor is protecting LED by decrease current.
@_vishnu2142_
@_vishnu2142_ 2 жыл бұрын
Can we do this project without led and resistor ? Please reply sir
@OfficialAldrxch
@OfficialAldrxch 6 жыл бұрын
Do you have the circuit diagram for this project? Urgently need it..thanks
@ravichandrika4824
@ravichandrika4824 4 жыл бұрын
me too want the circuit diagram can any one mail it please (rchandrika723@gmail.com)
@OfficialAldrxch
@OfficialAldrxch 4 жыл бұрын
@@ravichandrika4824 no need to bother.. its been a year and still no reply from the creator
@kaipeen2523
@kaipeen2523 3 жыл бұрын
Is that works?
@OfficialAldrxch
@OfficialAldrxch 3 жыл бұрын
@@kaipeen2523 still no reply from the creator since 2018 😂
@3bsily
@3bsily 6 жыл бұрын
how i can add vibration motor with this project > same a smart blind stick please any one help me to add vibration motor
@prashantpal8376
@prashantpal8376 3 жыл бұрын
Arduino Uno R3 Development Board with USB Cable can we use this
@egorkorbasov3422
@egorkorbasov3422 7 жыл бұрын
Hi! I tried to do 2 things together, Like a bell ring (you push the button and hear the buzzer rings) and LDR+3colorLED. But when I press the button when there is no light it rings only when the loop of LED is over. Why is it so?
@sreekarbss5475
@sreekarbss5475 5 жыл бұрын
Thanks bro it helped in my project
@janellguerriero1361
@janellguerriero1361 5 жыл бұрын
Can u help me pls
@y.osa269
@y.osa269 3 жыл бұрын
I'd like the code, please
@aConfusedAmp
@aConfusedAmp 6 жыл бұрын
I only have 2 GND pins and your video requires 3 (so far). What do I do?
@chrisnyenya5233
@chrisnyenya5233 6 жыл бұрын
one common ground can be used on the buzzer and LED
@tanvirahmad3671
@tanvirahmad3671 5 жыл бұрын
Use a wire to connect it to breadboard to make it short. :D
@charliebell7163
@charliebell7163 3 жыл бұрын
How would i make it louder ? and also how would i make it longer range thanks you!!
@Umutt1316
@Umutt1316 4 жыл бұрын
Teşekkürler işime yaradı ve bir beğeni de benden
@rumaishafatima6053
@rumaishafatima6053 2 жыл бұрын
Sir, how will it be if you connect this project with GSM modem?
@jamesmay4547
@jamesmay4547 2 жыл бұрын
Thank you for the great video and what is the name of the background music
@UmmmIlovemath
@UmmmIlovemath 3 жыл бұрын
how to get the app for distance
@dhomepanda22
@dhomepanda22 4 жыл бұрын
what type of Resistor
@chalsu
@chalsu 2 жыл бұрын
Hey, can I add an LCD to this project? and How will the code be written when the LCD is added?
@shuvamjung1639
@shuvamjung1639 Жыл бұрын
Ultra sonic security system or ye same hai??
@rafabalderas8948
@rafabalderas8948 7 жыл бұрын
Can I connect more than 1 LED? If i wish to disconnect the buzzer l, should I delete something in the code??
@alphagamingff2011
@alphagamingff2011 3 жыл бұрын
Can ve use another board uno small
@prempanchal7721
@prempanchal7721 3 жыл бұрын
Hey Bro, I Have 3 Pin Buzzer Sensor GND, I/O, VCC... So which connection should I do...?
@Sketch_Artist645
@Sketch_Artist645 2 жыл бұрын
If I open the source code I can't find the code
Make a TINY Arduino Drone with FPV Camera - Will It Fly?
20:26
Max Imagination
Рет қаралды 1,5 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Ultrasonic sensor project with buzzer and arduino
4:24
be innovative with prasad
Рет қаралды 92 М.
HC-SR04 Ultrasonic Distance Sensor and Arduino (Lesson #9)
5:28
Science Buddies
Рет қаралды 155 М.
Arduino Radar System. Detector. (Ultrasonic sensor and Servo Motor)
6:08
You can learn Arduino in 15 minutes.
16:34
Afrotechmods
Рет қаралды 10 МЛН
Arduino Ultrasonic Distance Alarm
5:13
Viral Science - The home of Creativity
Рет қаралды 82 М.
Sensors - which one to use
17:06
Electronoobs
Рет қаралды 1,4 МЛН
ALARMA CASERA ANTIRROBO con ARDUINO y SENSOR ULTRASÓNICO | Como hacer
6:57
La Constante Universal
Рет қаралды 241 М.
СИЖУ БЕЗ ЕДЫ, ПЬЮ ОДНУ ВОДИЧКУ.
21:37
Быть Добру
Рет қаралды 79 М.
Это лютый угар 🤣 | приколы Арсен Симонян
0:14
Арсен Симонян
Рет қаралды 294 М.
для всей семьи
0:56
Стакановец
Рет қаралды 191 М.
пранк: псих сбежал из дурдома
0:53
Анна Зинкина
Рет қаралды 1,7 МЛН