Product |
Brick
|
Sensor Brick
| Ultrasonic Range Detection Sensor
Ultrasonic Range Detection Sensor
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
2、Interface:
Pin Defination:
1:VCC ; 2:trig(T);3:echo(R); 4:GND
3、Usage:
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 out4、Advantage:
Simple,easy to adopt in system;Beam angle to avoid disruptions;Endurable.


4、Advantage:
Simple,easy to adopt in system;Beam angle to avoid disruptions;Endurable.
.jpg)
Test Program Code :
int pingPin = 13;
int inPin = 12;
long microseconds;
void setup() {
Serial.begin(9600);
}
void loop() {
long duration, inches, cm;
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(10);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
pinMode(pingPin, OUTPUT);
pinMode(inPin, INPUT); duration = pulseIn(inPin, HIGH);
inches = microsecondsToInches(duration); cm = microsecondsToCentimeters(duration);
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(100); }
long microsecondsToInches(long microseconds) {
return microseconds / 74 / 2; }
long microsecondsToCentimeters(long microseconds) { return microseconds / 29 / 2;
}
Categories
Newsletter
Join our newsletter today, to get latest product information and promotion code.







.jpg)


