Ultrasonic Sensor HC-SR04 with Arduino Uno

ultrasonic sensor
Share this blog with others!
  • 8
    Shares

Hello everyone, welcome to my new blog, In this blog, we are discussing the ultrasonic sensor.

This sensor is used widely in the home-based projects and also in industries.

ultrasonic sensor
  • Vcc- Connect to 5V of positive voltage for power
  • Trig- A pulse is sent from it for ranging more for object detection
  • Echo-check the object has been detected or not. If the signal comes back means the object has been detected, if not object has not been detected.
  • GND- It means Ground terminal, It completes the pathway of the power.

ULTRASONIC SENSOR

This ultrasonic distance sensor provides steady and exact measurements of the distance between 2 cm and 450 cm. It has less than 15 degrees of focus and a range of almost 2 mm.

Ultrasonic sound waves have an extraordinarily high pitch that can not be detected by humans 

 This particular sensor transmits an ultrasonic sound that is around 40 kHz in frequency. The sensor has two main components-a transducers that generate an ultrasonic sound wave, while its echo is listened to by the other portion

Ultrasonic distance measurement principle :

An ultrasonic wave was generated in one direction by the ultrasonic transmitter and the timing began when it was launched. Ultrasound
Stretched in the air, and would automatically return when obstacles on the way were encountered.Finally, once it got the reflected wave, the ultrasonic receiver will pause the timing.

Since the ultrasonic spread velocity in the air is 340 m / s, we can calculate the distance (s) between the obstacle and the transmitter, based on the timer record t, namely: s = 340 t / 2, which is called the theory of time difference distance measurement.

using the already known air spreading velocity, the ultrasonic distance measurement concept estimated the time from start to reflection when the obstacle was encountered, and then determined the distance between the transmitter and the obstacle according to the time and velocity.

Thus, with radar, the concept of ultrasonic distance measurement is the same. The formula for measuring distance is expressed as: L = C X T In the formula, L is the measured distance, and C is the velocity of ultrasonic spreading in air, also, T is time (T is half the time value from transmission to receiver.

#include <NewPing.h> 
#define TRIGGER_PIN 12 
#define ECHO_PIN 11 
#define MAX_DISTANCE 300 
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); 
void setup() 
{ 
Serial.begin(115200);
 } 
void loop()
 { 
delay(50);
 int uS = sonar.ping();
 Serial.print("Ping: ");
 Serial.print(uS / US_ROUNDTRIP_CM);
 Serial.println("cm");
}

Click here https://www.tinkercad.com/things/9V3Rto9qjf3 for the simulation of the Ultrasonic sensor with Arduino Uno.


Share this blog with others!
  • 8
    Shares

Leave a Comment

Your email address will not be published. Required fields are marked *