SR 04 Ultrasonic 1
SR 04 Ultrasonic 1
User Guide
SKU: SSR1012
Brief Data:
1 www.handsontec.com
HC-SR04 Ultrasonic Sensor Module
2 www.handsontec.com
Table of Contents
3 www.handsontec.com
1.0 Introduction:
Ultrasonic is an excellent way of figuring outwhat’s in the immediate vicinity of your Arduino.The basics of
using ultrasound are likethis: you shoot out a sound, wait to hear itecho back, and if you have your timing
right,you’ll know if anything is out there and howfar away it is. This is called echolocation and it’show bats
and dolphins find objects in the darkand underwater, though they use lower frequencies thanyou can use
with your Arduino.Figure-1 show the working principal of ultrasonic ranging concept.
Figure-1
HC-SR04 Ultrasonic Sensor is a very affordable proximity/distance sensor that has been used mainly for
object avoidance in various robotics projects. It has also been used in turret applications, water level
sensing, and even as a parking sensor.
This module is the second generation of the popular HC-SR04 Low Cost Ultrasonic Sensor. Unlike the first
generation HC-SR04 that can only operate between 4.8V~5V DC, this new version has wider input voltage
range, allow it to work with controller operates on 3.3V.HC-SR04 ultrasonic sensor provides a very low-cost
and easy method of distance measurement. It measures distance using sonar, an ultrasonic (well above
human hearing) pulse (~40KHz) is transmitted from the unit and distance-to-target is determined by
measuring the time required for the echo return. This sensor offers excellent range accuracy and stable
readings in an easy-to-use package. An on board 2.54mm pitch pin header allows the sensor to be plugged
into a solderless breadboard for easy prototyping.
4 www.handsontec.com
2.1: Sensor Element Construction
Piezoelectric crystals are used for sensor elements. Piezoelectric crystals will oscillate at high frequencies
when electric energy is applied to it. The Piezoelectric crystals will generate electrical signal when
ultrasound wave hit the sensor surface in reverse.
Figure-2.
Figure-3.
5 www.handsontec.com
4.0: Pins Assignment and Dimension
VCC 3.3v ~ 5V
TRIG Triggering Input Pin. 10uS TTL Pulses
ECHO TTL Logic Output Pin. Proportional to distance
GND Ground Pin
6 www.handsontec.com
Figure-4: Timing Diagram
Please make sure the surface of object to be detected should have at least 0.5m2areafor better
performance.
7 www.handsontec.com
4.4 Arduino Application Examples
Upload the below sketch to Arduino Board. Open up the Serial monitor and place some
object in front of the sensor module and observe the distance displayed.
/*==========================================================================
// Author : Handson Technology
// Project : HC-SR04 Ultrasonic Sensor with Arduino Uno
// Description : HC-SR04 Distance Measure with Arduino and display
// on Serial Monitor.
// Source-Code : HC-SR04.ino
//==========================================================================
*/
int trig=11;
int echo=12;
int duration;
float distance;
float meter;
void setup()
{
Serial.begin(9600);
pinMode(trig, OUTPUT);
8 www.handsontec.com
digitalWrite(trig, LOW);
delayMicroseconds(2);
pinMode(echo, INPUT);
delay(6000);
Serial.println("Distance:");
}
void loop()
{
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
if(duration>=38000){
Serial.print("Out range");
}
else{
distance = duration/58;
Serial.print(distance);
Serial.print("cm");
meter=distance/100;
Serial.print("\t");
Serial.print(meter);
Serial.println("m");
}
delay(1000);
}
9 www.handsontec.com
5.0:HandsOn Technology Products Quality Commitments
HandsOn Technology wish to be perceived as simple and affordable by our customers. However the joy
over a low price is never greater than the disappointment over poor quality products. All our parts are
original genuine parts with proper data specifications from manufacturers. This is to ensure you always get
the high quality genuine original part as stated in our products information.
5.1 WARRANTY
10 www.handsontec.com
Handsontec. com
11 www.handsontec.com
The Face behind our product quality…
In a world of constant change and continuous technological development, a new or replacement
product is never far away – and they all need to be tested.
Many vendors simply import and sell wihtout checks and this cannot be the ultimate interests of
anyone, particularly the customer. Every part sell on Handsotec is fully tested. So when buying from
Handsontec products range, you can be confident you’re getting outstanding quality and value.
We keep adding the new parts so that you can get rolling on your next project.
P
Engineering Material Mechanical Hardware Electronics Components
12 www.handsontec.com