ELEGOO EL-SM-001

Download PDF
Contents

ELEGOO HC-SR04 Ultrasonic Module Distance Sensor Instruction Manual

Model: EL-SM-001

1. Introduction and Overview

The ELEGOO HC-SR04 Ultrasonic Module is a device designed for non-contact distance measurement. It operates by emitting ultrasonic sound waves and measuring the time it takes for the echo to return, thereby calculating the distance to an object. This module is suitable for various applications requiring distance sensing, such as obstacle avoidance in robotics and level sensing.

This manual provides detailed instructions for the setup, operation, and maintenance of your HC-SR04 Ultrasonic Module.

Five ELEGOO HC-SR04 ultrasonic sensors and two sets of multi-colored jumper wires.
Image 1.1: A set of five HC-SR04 Ultrasonic Modules with connecting wires.

2. Product Features

  • Non-contact distance measurement using ultrasonic technology.
  • Integrated ultrasonic transmitter, receiver, and control circuit.
  • Measures distances from 3 cm to 450 cm.
  • High ranging accuracy of up to 3 mm.
  • Low quiescent current consumption (less than 2mA).
  • Wide effectual angle of less than 15 degrees.
  • Compatible with various microcontrollers like Arduino UNO, MEGA, and Nano.

3. Package Contents

Each package contains the following items:

  • 5 x ELEGOO HC-SR04 Ultrasonic Modules
  • Connecting jumper wires (quantity may vary, typically enough for basic connections)
Five ELEGOO HC-SR04 ultrasonic sensors and two sets of multi-colored jumper wires, laid out on a white surface.
Image 3.1: Contents of the HC-SR04 Ultrasonic Module package.

4. Safety Information

Warning:

  • Keep this product away from children under 3 years old due to small parts.
  • Ensure proper voltage supply (5V DC) to prevent damage to the module or connected devices.
  • Handle with care to avoid electrostatic discharge, which can harm electronic components.

5. Setup

The HC-SR04 module has four pins: VCC, Trig, Echo, and GND. Follow these steps for basic connection to a microcontroller (e.g., Arduino):

  1. Connect VCC: Connect the VCC pin of the HC-SR04 module to the 5V output pin of your microcontroller.
  2. Connect GND: Connect the GND pin of the HC-SR04 module to the GND pin of your microcontroller.
  3. Connect Trig: Connect the Trig (Trigger) pin of the HC-SR04 module to a digital output pin on your microcontroller (e.g., Arduino Pin 9). This pin sends the ultrasonic pulse.
  4. Connect Echo: Connect the Echo pin of the HC-SR04 module to a digital input pin on your microcontroller (e.g., Arduino Pin 10). This pin receives the reflected ultrasonic pulse.

Note: If connecting to a 3.3V microcontroller (like Raspberry Pi), a voltage divider circuit is required for the Echo pin to prevent damage, as the HC-SR04's Echo pin outputs 5V.

An ELEGOO HC-SR04 ultrasonic sensor connected to a breadboard with jumper wires, with an Arduino board visible in the background.
Image 5.1: HC-SR04 module connected to a breadboard for prototyping.

6. Operating Principles

The HC-SR04 module operates on the principle of sonar. Here's how it works:

  1. The microcontroller sends a short pulse (e.g., 10 microseconds) to the Trig pin.
  2. This pulse causes the ultrasonic transmitter to emit a burst of 8 cycles of 40 kHz ultrasonic sound waves.
  3. These sound waves travel through the air. If they encounter an object, they reflect off its surface.
  4. The reflected sound waves (echo) are detected by the ultrasonic receiver.
  5. The Echo pin goes HIGH for the duration that the sound waves travel from the transmitter, reflect off the object, and return to the receiver.
  6. The microcontroller measures the duration of this HIGH pulse on the Echo pin.
  7. The distance is calculated using the formula:
    Distance = (Time of Flight * Speed of Sound) / 2
    (Divided by 2 because the sound travels to the object and back).
Diagram illustrating the operation of an ultrasonic sensor, showing sound waves emitted from a transmitter, reflecting off an object, and returning to a receiver.
Image 6.1: Illustration of ultrasonic distance measurement principle.

7. Operation

To operate the HC-SR04 module, you will need to write code for your microcontroller. Below is a conceptual example for Arduino:

7.1. Arduino Code Example (Conceptual)


// Define pins
const int trigPin = 9;
const int echoPin = 10;

void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  Serial.begin(9600); // Initialize serial communication
}

void loop() {
  // Clear the trigPin by setting it LOW for 2 microseconds
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);

  // Set the trigPin HIGH for 10 microseconds to send a pulse
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  // Measure the duration of the pulse on the echoPin
  long duration = pulseIn(echoPin, HIGH);

  // Calculate the distance (speed of sound in air is approximately 343 meters/second or 0.0343 cm/microsecond)
  // Distance = (duration * 0.0343) / 2; // in cm
  // Or, more commonly, duration / 58 for cm, or duration / 148 for inches
  float distanceCm = duration / 58.0;

  // Print the distance to the Serial Monitor
  Serial.print("Distance: ");
  Serial.print(distanceCm);
  Serial.println(" cm");

  delay(1000); // Wait for 1 second before the next measurement
}

Upload this code to your Arduino board. Open the Serial Monitor in the Arduino IDE to view the distance readings.

7.2. Applications

The HC-SR04 module is versatile and can be used in:

  • Robotics for obstacle detection and navigation.
  • Automated systems for level sensing (e.g., water tank levels).
  • Security systems for proximity sensing.
  • Interactive art installations.
An ELEGOO HC-SR04 ultrasonic sensor mounted on the front of a small robot chassis, indicating its use in robotic applications.
Image 7.1: HC-SR04 module integrated into a robotic platform.

8. Maintenance

The HC-SR04 Ultrasonic Module requires minimal maintenance. Follow these guidelines to ensure its longevity and accurate performance:

  • Keep Clean: Ensure the ultrasonic transducers (the two "eyes" on the module) are free from dust, dirt, or moisture. Use a soft, dry cloth to gently clean them if necessary.
  • Avoid Physical Damage: Protect the module from impacts or excessive force, which can damage the transducers or the circuit board.
  • Proper Storage: When not in use, store the modules in an anti-static bag in a dry environment to prevent electrostatic discharge and moisture damage.
  • Stable Power Supply: Always provide a stable 5V DC power supply. Fluctuations can affect performance or damage the module.

9. Troubleshooting

ProblemPossible CauseSolution
No readings or erratic readings
  • Incorrect wiring (VCC, GND, Trig, Echo).
  • Obstruction on transducers.
  • Code error (e.g., incorrect pin definitions, timing issues).
  • Object too close (less than 3cm) or too far (more than 450cm).
  • Echo pin connected directly to 3.3V logic without voltage divider.
  • Double-check all connections according to Section 5.
  • Clean the transducers.
  • Review your code for logical errors and correct pin assignments.
  • Ensure the object is within the 3cm-450cm range.
  • Use a voltage divider for 3.3V microcontrollers.
Module not powering on
  • No power supply or incorrect voltage.
  • Faulty VCC or GND connection.
  • Verify 5V DC power supply.
  • Check continuity of VCC and GND wires.
Inaccurate distance readings
  • Environmental factors (temperature, humidity, air currents).
  • Soft, sound-absorbing objects.
  • Narrow beam angle causing reflections from unintended surfaces.
  • Consider environmental compensation in code if precision is critical.
  • Test with hard, flat surfaces.
  • Adjust module position or add physical barriers to focus the beam.
  • Implement averaging of multiple readings in your code.

10. Specifications

ParameterValue
Model NumberEL-SM-001
Operating Voltage5V DC
Quiescent CurrentLess than 2mA
Effectual AngleLess than 15°
Ranging Distance3cm - 450cm
Resolution0.3 cm
Product Dimensions0.59 x 1.77 x 1.18 inches (approx. 1.5 x 4.5 x 3 cm)
Weight0.32 ounces (approx. 9 grams)
Packaging for the ELEGOO HC-SR04 Ultrasonic Sensor, displaying technical specifications such as power supply, quiescent current, effectual angle, ranging distance, and resolution.
Image 10.1: Technical specifications as printed on product packaging.

11. Warranty and Support

For warranty information and technical support, please refer to the official ELEGOO website or contact their customer service directly. Details are typically provided with the product packaging or on the manufacturer's website.

Manufacturer: ELEGOO

For further assistance, visit: www.elegoo.com

© 2025 ELEGOO. All rights reserved.

This manual is for informational purposes only. ELEGOO reserves the right to make changes to product specifications without prior notice.

Ask a question about this manual

Ask about setup, troubleshooting, compatibility, parts, safety, or missing instructions. Manuals+ will review the question and use this page’s manual context to help answer it.

After a successful submission, we securely hash the supplied account or form email before sending it to Microsoft Advertising for conversion attribution. Privacy details.