In this project, we will use the Arduino UNO board to drive HC-SR04 ultra Sound Distance Sensor and read distance in Arduino’s serial monitor.


1 pc Osoyoo UNO Board uno-o
1 pc HC-SR04 ultra Sound Distance Sensor ultrasound-o.png
1 pc breadboard BREADBOARD

Circuit Graph:


download code and copy/paste the code onto the Arduino IDE, then run the code.

Open the serial window on the upper right hand corner of the Arduino IDE, you will see result as below:


The number displayed on the monitor is directly proportional to the distance an object is away from the sensor. A small LED on the Arduino will light up if your hand is more than 50cm away from the sensor.