Using Ultrasonic Distance Sensor HC-SR04 with LCD Display and Arduino

  Рет қаралды 294,554

Maker 101

Maker 101

7 жыл бұрын

Display the results from the HC-SR04 Ultrasonic Sensor on an LCD
Required Hardware:
Arduino Board :
goo.gl/UyGYeF (Banggood)
amzn.to/2LZr6t4 (Amazon)
Ultrasonic Sensor:
goo.gl/dRkWUg (Banggood)
amzn.to/3s4SbdT (Amazon)
LCD Display:
goo.gl/1ljUCs (Banggood)
amzn.to/3bbBgzu (Amazon)
10K Ohm Potentiometer :
goo.gl/c90Uix (Banggood)
amzn.to/3dlgYq1 (Amazon)
Breadboard:
goo.gl/yCa8hX (Banggood)
amzn.to/3qxLxwm (Amazon)
Jumper Wires: amzn.to/3doetmT (Amazon)
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
Connections:
The HC-SR04 Ultrasonic Module has 4 pins, Ground, VCC, Trig and Echo. The Ground and the VCC pins of the module needs to be connected to the Ground and the 5 volts pins on the Arduino Board respectively and the trig and echo pins to any Digital I/O pin on the Arduino Board.
The HC-SR04 sensor attach to the Breadboard
The Sensor VCC connect to the Arduino Board +5V
The Sensor GND connect to the Arduino Board GND
The Sensor Trig connect to the Arduino Board Digital I/O 9
The Sensor Echo connect to the Arduino Board Digital I/O 10
Watch the basic tutorial about the HC-SR04:
• Using Ultrasonic Senso...
LCD Display Connection:
Before wiring the LCD screen to your Arduino or Genuino board we suggest to solder a pin header strip to the 14 (or 16) pin count connector of the LCD screen.
To wire your LCD screen to your board, connect the following pins:
LCD VSS pin to Arduino GND
LCD VDD pin to Arduino 5V
LCD VO pin to 10k Potentiometer center pin
LCD RS pin to digital pin 1
LCD RW pin to Arduino GND
LCD Enable pin to digital pin 2
LCD D4 pin to digital pin 4
LCD D5 pin to digital pin 5
LCD D6 pin to digital pin 6
LCD D7 pin to digital pin 7
The 10k Potentiometer's other legs connect to +5V and GND
For the backlight of the display, pin 15 (A+) and 16 (K-) of the LCD connect to +5V and GND
If you want, can be use a 220 ohm resistor to power the backlight of the display.
Watch the basic tutorial about the LCD Display: • Arduino LCD Display Co...
About Source Code
The LiquidCrystal library allows you to control LCD displays that are compatible.
First you have to define the Trig and Echo pins. In this case they are the pins number 9 and 10 on the Arduino Board and they are named trigPin and echoPin. Then you need a Long variable, named “duration” for the travel time that you will get from the sensor and an integer variable for the distance.
In the setup you have to define the trigPin as an output and the echoPin as an Input and also start the serial communication for showing the results on the serial monitor. If the object is 10 cm away from the sensor, and the speed of the sound is 340 m/s or 0.034 cm/µs the sound wave will need to travel about 294 u seconds. But what you will get from the Echo pin will be double that number because the sound wave needs to travel forward and bounce backward. So in order to get the distance in cm we need to multiply the received travel time value from the echo pin by 0.034 and divide it by 2.
Source Code: create.arduino.cc/editor/mert...
Social Media:
/ mertarduino
/ mertarduino

Пікірлер: 210
@maker101io
@maker101io 3 жыл бұрын
Source Code: create.arduino.cc/editor/mertarduinotech/d4f52015-daf2-44c0-962c-7134e33aa99c/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​
@sabrinaflipse7732
@sabrinaflipse7732 4 жыл бұрын
Omg someone who actually writes where the wires go 👍👍👍 subscribing now!
@seeking9145
@seeking9145 3 жыл бұрын
A schematic is way more useful. Maybe better to do both. But in a schematic you can see everything in just one image. Search for "schematic ultrasonic sensor arduino"
@vaibhav.m1707
@vaibhav.m1707 3 жыл бұрын
Your codes are awesome Works well!! Overall excellent
@mikex691
@mikex691 7 жыл бұрын
Did it just like your tutorial. Works perfectly first time !! Thank you for all the work you did...
@zahidayub4217
@zahidayub4217 4 жыл бұрын
Kindly give arduinho.code.i am unable to open it
@daltonhatinger5968
@daltonhatinger5968 4 жыл бұрын
so helpful listeding the resister omps and potentiometer
@patrickokello9043
@patrickokello9043 7 жыл бұрын
thank you and i love your works, keep it up
@zahidayub4217
@zahidayub4217 4 жыл бұрын
Kindly give arduinho.code.i am unable to open it
@yabbero8359
@yabbero8359 2 жыл бұрын
my guy you and your funky cowboy music is saving the entire 2022 year one computer science students
@alibayrak3935
@alibayrak3935 5 жыл бұрын
4 saattir uğraşıyorum sizin videoyu gördüm ve 10dk de yaptım teşekkürler
@iremkoprek6394
@iremkoprek6394 4 жыл бұрын
merhaba koda erişemiyorum sizde var mı
@adityarai7674
@adityarai7674 7 жыл бұрын
🙋🙋you give best tutorial😍 keep it up👍👍👍👌👌
@divyanshgarg112
@divyanshgarg112 3 жыл бұрын
thank u so much for this good
@chrislambert2659
@chrislambert2659 5 жыл бұрын
Could you do this same code but using a VL53L1X lidar time of flight sensor on your next video, whilst using the same items except for the ultrasonic sensor?
@sleepingconstantly2547
@sleepingconstantly2547 7 жыл бұрын
Thanks really helpful video
@JK-ud8ex
@JK-ud8ex 3 жыл бұрын
Is it possible to synthesise a digital display on a manual vernier caliper? Can you upload a project describing this?
@aligonia
@aligonia 4 жыл бұрын
Really helpful tutorial! It worked first try!
@zahidayub4217
@zahidayub4217 4 жыл бұрын
Kindly give arduinho.code.i am unable to open it
@aligonia
@aligonia 4 жыл бұрын
@@zahidayub4217 The file is still at the link that says "Download Source Code". Unzip the file and there is a .ino file inside. Open arduino.exe and use it to open the .ino file.
@onedirlasss
@onedirlasss 6 жыл бұрын
Error compiling for board Arduino/Genuino Uno. ? I introduced my card to the arduino still says so
@dora_cmatius1901
@dora_cmatius1901 3 жыл бұрын
thank you for your sources...
@yoyo3257
@yoyo3257 2 жыл бұрын
thank you for your code it saves me really
@adityasidham1812
@adityasidham1812 7 жыл бұрын
I cannot express how much this video helped me as I brought a new ultrasonic sensor I made this with a success I wanted to show how my project worked, thanks again for this video👏
@yajuvendrasinghrajpurohit7888
@yajuvendrasinghrajpurohit7888 6 жыл бұрын
Aditya1 Sidham can you tell how did it work because everyone is telling that it doesn't work .please tell what did you do as I am making it for my science project .
@ercancakir41
@ercancakir41 6 жыл бұрын
Do you have a schematic if I wish to add Buzzer for this project?
@Knowles96
@Knowles96 7 жыл бұрын
I'm looking to go to 1 decimal place! Do you think this would be possible?
@didiersee
@didiersee 6 жыл бұрын
super congratulations thank you for the sharing. Could you tell me if the ultrasonic sensor can be 15 meters from the arduino uno board?
@pavaniduggirala7659
@pavaniduggirala7659 5 жыл бұрын
i didnot use potentiometer and made rest of the connections.But didnot see anything on the lcd,after uploading the given source code.can u help me
@udangadasun9489
@udangadasun9489 5 жыл бұрын
Having trouble with i2c lcd screen 😓
@imadeddarraz3247
@imadeddarraz3247 5 жыл бұрын
tnk bro you are the good go luck bro
@namanniranjanee8278
@namanniranjanee8278 2 жыл бұрын
Is it necessary to use potentiometer?
@taqitahmidtanzil2851
@taqitahmidtanzil2851 7 жыл бұрын
great video!! can you please upload another one without potentiometr
@sarojkulkarni4904
@sarojkulkarni4904 7 жыл бұрын
ek number.......!!!! mala pan tech paije
@sixsoxsex1
@sixsoxsex1 4 жыл бұрын
How is the max distance that it can measure?
@isaacnnakwu457
@isaacnnakwu457 6 жыл бұрын
works great, just follow the instruction in the first line of code
@harsh....8993
@harsh....8993 4 жыл бұрын
Bro lcd is not turning on
@amritlalsingh7780
@amritlalsingh7780 7 жыл бұрын
can you make a soil moisture display.thanks
@ravindrareddyravindra24
@ravindrareddyravindra24 6 жыл бұрын
How much distance it can detect I need 10 meters detect sensor can give a suggestion
@darshansavani555
@darshansavani555 7 жыл бұрын
keep it up!!!! bro
@nektarioskoumantakis4987
@nektarioskoumantakis4987 5 жыл бұрын
Sketch uses 3348 bytes (10%) of program storage space. Maximum is 32256 bytes. Global variables use 71 bytes (3%) of dynamic memory, leaving 1977 bytes for local variables. Maximum is 2048 bytes. avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x10 avrdude: stk500_recv(): programmer is not responding
@chandandubey9670
@chandandubey9670 6 жыл бұрын
Sir, how you setup this cheap China Arduino to pc.? When interfacing with PC our code is not uploading to arduino
@anuradhakhanna375
@anuradhakhanna375 2 жыл бұрын
thank u brother :)
@overridebros8653
@overridebros8653 4 жыл бұрын
can i make this project without potentiometre??
@hamzaamir1617
@hamzaamir1617 4 жыл бұрын
can it work without potential lo meter
@claudioantonoaie4717
@claudioantonoaie4717 6 жыл бұрын
Work whit sr05?
@abdulrahmaneldin30
@abdulrahmaneldin30 6 жыл бұрын
what did you write after you show the code I cant see it
@primevigilante7259
@primevigilante7259 3 жыл бұрын
will same code work without potentiometer?
@faiys
@faiys 5 жыл бұрын
Wear resistor go?
@iqbalibrahim4713
@iqbalibrahim4713 6 жыл бұрын
can I use 7 segment led
@rajeshbopparthi5621
@rajeshbopparthi5621 2 жыл бұрын
Is diagram for pin connections available?
@sachintr8086
@sachintr8086 2 жыл бұрын
nyc work
@Noctis-CXIV
@Noctis-CXIV 7 жыл бұрын
Mine doesnt work. How do you put the resistor?
@roadtotheol9698
@roadtotheol9698 4 жыл бұрын
wow . I amazed that
@nooraldahmani997
@nooraldahmani997 2 жыл бұрын
Help. How can we connect more than 1 ultrasonic sensor and fix the code accordingly?
@catzforlife575
@catzforlife575 4 ай бұрын
can u make an I2C lcd version of this please
@pavankumarchindam7415
@pavankumarchindam7415 5 жыл бұрын
How lcd display glow
@Eylcglr
@Eylcglr 3 жыл бұрын
blog sayfasnıza ulaşamıyorum , kodu paylaşabilir misiniz açıklamalar kısmında?
@sciencesid
@sciencesid 7 жыл бұрын
For some reason, all I get is a blank LCD screen and squares when I checked the serial monitor...
@Terx37
@Terx37 5 жыл бұрын
did you turned the potentiometr ?
@nahujpidaras7380
@nahujpidaras7380 4 жыл бұрын
what is the libary? and i cant go to the code website
@sciencesid
@sciencesid 7 жыл бұрын
Now for some weird reason, my Arduino is not connecting with my computer, but it still turns on because of the cable that connects your Arduino with your computer...
@catchgenerics8667
@catchgenerics8667 7 жыл бұрын
Does it have to constantly be connected to the computer to get info from the serial monitor?
@faxd3448
@faxd3448 7 жыл бұрын
yes. this is why you use the lcd
@ushak.k4237
@ushak.k4237 5 жыл бұрын
why is potentiometer used
@mohamedsultan3889
@mohamedsultan3889 8 ай бұрын
i have a problem: doenst work HELP !!! The sketch uses 3302 bytes (10%) of the program memory space. The maximum is 32256 bytes. Global variables use 71 bytes (3%) of dynamic memory, leaving 1977 bytes for local variables. The maximum is 2048 bytes.
@ulisesleonels.c.7223
@ulisesleonels.c.7223 7 жыл бұрын
no das el código o lo que lleva dentro de app inventor?
@sonuKhan-sh8oe
@sonuKhan-sh8oe 4 жыл бұрын
Can u give me the code becoz i cant open the code, an error occurs while i try to open the code
@amilcaririasaguilar8400
@amilcaririasaguilar8400 6 жыл бұрын
hello mert Arduino and tech as I add un Led to this project can you help me
@andhrarifkoskvy2626
@andhrarifkoskvy2626 4 жыл бұрын
why i can open the code?
@baala2739
@baala2739 3 жыл бұрын
very very detailed. I am not an electronic Guy. I want to make it. Is it possible with 400 / 170 point holes Breadboard?. If yes can you pls share the wiring?
@kushagraarora6412
@kushagraarora6412 Жыл бұрын
just use male to female jumper wires
@baala2739
@baala2739 Жыл бұрын
@@kushagraarora6412 is this read including decimal places? i.e 14.3 / 9.5
@nizamudeenmohammed8898
@nizamudeenmohammed8898 6 жыл бұрын
Could you plz send Circuit diagram..
@kellyspoolhall761
@kellyspoolhall761 2 жыл бұрын
Video was great until the end. Could not see the code because video links popped up in front. Add a bit of black screen or something less important at the end so the important stuff doesn't get covered up.
@factrey2745
@factrey2745 2 жыл бұрын
Viva me connection puch sakte hain?
@ImtiazTech
@ImtiazTech 4 жыл бұрын
nice
@creativenathani6513
@creativenathani6513 5 жыл бұрын
In serial monitor the distance is showing 0. Irrespective of object towards the ultrasonic sensor. What to do.
@navjotsingh8372
@navjotsingh8372 5 жыл бұрын
Chk if your echo and trigger pins are at proper pins
@impactza3231
@impactza3231 3 жыл бұрын
The code is no longer on the site. Can someone please help me to get the code.
@redlangga9257
@redlangga9257 7 жыл бұрын
are the lcd connections would be the same if i'll use 128x64 lcd?
@leagracebasalo398
@leagracebasalo398 7 жыл бұрын
ok. thank you :) God bless.
@baala2739
@baala2739 2 жыл бұрын
Am hobbyist. I need the code and circuit diagram for 1) distance measurement both CM & Inches with decimal( Centimeter & Inches) for 16X02LCD without using breadboard And 2) distance measurement both CM , Inches , Ft & MM with decimal(CM , Inches, Millimeter & feet) for 16X04LCD Can you pls share it?
@michaeldecarlo8738
@michaeldecarlo8738 7 жыл бұрын
Yes, but the screen is displaying gibberish. The lcd works fine before the sensor code executes and the sensor data in the console is correct.
@swamyvy2250
@swamyvy2250 4 жыл бұрын
Dear sir if I download the source code it shows unsupported file why❓❓
@shivkushwaha5356
@shivkushwaha5356 6 жыл бұрын
please make wireless Water level indicator using arduino ultrasonic sensor and 16×2 lcd
@aaronmarcc4440
@aaronmarcc4440 4 жыл бұрын
why is my screen blank??
@jackforrester4734
@jackforrester4734 7 ай бұрын
copied the tutorial my LCD screen turns on but no text is being displayed any help ?
@nischalchirkute1184
@nischalchirkute1184 3 жыл бұрын
my arduino turns off when i uses it. My macbook says its using to too much power or something can anyone pls help me
@tplg9117
@tplg9117 6 жыл бұрын
Hi.. I want the LCD to display "STOP" when a certain distance is reached.. How can it be done??
@lrhpro688
@lrhpro688 6 жыл бұрын
if statement is the key . for ex if ( distance ==100){ lcd.clear(); }
@ABHI-1432
@ABHI-1432 Жыл бұрын
Sir Mujhe 1 problem Hai Main kisi chij ki height measure kar raha houn Using Ultrasonic sensor hc-sr04 But vo height vary hoti hai ( sin wave ki taraha ) Mera problem aisa hai ki 1bar agar use chij ki height maximum level pr gayi to co readings pause ho Jani chahiye Aur mujhe max height dikhani chahiye display pr ( 16 × 2 lcd ) To vo hum kaise kr saktain hain please help.....
@navjotsingh8372
@navjotsingh8372 5 жыл бұрын
My lcd is only showing 3218 and distance is not getting changed please help
@juanbriones1760
@juanbriones1760 7 жыл бұрын
if I use arduino mega just change the pins numbers?
@hydranugget7865
@hydranugget7865 3 жыл бұрын
no
@hydranugget7865
@hydranugget7865 3 жыл бұрын
just noticed 4 years
@devmiththenujayan2266
@devmiththenujayan2266 5 жыл бұрын
can i make this without potentiometer i dont need the backlight
@alikadhim3256
@alikadhim3256 5 жыл бұрын
No, because the potentiometer also controls the brightness. I think you might be able to use a resistor
@zurkela1
@zurkela1 4 жыл бұрын
Can you send the code? I dont have it anywhere!!!
@mujeebdahri159
@mujeebdahri159 4 жыл бұрын
source code link expired send me new link
@syurgafirdaus7716
@syurgafirdaus7716 4 жыл бұрын
that's the code
@colorboxartacademy3497
@colorboxartacademy3497 7 жыл бұрын
proximity2:1: error: #include expects "FILENAME" or #include 'LiquidCrystal.h' //Please replace the single quote characters ('') with the parenthesis character () ^ exit status 1 #include expects "FILENAME" or PLEASE HELP
@deilasr9419
@deilasr9419 7 жыл бұрын
ohh thanks its helped
@saravananb4235
@saravananb4235 6 жыл бұрын
send code
@md.meftahulhaque7166
@md.meftahulhaque7166 6 жыл бұрын
I am also facing same problem!!
@schoolagers133
@schoolagers133 4 жыл бұрын
Code does not work, tried it :(
@RickvanOsyoutube
@RickvanOsyoutube 7 жыл бұрын
I do not see letters in my project
@jonathandias3403
@jonathandias3403 3 жыл бұрын
lcd. begin does not work. pls fix
@kushagramahajan2924
@kushagramahajan2924 6 ай бұрын
the lcd is not displaying anything please help
@michaeldecarlo8738
@michaeldecarlo8738 7 жыл бұрын
The lcd works great but when I add the sensor I get a garbled display, unreadable, all black boxes. Everything is wired and programmed correctly, what causes this?
@michaeldecarlo8738
@michaeldecarlo8738 7 жыл бұрын
Yes, but the screen is displaying gibberish. The lcd works fine before the sensor code executes and the sensor data in the console is correct.
@michaeldecarlo8738
@michaeldecarlo8738 7 жыл бұрын
yes, but still gibberish... i think its an arduino problem...but dont know how to fix it
@michaeldecarlo8738
@michaeldecarlo8738 7 жыл бұрын
Actually, it turned out to be a software problem. I had one of the pin assignments pointing to a wrong pin on the arduino.
@amitk5767
@amitk5767 6 жыл бұрын
my lcd is not showing the distance but only backlight is glowing? what can i do
@javi4fun
@javi4fun 3 жыл бұрын
In the code, replace the single quote characters ('') with the parenthesis character ()
@vishaludhodasani7071
@vishaludhodasani7071 5 жыл бұрын
How can we connect Number of ultrasonic sensor with lcd?is that possible
@shaileshmanerikar3355
@shaileshmanerikar3355 5 жыл бұрын
I too have the same doubt
@mariodarmo6030
@mariodarmo6030 4 жыл бұрын
i destroy my two potenciometers :( sad
@qksf1645
@qksf1645 4 жыл бұрын
my display shows nothing only blue :( help
@bbsingh7554
@bbsingh7554 5 жыл бұрын
Error: cannot upload to the board. Pls guide
@schoolagers133
@schoolagers133 4 жыл бұрын
yes same
@nikoranosa7981
@nikoranosa7981 4 жыл бұрын
can you please help me where will i find the code i cant reach the site of the code
@IndeGames81
@IndeGames81 3 жыл бұрын
hes rit
@naveengollavilli5167
@naveengollavilli5167 7 жыл бұрын
circuit diagram
@baneknight7402
@baneknight7402 7 жыл бұрын
I want to add names whenever there we reset arduino or at start How can I add names of me and my group members in the same code of the video Plz help
@baneknight7402
@baneknight7402 7 жыл бұрын
Thanks
@audreylacroix5885
@audreylacroix5885 4 жыл бұрын
Where is the code it says account suspended
@nahidhasan6427
@nahidhasan6427 4 жыл бұрын
Can't getting the code
@divyanshidubey7382
@divyanshidubey7382 3 жыл бұрын
Can I power this by connecting it to my laptop through USB port? Or do I have to buy adapter or battery?
@mr.mysterio8556
@mr.mysterio8556 2 жыл бұрын
Brother my Lcd Backlight is not working and calculation is wrong
@wellwisherofyoutube
@wellwisherofyoutube 6 жыл бұрын
is it real working or not tell me ,pls tell truth
@kiddanhelli4073
@kiddanhelli4073 4 жыл бұрын
Code is wrong
Ultrasonic Sensor HC-SR04 and Arduino Tutorial
5:16
How To Mechatronics
Рет қаралды 1,4 МЛН
How to Set Up an Ultrasonic Range Finder on an Arduino
12:30
Circuit Basics
Рет қаралды 264 М.
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 15 МЛН
Задержи дыхание дольше всех!
00:42
Аришнев
Рет қаралды 3,8 МЛН
Получилось у Миланы?😂
00:13
ХАБИБ
Рет қаралды 6 МЛН
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 93 МЛН
How to use  LCD LCD1602  with I2C module for Arduino - Robojax
13:12
ARDUINO: Water Level MEASUREMENT With ULTRASONIC Sensor + LCD Display  @TMEEducation
5:54
Using LCD Displays with Arduino
46:23
DroneBot Workshop
Рет қаралды 1,7 МЛН
Make a TINY Arduino Drone with FPV Camera - Will It Fly?
20:26
Max Imagination
Рет қаралды 770 М.
Waterproof Ultrasonic Distance Sensors - JSN-SR04T & A02YYUW 💧☔
32:11
DroneBot Workshop
Рет қаралды 179 М.
Distance Measurement using Ultrasonic Sensor with LCD/I2C
4:47
Tech Trends Shameer
Рет қаралды 24 М.
Arduino LCD Tutorial | How To Control An LCD
15:14
How To Mechatronics
Рет қаралды 1,3 МЛН
Мой новый мега монитор!🤯
1:00
Корнеич
Рет қаралды 3,6 МЛН
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 7 МЛН
Xiaomi SU-7 Max 2024 - Самый быстрый мобильник
32:11
Клубный сервис
Рет қаралды 555 М.
Лучший браузер!
0:27
Honey Montana
Рет қаралды 1,1 МЛН