พร้อมส่ง-HC-SR04 Ultrasonic Sensor Module
ข้อมูลสินค้า
ราคา
35.00 บาท
ขายแล้ว
651 ชิ้น
ร้านค้า
พร้อมส่ง-HC-SR04 Ultrasonic Sensor Module
***** รับประกันสินค้า 30 วัน *****
The module has stable performance and accurate measurement distance. It can compete with foreign ultrasonic ranging modules such as SRF05 and SRF02.
The module is high-precision, the blind zone (2cm) is super close, and stable ranging is a powerful basis for this product to successfully enter the market!
Main technical parameters:
1: Use voltage: DC5V
2: quiescent current: less than 2mA
3: Level output: 5V high
4: Level output: bottom 0V
5: Induction angle: no more than 15 degrees
6: Detection distance: 2cm-450cm
7: High precision: up to 0.3cm wiring, VCC, trig (control terminal), echo (receiver), GND
The use of this product:
a control port sends a high level of 10US or more, you can wait for the high level output at the receiving port. When there is an output, you can start the timer, when the port becomes low, you can read the timing. The value of the device, at this time is the time of the distance measurement, in order to calculate the distance. Such continuous cycle measurement, you can reach the value of your mobile measurement
Module working principle:
(1) Using IO trigger ranging to give a high level signal of at least 10us;
(2) The module automatically sends eight 40khz square waves to automatically detect whether there is a signal return;
(3) There is a signal return, a high level is output through the IO, and the high level duration is the time from the transmission to the return of the ultrasonic wave. Test distance = (high time * sound speed (340M / S)) / 2;
Example:
/*
* created by Rui Santos, https://randomnerdtutorials.com
*
* Complete Guide for Ultrasonic Sensor HC-SR04
*
Ultrasonic sensor Pins:
VCC: +5VDC
Trig : Trigger (INPUT) - Pin11
Echo: Echo (OUTPUT) - Pin 12
GND: GND
*/
int trigPin = 14; //D5 //D1=5(3.3-5V OK) 2, 11 Trigger
int echoPin = 16; //D0 //D0=16(3.3-5V OK) D2=4(3.3-5V OK) 3, 12 Echo
long duration, cm, inches;
void setup() {
//Serial Port begin
Serial.begin (9600);
//Define inputs and outputs
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
// The sensor is triggered by a HIGH pulse of 10 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Read the signal from the sensor: a HIGH pulse whose
// duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
// Convert the time into a distance
cm = (duration/2) / 29.1; // Divide by 29.1 or multiply by 0.0343
inches = (duration/2) / 74; // Divide by 74 or multiply by 0.0135
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(100);
}