Product | Sensors | Ultrasonic Sensor | Ultrasonic Range Detection Sensor
Ultrasonic Range Detection Sensor
Ultrasonic Range Detection Sensor
More than 200
US$12.98 Loading ...


Arduino Ultrasonic Range Detection Sensor

If you are sourcing a ultrasonic ranging module , the HC-SR04 is good choose . Its stable performance and high ranging accuracy  make it a popular module in electronic market .

Compared to the Shap IR ranging module , HC-SR04 is more inexpensive than it . But it has the same ranging accuracy and longer ranging distance.

1、 Specification

Working Voltage : 5V(DC)
Working Current : max 15mA
Working frequency : 40HZ
Output Signal : 0-5V (Output high when obstacle in range)
Sentry Angle : max 15 degree
Sentry Distance : 2cm - 450cm
high-accuracy : 0.3cm
Input trigger signal : 10us TTL impulse
Echo signal : output TTL PWL signal
Size : 45*20*15mm

Note : This module is not suitable to connect with electric power, if you need to connect this module with electronic power,then let the GND terminal of this module to be connected first,otherwise, it will affect the normal work of the module



Pin Defination:

 1:VCC ; 2:trig(T);3:echo(R); 4:GND


Supply module with 5V, the output will be 5V while obstacle in range, or 0V if not.

The out pin of this module is used as a switching output when anti-theft module, and without the feet when ranging modules,

Note : the module should be inserted in the circuit before been power, which avoid producing high level of misoperation ;if not, then power again.

Module Working Principle:

(1) Adopt IO trigger through supplying at least 10us sequence of high level signal,

(2) The module automatically send eight 40khz square wave and automatically detect whether receive the returning pulse signal,

(3) If there is signals returning, through outputting high level

    and the time of high level continuing is the time of that from the ultrasonic transmitting to

Test distance = (high level time * sound velocity (340M/S) / 2,


Simple,easy to adopt in system;Beam angle to avoid disruptions;Endurable.


Test Program Code  :

int pingPin = 13;
int inPin = 12;

long microseconds;

void setup() {

void loop() {

long duration, inches, cm;

digitalWrite(pingPin, LOW);
digitalWrite(pingPin, HIGH);
digitalWrite(pingPin, LOW);
pinMode(pingPin, OUTPUT);

pinMode(inPin, INPUT); duration = pulseIn(inPin, HIGH);

inches = microsecondsToInches(duration); cm = microsecondsToCentimeters(duration);

  Serial.print("in, ");
 delay(100); }

long microsecondsToInches(long microseconds) {
return microseconds / 74 / 2; }

long microsecondsToCentimeters(long microseconds) { return microseconds / 29 / 2;




Write a review
*Review title
Please enter subject.
*Your review
Please enter review.
(Click star icon to comment)
Display name
*Enter security code


Please enter code
Loading ...