Hc Sr04 Wiring Diagram

By | January 24, 2023

HC-SR04 Wiring Diagram

The HC-SR04 ultrasonic distance sensor is a popular and affordable sensor that can be used to measure the distance to an object. It is a great choice for robotics projects, home automation, and other applications where you need to know how far away something is. The HC-SR04 sensor has four pins: VCC, Trig, Echo, and GND. VCC should be connected to a 5V power supply. Trig is the trigger pin, which sends a high pulse to the sensor to start a measurement. Echo is the echo pin, which returns a high pulse when the sensor has received a reflected ultrasonic wave. GND should be connected to ground. The following diagram shows the wiring for the HC-SR04 sensor:

pins arduino

Note:

The diagram shows the wiring for the HC-SR04 sensor to an Arduino Uno. The wiring for other Arduino boards may be different. ## How to Use the HC-SR04 Sensor To use the HC-SR04 sensor, you will need to install the following libraries: * [Arduino IDE Library Manager](https://www.arduino.cc/en/software/libraries/) * [HC-SR04](https://github.com/adafruit/Adafruit_HC-SR04) Once the libraries are installed, you can start using the sensor in your sketches. The following code shows how to read the distance from the sensor: ``` #include const int trigPin = 13; const int echoPin = 12; HC_SR04 sensor(trigPin, echoPin); void setup() { Serial.begin(9600); } void loop() { // Get the distance from the sensor in centimeters. float distance = sensor.readDistance(); // Print the distance to the serial port. Serial.println(distance); delay(500); } ``` ## Example Projects The HC-SR04 sensor can be used in a variety of projects, including: *

Obstacle avoidance:

The sensor can be used to detect obstacles in front of a robot, helping the robot to avoid them. *

Home automation:

The sensor can be used to turn on lights when someone enters a room, or to close a door when someone leaves. *

Security systems:

The sensor can be used to detect intruders in a home or business. ## Conclusion The HC-SR04 ultrasonic distance sensor is a versatile and affordable sensor that can be used in a variety of projects. It is easy to use and can be integrated with a variety of microcontrollers. If you are looking for a sensor to measure distance, the HC-SR04 is a great option.


Arduino Ultrasonic Sensor Tutorial

Arduino Ultrasonic Sensor Tutorial


Hc Sr04 Ultrasonic Sensor Working Pinout Features Datasheet

Hc Sr04 Ultrasonic Sensor Working Pinout Features Datasheet


Esp32 Micropython Interfacing Ultrasonic Sensor Hc Sr04

Esp32 Micropython Interfacing Ultrasonic Sensor Hc Sr04


Comp50 Wd

Comp50 Wd


Hc Sr04 David Pilling

Hc Sr04 David Pilling


Hc Sr04 Stodev Com Br Tasmota Wiki

Hc Sr04 Stodev Com Br Tasmota Wiki


Arduino Programming The Hc Sr04 Project Circuit Diagram

Arduino Programming The Hc Sr04 Project Circuit Diagram


Interfacing Ultrasonic Sensor With Arduino Code Electroduino

Interfacing Ultrasonic Sensor With Arduino Code Electroduino


Ultrasonic Sensor Hc Sr04 Raspberry Pi

Ultrasonic Sensor Hc Sr04 Raspberry Pi


How Hc Sr04 Ultrasonic Sensor Works To Interface It With Arduino

How Hc Sr04 Ultrasonic Sensor Works To Interface It With Arduino


Ultrasonic Hc Sr04 Search Easyeda

Ultrasonic Hc Sr04 Search Easyeda


An Ultrasonic Shortcut

An Ultrasonic Shortcut


Hc Sr04 Ultrasonic Sensor Arduino Wiring Diagram Maxphi

Hc Sr04 Ultrasonic Sensor Arduino Wiring Diagram Maxphi


Hc Sr04 Ultrasonic Sensor

Hc Sr04 Ultrasonic Sensor


Ultrasonic Hc Sr04 Returns Zero Distance Range Question Mbed

Ultrasonic Hc Sr04 Returns Zero Distance Range Question Mbed


Distance Meter Using Pic12f1822 And Hc Sr04 Sensor Ccs C

Distance Meter Using Pic12f1822 And Hc Sr04 Sensor Ccs C


Schematic Diagram Of Arduino Uno Board Connected With Hc Sr04 And Lm35 Scientific

Schematic Diagram Of Arduino Uno Board Connected With Hc Sr04 And Lm35 Scientific


Stm32 Ultrasonic Sensor Hc Sr04 Library With Timer Input Capture

Stm32 Ultrasonic Sensor Hc Sr04 Library With Timer Input Capture


Tut C Soft Hard Using The Hc Sr04 Ultrasonic Distance Sensor Avr Freaks

Tut C Soft Hard Using The Hc Sr04 Ultrasonic Distance Sensor Avr Freaks


Hc Sr04 Mbed

Hc Sr04 Mbed



Leave a Reply

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