GR9300-02A模塊工作原理:
採用IO觸發測距,給至少10us的高電平信號。
模塊自動發送8個40KHz的方波,自動檢測是否有信號返回。
有信號返回,通過IO輸出一高電平,高電平持續的時間就是超聲波從發射到返回的時間.測試距離=(高電平時間*聲速(340m/s))/2;
電路連接方法:
Arduino程序例子:
這個範例很好用,單位會換算為 cm,只要開啟序列埠監控視窗,就可以看到運作時的變化!!
const int TrigPin = 2;
const int EchoPin = 3;
float cm;
void setup()
{
Serial.begin(9600);
pinMode(TrigPin, OUTPUT);
pinMode(EchoPin, INPUT);
}
void loop()
{
digitalWrite(TrigPin, LOW); //低高低電平發一個短時間脈衝去TrigPin
delayMicroseconds(2);
digitalWrite(TrigPin, HIGH);
delayMicroseconds(10);
digitalWrite(TrigPin, LOW);
cm = pulseIn(EchoPin, HIGH) / 58.0; //將回波時間換算成cm
cm = (int(cm * 100.0)) / 100.0; //保留兩位小數
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(1000);
}
如果您要搭配 GR9300-04 1602LCD,可以參考下列程式碼用法
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // Creates an LCD object. Parameters: (rs, enable, d4, d5, d6, d7)
const int trigPin = 9;
const int echoPin = 10;
long duration;
int distanceCm, distanceInch;
void setup() {
lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distanceCm= duration*0.034/2;
distanceInch = duration*0.0133/2;
lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will be displayed
lcd.print("Distance: "); // Prints string "Distance" on the LCD
lcd.print(distanceCm); // Prints the distance value from the sensor
lcd.print(" cm");
delay(10);
lcd.setCursor(0,1);
lcd.print("Distance: ");
lcd.print(distanceInch);
lcd.print(" inch");
delay(10);
}
本模塊性能穩定,測度距離精確。
能和國外的SRF05,SRF02等超聲波測距模塊相媲美。
模塊高精度,盲區(2cm)超近,穩定的測距是此產品成功走向市場的有力根據!
主要技術參數:
1:使用電壓:DC5V
2:靜態電流:小於2mA
3:電平輸出:高5V
4:電平輸出:底0V
5:感應角度:不大於15度
6:探測距離:2cm-450cm
7:高精度:可達0.3cm
8.PCB板大小:4.5*2.0CM接線方式,VCC、trig(控制端)、echo(接收端)、GND
本產品使用方法:
一個控制口發一個10US以上的高電平,就可以在接收口等待高電平輸出.一有輸出就可以開定時器計時,當此口變為低電平時就可以讀定時器的值,此時就為此次測距的時間,方可算出距離.如此不斷的週期測,就可以達到你移動測量的值了~~
模塊工作原理:
(1)採用IO觸發測距,給至少10us的高電平信號
(2)模塊自動發送8個40khz的方波,自動檢測是否有信號返回
(3)有信號返回,通過IO輸出一高電平,高電平持續的時間就是超聲波從發射到返回的時間.測試距離=(高電平時間*聲速(340M/S))/2
會員名稱 | 購買數量 | 購買時間 | 訂單狀態 |
dre***** | 1 | 01-25 | 成交 |
ale***** | 1 | 02-11 | 成交 |
qqs***** | 1 | 08-26 | 成交 |
tim***** | 4 | 09-13 | 成交 |
emp***** | 1 | 05-07 | 成交 |