Sensors

Ultrasonic Sensor (HC-SR04)

ultrasonic sensor interfacing with arduino

Introduction

In This Article, we will discuss the HC-SR04 Ultrasonic Sensor the ultrasonic sensor is measuring the distance with respect to time. we will interface the ultrasonic sensor with Arduino and the value will display in the serial monitor as well as 16×2 LCD display.

Screenshot 2023 06 23 at 9.24.10 AM

Pins HC-SR04 Ultrasonic Sensor

1. VCC: +5v DC
2. Trig:  (INPUT)
3. Echo: (OUTPUT)
4. GND: GND

 

Principle of Operation

The HC-SR04 sensor works based on the principle of sound waves with frequencies higher than the audible range of humans and measures the time it takes for the waves to bounce back after hitting an object.

The sound wave travels at a speed of 340 m/s (0.034 cm/s).

we used the following equation to calculate the distance:- S = v * t

HC-SR04 ultrasonic sensor module consists of the following main components

  • Transmitter: the 40kHz frequency used to operate and transmit emits ultrasonic pulses.
  • Receiver: The receiver detects the echoes of the ultrasonic waves that bounce back after hitting an object.
  • Control Circuit: the control circuit finds out the travel distance in time with the help of ultrasonic pulses and the reception of the echo signal.
  • Trigger and Echo Pins: Trigger input is generated by the ultrasonic wave and just hit the surface and goes back to the receiver the echo is receive the ultrasonic wave and finds the total distance of the objects.

circuit diagram 16 e1686734637869

Measurement Range and Accuracy

They measure the distance of the trigger and echo based on the generated signal and they find out the total distance and the distance range is 2cm to 400cm.

the accuracy of the measurements depends on the factors of environmental conditions. and they also depend on the quality of the sensor.

To find out the distance use the formula Distance = (Time x SpeedOfSound) / 2.

Specifications of the HC-SR04 Sensor

  • Operating Voltage: 3.3V and 5V.
  • Operating Current: 15mA.
  • Measurement Range: 2 cm to 400 cm (or 1 inch to 13 feet).
  • Accuracy:  Few millimetres
  • Sensing Angle:  Approximately 15 degrees. May not detect objects outside of this angle.
  • Trigger Pulse Width: Minimum width of 10 microseconds.
  • Echo Pulse Output: Ultrasonic pulse is transmitted and remains high until the echo is received.
  • Communication Interface: Digital input/output pins to interface with microcontrollers or single-board computers. trigger is input and echo is output.
  • Dimensions: Measures around 45 mm x 20 mm x 15 mm (length x width x height).

Advantages of HC-SR04 Sensor

  • Non-Contact Measurement
  • Wide Measurement Range
  • High Accuracy
  • Fast Response Time
  • Easy to Use and Interface
  • Low Power Consumption
  • Affordable and Widely Available

Disadvantage of HC-SR04 Sensor

  • Limited Angular Sensing
  • Sensitivity to Environmental Factors
  • Limited Resolution and Accuracy
  • Blind Zone and Minimum Detection Range

Application of HC-SR04 Sensor

  • Robotics
  • Automation
  • Parking Assistance
  • Liquid Level Monitoring
  • Security Systems

Example With Arduino

Circuit Diagram

Circuit

Code

Circuit Diagram With 16×2 LCD Display

Circuit Diagram 31 e1687070118505

Code with 16×2 LCD Display

Code with OLED Display

 

Application

Ultrasonic Sensor as a Counter with Arduino

Circuit diagram 9 e1687496664912

Video

 

Related Projects

Prateek

Hi, Prateek Here I’m interested in Electronics That's why I Make Soo Many Projects, I’m currently Pursuing M Tech.. if you Relay Like To My Blog Plz Comment Below...Thanks To All Electronics Lover...❤️

Leave a Reply

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

Back to top button