0
Your Cart

HC-SR04 Ultrasonic Range Finder Sensor Module is a popular and reliable distance measurement sensor widely used in Arduino, robotics, and embedded system projects. It works by transmitting ultrasonic sound waves and measuring the time taken for the echo to return, allowing accurate distance calculation without physical contact. The sensor offers stable performance with a measuring range of approximately 2 cm to 400 cm, making it suitable for both short- and medium-range applications.

This module is easy to interface with Arduino, ESP32, ESP8266, and other microcontrollers using simple digital I/O pins. Its compact design, low power consumption, and consistent readings make it ideal for beginners, students, and professionals working on DIY electronics and prototyping. HC-SR04 is commonly used in obstacle avoidance robots, smart parking systems, distance meters, water level monitoring, and automation projects.

Whether you are building a college project, testing a prototype, or experimenting with robotics and IoT applications, the HC-SR04 ultrasonic sensor provides a cost-effective and dependable solution for non-contact distance sensing. Perfect for makers, educators, and innovators, it is a must-have component in any electronics lab or DIY toolkit.

Quick Tutorial

Connections (as in the image)

HC-SR04 → Arduino UNO

  • VCC5V
  • GNDGND
  • TRIGD8
  • ECHOD9

(You can change D8/D9, just update in code.)

How it works (simple)

  1. Arduino sends a short pulse from TRIG.
  2. Sensor emits ultrasonic sound.
  3. Sound hits object and returns.
  4. ECHO pin stays HIGH for the time taken.
  5. Arduino calculates distance from time.

Viewing the Output

  1. Upload the code to Arduino.
  2. Open Serial Monitor.
  3. Set baud rate to 9600.
  4. Move your hand in front of the sensor.
  5. Distance will be displayed in centimeters.

 

 

#define TRIG_PIN 8
#define ECHO_PIN 9

void setup() {
Serial.begin(9600);
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
}

void loop() {
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);

digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);

long duration = pulseIn(ECHO_PIN, HIGH);
float distance = duration * 0.034 / 2;

Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");

delay(500);
}


Reviews

There are no reviews yet.

Be the first to review “HC-SR04 Ultrasonic Distance Measurement Sensor Module (2–400 cm) for Arduino”

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