top of page

The HC-SR04 Ultrasonic Sensor is a widely used sensor for distance measurement. It works by sending ultrasonic sound waves and measuring the time taken for the echo to return after reflecting off an object.

 

 Specifications

  • Operating Voltage: 5V DC
  • Operating Current: 15 mA
  • Frequency: 40 kHz
  • Range: 2 cm to 400 cm
  • Accuracy: ±3 mm
  • Trigger Pin: Input (to initiate measurement)
  • Echo Pin: Output (pulse width proportional to distance)

 

Working Principle

  • The sensor sends an 8-cycle ultrasonic burst (triggered by a 10 µs pulse on the TRIG pin).
  • The sound wave travels, reflects off an object, and returns to the sensor.
  • The ECHO pin goes HIGH for the duration it takes for the wave to return.

 

Pin Configuration

Pin

Function

VCC

+5V Supply

GND

Ground

TRIG

Trigger Input

ECHO

Echo Output

 

 

Arduino Connection

 

  • VCC → 5V
  • GND → GND
  • TRIG → Digital Pin 9
  • ECHO → Digital Pin 10

 

Arduino Code Example

#define TRIG_PIN 9

#define ECHO_PIN 10

void setup() {

  Serial.begin(9600);

  pinMode(TRIG_PIN, OUTPUT);

  pinMode(ECHO_PIN, INPUT);

}

void loop() {

  long duration;

  float distance;

  // Send 10µs pulse to TRIG

  digitalWrite(TRIG_PIN, LOW);

  delayMicroseconds(2);

  digitalWrite(TRIG_PIN, HIGH);

  delayMicroseconds(10);

  digitalWrite(TRIG_PIN, LOW);

  // Read echo time

  duration = pulseIn(ECHO_PIN, HIGH);

  // Calculate distance in cm

  distance = (duration * 0.0343) / 2;

  Serial.print("Distance: ");

  Serial.print(distance);

  Serial.println(" cm");

  delay(500);

}

 

Applications

 

  • Automatic door opening
  • Obstacle avoidance in robots
  • Parking assistance
  • Liquid level measurement

 

Package includes: 1x HC-SR04 Ultrasonic Sensor

 

Ultrasonic Module Sensor - HC-SR04

SKU: SEN983
R₣3,800Price
Quantity
    No Reviews YetShare your thoughts. Be the first to leave a review.
    bottom of page