


* Arduino Distance Measurement using Ultrasonic Sensor Note :- In Arduino Uno SCL pin is A5 and the SDA pin is A4. Ultrasonic ground pin and LCD ground pin are connected to Arduino ground pin via a breadboard. Ultrasonic VCC pin and LCD VCC pin are connected to Arduino 5v pin via a breadboard. LCD SCL and SDA pins are connected to Arduino SCL and SDA pins respectively. In the above circuit diagram, you can clearly see that the Ultrasonic echo pin and trigger pin are directly connected to Arduino pin no 8 and 9 respectively. Here we are using an HC-SR04 Ultrasonic Sensor module, an LCD I2C display to Show the distance, and Arduino Uno for controlling the sensor and LCD display. When it receives an echo signal it automatically computes the time-span between emitting the signal and receiving the echo itself. An ultrasonic sensor automatically sends 8 cycles of 40 kHz ultrasound signal and checks for its echo. In order to generate the trigger pulse, you need to set the Trigger pin on a High State for 10 µs. The trigger pin is for creating a trigger pulse and the Echo pin is for receiving an echo pulse. VCC and ground pins are for the power supply. When it receives an echo signal it automatically computes the time-span between emitting the signal and receiving the echo itself.Īs we can see in the picture there are four pins – Ground, VCC, Trigger, and Echo. The trigger pin is for creating trigger pulse and the Echo pin is for receiving echo pulse. It computes the time-span between emitting the signal and receiving the echo itself.Īnd as we know the speed of the sound wave we can easily calculate the distance between the sensor and object.Īs we can see in the picture there are four pins – Ground, VCC, Trigger, and Echo. If they strike an object, then they’re reflected back as echo signals to the sensor. These propagate within the air at the velocity of sound. Ultrasonic sensors emit short, high-frequency pulses at regular intervals. Each HC-SR04 module includes an ultrasonic transmitter, a receiver, and a control circuit. This sensor can provide 2cm to 400cm of non-contact measurement functionality with an accuracy of up to 3mm. In this project, we are using an ultrasonic sensor to measure the distance of an object from the sensor and an LCD display to see the distance. Arduino Distance Measurement using Ultrasonic Sensor.

By calculating the traveling time of trigger pulse and echo pulse we can easily calculate the distance between object and sensor. As the speed of the sound is already known to us, we can easily calculate the distance. It has a transmitter/trigger to generate a sound pulse and a receiver to receive an echo pulse coming from the targeted object. Ultrasonic sensors are based on measuring the properties of sound waves. You can see the value displayed on the LCD changes accordingly it indicates the distance between the board and the ultrasonic sensor.Ultrasonic is a great sensor when it comes to measuring a distance of an object. Quiescent Current : #include LiquidCrystal_I2C lcd ( 0x27, 16, 2 ) #define echoPin 8 #define trigPin 7 void setup ( ) Running ResultĪ few seconds after the upload finishes, move a board close to the sensor or remove it farther.Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1.

Ultrasonic sensor arduino 4 pin how to#
In this lesson we will show you how the HC-SR04 Ultrasonic Sensor works and how to use it with the Osoyoo Uno board. One opening transmits ultrasonic waves, the other receives them. The Ultrasonic Sensor sends out a high-frequency sound pulse and then times how long it takes for the echo of the sound to reflect back. Display the Distance from the HC-SR04 Ultrasonic Sensor on an I2C LCD.
Ultrasonic sensor arduino 4 pin serial#
Using the Ultrasonic Sensor HC-SR04 Read Distance from the Serial Monitor.
