0% found this document useful (0 votes)
2 views3 pages

Ultrasonic Sensor Module

The HC-SR04 Ultrasonic Ranging Sensor is a non-contact distance measurement module with a range of 2cm to 500cm and a resolution of 1cm, powered by 5V DC. It features a trigger and echo pin for initiating measurements and receiving distance data, making it suitable for applications like robotic obstacle avoidance. The document also includes example code for setting up and using the sensor in a project.

Uploaded by

pacho_1
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Ultrasonic Sensor Module

The HC-SR04 Ultrasonic Ranging Sensor is a non-contact distance measurement module with a range of 2cm to 500cm and a resolution of 1cm, powered by 5V DC. It features a trigger and echo pin for initiating measurements and receiving distance data, making it suitable for applications like robotic obstacle avoidance. The document also includes example code for setting up and using the sensor in a project.

Uploaded by

pacho_1
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Ultrasonic Sensor Module

DESCRIPTION:
This HC-SR04 Ultrasonic Ranging Sensor is a non-contact distance measurement
module with stable performance and high ranging accuracy. With the inexpensive
price, The measurment range if it can be upto 5M, which would be helpful for your
project such as robotic Obstacle Avoidance and so on.

Specification:
● Power supply: 5V DC.
● Effectual angle: <15°.
● Ranging distance: 2cm – 500 cm.
● Resolution: 1 cm.
● Ultrasonic Frequency: 40k Hz.

PIN CONFIGURATION:
● VCC: The VCC pin powers the sensor,typically with +5V
● Trigger: Trigger pin is an Input pin. This pin has to be kept high for 10us to initialize
measurement by sending US wave.
● Echo: Echo pin is an Output pin. This pin goes high for a period of time which will
be equal to the time taken for the US wave to return back to the sensor.
● Ground: This pin is connected to the Ground of the system.

1/3
Example:

Code:
#define TRIGGER 12
#define ECHO 11

void setup()
{
2/3
pinMode(ECHO, INPUT);
pinMode(TRIGGER, OUTPUT);
digitalWrite(TRIGGER, LOW);
[Link](9600);
}
void loop()
{
long distance, duration;
digitalWrite(TRIGGER, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGGER, LOW);
duration = pulseIn(ECHO,HIGH);
distance = duration / 2 / 7.6;
[Link](distance);
}

3/3

You might also like