Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use HC-SR05: Examples, Pinouts, and Specs

Image of HC-SR05
Cirkit Designer LogoDesign with HC-SR05 in Cirkit Designer

Introduction

The HC-SR05 is an ultrasonic sensor designed for distance measurement. It operates by emitting an ultrasonic wave and measuring the time it takes for the echo to return. This time delay is then used to calculate the distance to an object. The HC-SR05 is widely used in various applications, including robotics, obstacle detection, and distance measurement systems.

Explore Projects Built with HC-SR05

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino Mega 2560 Bluetooth-Controlled Ultrasonic Distance Measurement
Image of circuitcycle: A project utilizing HC-SR05 in a practical application
This circuit features an Arduino Mega 2560 microcontroller interfaced with an HC-05 Bluetooth Module and an HC-SR04 Ultrasonic Sensor. The HC-05 is powered by the Arduino's VIN pin and is grounded to the Arduino's GND, enabling wireless communication capabilities. The HC-SR04 is powered by the Arduino's 5V output and uses two digital PWM pins (D7 for TRIG and D6 for ECHO) to measure distances via ultrasonic waves.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO-Based Ultrasonic Distance Sensor with Bluetooth and LED Indicator
Image of blind sticlk: A project utilizing HC-SR05 in a practical application
This circuit uses an Arduino UNO to interface with an HC-SR04 ultrasonic sensor for distance measurement and an HC-05 Bluetooth module for wireless communication. Additionally, a red LED is controlled via a resistor to indicate status or provide visual feedback.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO Based Ultrasonic Distance Measurement with HC-SR04 and Bluetooth Communication via HC-05
Image of hc sr`: A project utilizing HC-SR05 in a practical application
This circuit features an Arduino UNO microcontroller interfaced with an HC-SR04 Ultrasonic Sensor and an HC-05 Bluetooth module. The Arduino is configured to trigger the ultrasonic sensor to measure distance and communicate the data wirelessly via the HC-05 module. Power is supplied to both the sensor and the Bluetooth module from the Arduino's 5V output, and ground connections are shared among all components.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO-Based Smart Irrigation System with Motion Detection and Bluetooth Connectivity
Image of Copy of wiring TA: A project utilizing HC-SR05 in a practical application
This circuit is a microcontroller-based control and monitoring system. It uses an Arduino UNO to read from a DHT22 temperature and humidity sensor and an HC-SR501 motion sensor, display data on an LCD, and control a water pump and an LED through a relay. The HC-05 Bluetooth module allows for wireless communication.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with HC-SR05

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of circuitcycle: A project utilizing HC-SR05 in a practical application
Arduino Mega 2560 Bluetooth-Controlled Ultrasonic Distance Measurement
This circuit features an Arduino Mega 2560 microcontroller interfaced with an HC-05 Bluetooth Module and an HC-SR04 Ultrasonic Sensor. The HC-05 is powered by the Arduino's VIN pin and is grounded to the Arduino's GND, enabling wireless communication capabilities. The HC-SR04 is powered by the Arduino's 5V output and uses two digital PWM pins (D7 for TRIG and D6 for ECHO) to measure distances via ultrasonic waves.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of blind sticlk: A project utilizing HC-SR05 in a practical application
Arduino UNO-Based Ultrasonic Distance Sensor with Bluetooth and LED Indicator
This circuit uses an Arduino UNO to interface with an HC-SR04 ultrasonic sensor for distance measurement and an HC-05 Bluetooth module for wireless communication. Additionally, a red LED is controlled via a resistor to indicate status or provide visual feedback.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of hc sr`: A project utilizing HC-SR05 in a practical application
Arduino UNO Based Ultrasonic Distance Measurement with HC-SR04 and Bluetooth Communication via HC-05
This circuit features an Arduino UNO microcontroller interfaced with an HC-SR04 Ultrasonic Sensor and an HC-05 Bluetooth module. The Arduino is configured to trigger the ultrasonic sensor to measure distance and communicate the data wirelessly via the HC-05 module. Power is supplied to both the sensor and the Bluetooth module from the Arduino's 5V output, and ground connections are shared among all components.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Copy of wiring TA: A project utilizing HC-SR05 in a practical application
Arduino UNO-Based Smart Irrigation System with Motion Detection and Bluetooth Connectivity
This circuit is a microcontroller-based control and monitoring system. It uses an Arduino UNO to read from a DHT22 temperature and humidity sensor and an HC-SR501 motion sensor, display data on an LCD, and control a water pump and an LED through a relay. The HC-05 Bluetooth module allows for wireless communication.
Cirkit Designer LogoOpen Project in Cirkit Designer

Technical Specifications

Key Technical Details

Parameter Value
Operating Voltage 5V DC
Operating Current 15mA
Frequency 40kHz
Max Range 4 meters
Min Range 2 cm
Measuring Angle 15 degrees
Trigger Input Pulse Width 10µs
Echo Output Pulse Width Proportional to distance

Pin Configuration and Descriptions

Pin Name Description
VCC Power supply (5V)
Trig Trigger input (10µs pulse to initiate measurement)
Echo Echo output (pulse width proportional to distance)
GND Ground

Usage Instructions

How to Use the HC-SR05 in a Circuit

  1. Power the Sensor: Connect the VCC pin to a 5V power supply and the GND pin to ground.
  2. Trigger the Sensor: Send a 10µs pulse to the Trig pin to initiate a measurement.
  3. Read the Echo: Measure the width of the pulse on the Echo pin, which is proportional to the distance to the object.

Important Considerations and Best Practices

  • Stable Power Supply: Ensure a stable 5V power supply to avoid inaccurate measurements.
  • Avoid Obstacles: Ensure there are no obstacles within the sensor's measuring angle that could interfere with the ultrasonic waves.
  • Mounting: Mount the sensor securely to avoid vibrations that could affect the measurements.

Example Code for Arduino UNO

// HC-SR05 Ultrasonic Sensor - Arduino UNO Example Code

const int trigPin = 9; // Trigger pin connected to digital pin 9
const int echoPin = 10; // Echo pin connected to digital pin 10

void setup() {
  Serial.begin(9600); // Initialize serial communication at 9600 baud rate
  pinMode(trigPin, OUTPUT); // Set trigPin as an output
  pinMode(echoPin, INPUT); // Set echoPin as an input
}

void loop() {
  long duration, distance;
  
  // Clear the trigPin by setting it LOW
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  
  // Set the trigPin HIGH for 10 microseconds to send out the pulse
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  
  // Read the echoPin, which returns the duration of the pulse
  duration = pulseIn(echoPin, HIGH);
  
  // Calculate the distance (duration / 2) * speed of sound (34300 cm/s)
  distance = (duration / 2) * 0.0343;
  
  // Print the distance to the Serial Monitor
  Serial.print("Distance: ");
  Serial.print(distance);
  Serial.println(" cm");
  
  delay(500); // Wait for 500 milliseconds before the next measurement
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output or Incorrect Readings:

    • Check Connections: Ensure all connections are secure and correct.
    • Power Supply: Verify that the sensor is receiving a stable 5V power supply.
    • Trigger Pulse: Ensure the trigger pulse is 10µs.
  2. Inconsistent Measurements:

    • Interference: Ensure there are no obstacles or reflective surfaces within the sensor's measuring angle.
    • Mounting: Ensure the sensor is mounted securely to avoid vibrations.

FAQs

Q: What is the maximum range of the HC-SR05? A: The maximum range is 4 meters.

Q: What is the minimum range of the HC-SR05? A: The minimum range is 2 cm.

Q: Can the HC-SR05 be used outdoors? A: While it can be used outdoors, it is recommended to protect it from direct exposure to harsh weather conditions.

Q: How accurate is the HC-SR05? A: The HC-SR05 has an accuracy of approximately 3mm.

By following this documentation, users can effectively integrate the HC-SR05 ultrasonic sensor into their projects, ensuring accurate and reliable distance measurements.