Dear friends welcome to another video. Today we learn how to use this Ultrasonic sensor with Arduino and build this simple distance meter with a Nokia LCD display. Let’s start! In this project we use an Arduino Uno, a Nokia 5110 LCD display and the HC SR04 ultrasonic sensor. As you can see in the display, we see the distance that the sensor measure. If I place my hand close to the sensor, the display shows the distance of my hand from the sensor. If I remove it, it shows the distance from the opposite wall. This ultrasonic sensor is a quite interesting device. There ultrasonic module detects the distance of the closest object in front of the sensor. The maximun distance in which it detects an object is 4 meters. It works by sending out a burst of ultrasound and listening for the echo when it bounces off of an object. The module sends a short pulse through pin Trig to trigger the detection. Then, listens for a pulse in the pin Echo. The duration of the second pulse is equal to the time taken by the ultrasound to travel to the object and back to the sensor. Using the speed of sound this time can be converted to distance. Now let’s see how to build this project, it is very simple! The sensor has only 4 pins to connect. Vcc Trigger, Echo and Ground. Let’s connect first Vcc and Ground. Vcc goes to Arduino 5V. Ground goes to Arduino Ground, Trigger goes to digital pin 7 and Echo goes to digital pin 6. Now let’s connect the Nokia 5110 LCD display. I have now connected the Nokia 5110 LCD display. Please check our previous tutorial on how to connect a Nokia 5110 LCD display in your Arduino project. Now if I power on Arduino, let’s see if it is working, OK it is working fine! As you can see it measures distance and it updates the distance if I move my hand close to it. OK perfect! Now let’s go to the computer and see the software side of the project. I have prepared two
programs for you The first one is really simple. It does not use a Nokia 5110 LCD display in case you don’t have one. It does not need any libraries at all. All it does is to display the distance it measures from the sensor to the serial monitor. Let’s see. OK, that’s the distance in centimeters. It is updated every 50 milliseconds. the second program uses the Nokia 5110 LCD display, so we need a library for the display. Check out the Nokia 5110 LCD display tutorials I have prepared in order to see how to
use to display and how to load graphics on it. The code is very simple. We draw the UI bitmap and then we
measure the distance from the sensor. We convert the value we get to a string and then we display that value. As always you can find the code of the project in the description of the video. That’s todays video. An interesting and very easy build project. The distance sensor will be useful to our future projects as well like the autonomous robot. So stay tuned! Thanks for watching the video please press the like button if you like the project and subscribe to our channel in order to watch our future videos.
thank you very much and see you next week!