URM04 Ultrasonic Distance Sensor (4~500cm, RS485) (ของแท้จาก DFRobot)

URM04 Ultrasonic Distance Sensor (4~500cm, RS485) (ของแท้จาก DFRobot)
URM04 Ultrasonic Distance Sensor (4~500cm, RS485) (ของแท้จาก DFRobot)URM04 Ultrasonic Distance Sensor (4~500cm, RS485) (ของแท้จาก DFRobot)URM04 Ultrasonic Distance Sensor (4~500cm, RS485) (ของแท้จาก DFRobot)URM04 Ultrasonic Distance Sensor (4~500cm, RS485) (ของแท้จาก DFRobot)
รหัสสินค้า AS10369
หมวดหมู่ LIDAR / เซ็นเซอร์วัดระยะทาง / ความเร็ว Distance / Speed
ราคา 1,285.00 บาท
สถานะสินค้า พร้อมส่ง
จำนวน
ชิ้น
หยิบลงตะกร้า
หนังสือรับรองบริษัท
บุ๊คแบ๊งค์
คุ้มครองโดย LnwPay
ดูแนวทางการใช้งาน การต่อ และ arduino code ได้ใน Click

ดาวน์โหลด arduino code ได้ที่ Click

ภาพรวม
เซ็นเซอร์อัลตราโซนิก URM04 ได้รับการพัฒนาบนพื้นฐานของ URM37 โดยใน URM04 ได้ใช้อินเทอร์เฟซแบบ RS485 ซึ่งทำให้สามารถใช้เซ็นเซอร์หลายตัวพร้อมกันได้ อินเทอร์เฟซ RS485 ช่วยให้สามารถเชื่อมต่อ URM04 ได้สูงสุดถึง 32 ตัวในเครือข่ายเดียว

URM04 จะช่วยให้คุณสามารถวัดระยะห่างที่แน่นอนของสิ่งกีดขวางในมุมมองของสนามโซนาร์ ความฉลาดของหุ่นยนต์ของคุณจะขึ้นอยู่กับเซ็นเซอร์ที่ไวต่อการตอบสนอง คล้ายกับสิ่งที่ค้างคาวใช้ในการระบุตำแหน่งและติดตามเหยื่อ ด้วยการเขียนโปรแกรมขั้นสูง คุณสามารถออกแบบตัวชดเชยเพื่อควบคุมมอเตอร์ของคุณได้อย่างแม่นยำตามระยะห่างของสิ่งกีดขวาง

หมายเหตุ: เซ็นเซอร์ URM04 นี้ต้องการอินเทอร์เฟซ RS485 ไม่สามารถเชื่อมต่อกับ Arduino ได้โดยตรง เพื่อให้การเชื่อมต่อเป็นเรื่องง่าย ขอแนะนำให้ใช้ Arduino RS485 Shield.


INTRODUCTION

The URM04 Ultrasonic sensor is developed based on our popular URM37 ultrasonic sensor, it is using RS485 interface which allows multiple sensors to be used simultaneously. The RS485 interface allows a number of sensors to work together. Up to 32 URM04 may be connected together in a network.

The ultrasonic sensor allows you to determine the exact distance of an obstacle in the sonar field of view. The cleverness of your robot will depend on a sensitive sensor similar to the one bats use to know their position and track prey. With advanced programming, you can design compensators in order to perfectly control your motors according to the obstacle's distance.

NOTE: This sensor REQUIRES an RS485 interface. It can not be connected directly to an Arduino. To make the connection easily we recommend using our Arduino RS485 Shield.

SPECIFICATION

  • Operating Voltage: +5V
  • Current: <20mA
  • Operating Temperature: -10℃~+70℃
  • Detecting range: 4cm-500cm (1.6in-197in)
  • Resolution: 1cm (0.4in)
  • Frequency: 40KHz
  • Interface: RS485
  • Units: Range reported in cm
  • Temperature sensor: 12 bits reading from serial port
  • Default Device Address: 0x11
  • Default Device baudrate: 19200
  • Size: 34x51 mm (1.3x2 in)
  • Weight: 30g

DOCUMENTS

SHIPPING LIST

  • URM04 v2.0 Ultrasonic Sensor x 1
  • Wire with 4p JST connector x 1

Sensor Connection Diagram

As the sensor uses RS485 interface which can not be connected directly to the MCU, a MAX485 chip will bridge the TTL interface to RS485, as shown in Figure 4.

For PC users, either a USB-RS485 or RS232-RS485 converter will bridge the gap. A diagram is depicted in Figure 5 and 6.

Figure 4 Connect Sensor to MCU via MAX485

Figure 5 Connect Sensor to PC via USB-RS485 converter

Figure 6 Connect Sensor to PC via RS232-RS485 Converter

Figure 7 Connect Sensor to Arduino Via MAX485 IC

Sensor Networking

Upto 32 URM04 sensors are able to join a network. Simply serially connect the sensors uses twisted pair cables. A diagram is illustrated in Figure 7.

Figure 7 URM04 Networking

Arduino sketch for driving one URM04 sensor

The sketch code:

/*
# The Sample code for driving single URM04 measuring distance function

# Editor : Lauren
# Date : 2012.2.8
# Ver : 0.3
# Product: URM04 Ultrasonic sensor

# Specification
* Detecting range: 4cm-500cm
* Resolution : 1cm
* Interface : RS485
* Units: Range reported in cm
* Temperature sensor: 12 bits reading from serial port


# Description:

# finish driving single URM function
# if use the IO expansion shield to drive the urm sensors, the measuring rate may be 20Hz or slower[if you want].
# The sample code is compatible with the Arduino IDE 1.0 and also the earlier version.

*/

#include "Urm4parser.h"

void setup(){
urmInit(); // Init the URM04 sensor
}

void loop(){
static unsigned long timePoint = 0;

runUrm4(); // Drive URM04 Sensor and transmit the protocol to the sensor via RS485 interface
// (IO Expansion shield V5 for arduino)
decodeURM4(); // Read and get the distance value from the sensor
if(millis() - timePoint > 100){
PrintData(); // print the data
timePoint = millis();
}
// PrintData();
// delay(100);

}

void PrintData(){

Serial.print("Distance value: ");
for(int i = 0; i < urmAccount; i++){
Serial.print(urmData[i]);
Serial.print(" ");
}
/*
for(int i = 0; i < urmAccount;i ++){
Serial.print(urmID[i],HEX);
Serial.print(" ");
}
*/
Serial.println();
}

The library code: please place the library file Urm4parser.h in to the sketch folder.

/*
# The library for the URM04 sketch

# Editor : Lauren
# Date : 2012.2.8
# Ver : 0.3
# Product: URM04 Ultrasonic sensor

# Specification
* Detecting range: 4cm-500cm
* Resolution : 1cm
* Interface : RS485
* Units: Range reported in cm
* Temperature sensor: 12 bits reading from serial port


# Description:

# finish driving single URM function
# if use the IO expansion shield to drive the urm sensors, the measuring rate may be 20Hz or slower[if you want].
# The sample code is compatible with the Arduino IDE 1.0 and also the earlier version.

*/
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#define printByte(args) Serial.write(args)
#else
#include "WProgram.h"
#define printByte(args) Serial.print(args,BYTE)
#endif

#define SerialPort Serial
#define urmAccount 1 // Init the account of the URM04 sensor
#define CommMAXRetry 40
#define TriggerPin 2

/******************** Variables ****************/

byte startAddr = 0x11; // Init the URM04 485 Address -- URM04 default address = 0x11

byte readingStep;
byte cmdst[10];
int urmID[urmAccount];
unsigned int urmData[urmAccount];
unsigned long managerTimer = 20;

/******************** Functions ****************/
void urmInit();
void runUrm4();
void urmTrigger(int id);
void urmReader(int id);
void transmitCommands();
void decodeURM4();
void analyzeUrmData(byte cmd[]);

/****************** Init sensor ****************/

void urmInit(){

pinMode(TriggerPin,OUTPUT); // TTL -> RS485 chip driver pin
digitalWrite(TriggerPin,LOW);// Turn the driver pin to LOW -> Turn on reading mode for the RS485 interface
// Turn the drvier pin to HIGH -> Turn on code transmitting mode for the RS485 interface
readingStep = 0;
startAddr = 0x11;
managerTimer = millis();
for(int i = 0 ;i < urmAccount; i ++){ //Init the URM04 command receiving address
urmID[i] = startAddr + i;
urmData[i] = 0;
}
SerialPort.begin(19200); // Init the RS485 interface
// Also when you are driving the URM04, you could open serial monitor to
// tracing the steps and data feedback from URM04
SerialPort.println();
SerialPort.print("The URM ID: 0x");
for(int i = 0 ;i < urmAccount; i ++){ //Init the URM04 command receiving address
SerialPort.print(urmID[i],HEX);
SerialPort.print(" ");
}
SerialPort.println(" ");
SerialPort.println("The default baudrate: 19200");
SerialPort.println("Start drive the sensors!");
for(int i = 0 ;i < 10; i++) cmdst[i] = 0; //init the URM04 protocol
cmdst[0]=0x55;
cmdst[1]=0xaa;
}

/********************* Drive URM04 and get the data code *************************/

void runUrm4(){ // You could adjust the sensor measuring rate by changing the managerTimer value

static unsigned long timer = 0;
static int num = 0; //Set the URM04 id to be drived

if(millis() - timer > managerTimer){
digitalWrite(TriggerPin, HIGH); //Turn on transmitting mode for the RS485 interface

switch(readingStep){

case 0:
urmTrigger(urmID[num]);
managerTimer = 40; //set a interval after trigger the measuring

break;

case 1:
urmReader(urmID[num]);
managerTimer = 0; //set a interval after transmitting the reading distance command

break;

case 2:
digitalWrite(TriggerPin, LOW); //Turn on reading mode for the RS485 interface
managerTimer = 10;
break;

default:
readingStep = 0; // Finish reading the distance and start a new measuring for the sensor
break;
}

if(readingStep < 2) readingStep++; //step manager
else readingStep = 0;

timer = millis();
}

}

/********************* Transmit Command via the RS485 interface ***************/

void urmTrigger(int id){ // The function is used to trigger the measuring
cmdst[2] = id;
cmdst[3] = 0x00;
cmdst[4] = 0x01;
transmitCommands();
// SerialPort.println("Trigger!");
}
void urmReader(int id){ // The function is used to read the distance
cmdst[2] = id;
cmdst[3]=0x00;
cmdst[4]=0x02;
transmitCommands();
// SerialPort.println("Ask for distance!");
}

void transmitCommands(){ // Send protocol via RS485 interface
cmdst[5]=cmdst[0]+cmdst[1]+cmdst[2]+cmdst[3]+cmdst[4];
delay(1);
for(int j = 0; j < 6; j++){
printByte(cmdst[j]);
// delayMicroseconds(10);
}
delay(2);
}


/********************* Receive the data and get the distance value from the RS485 interface ***************/

void decodeURM4(){

if(SerialPort.available()){

unsigned long timerPoint = millis();

int RetryCounter = 0;
byte cmdrd[10];
for(int i = 0 ;i < 10; i++) cmdrd[i] = 0;
int i=0;

// SerialPort.println("OK");

boolean flag = true;
boolean valid = false;
byte headerNo = 0;

while(RetryCounter < CommMAXRetry && flag)
{

if(SerialPort.available()){
cmdrd[i]= SerialPort.read();

// printByte(cmdrd[i]);

if(i > 7){
flag=false;
// printByte(0xEE);
// printByte(0xFF);
SerialPort.flush();
break;
}
if(cmdrd[i] == 0xAA){
headerNo = i;
valid = true;
}
if(valid && i == headerNo + 6){
// printByte(0xDD);
// printByte(0xFF);
flag = false;
break;
}
i ++;
RetryCounter = 0;
}
else{
RetryCounter++;
delayMicroseconds(15);
}
}

// printByte(millis() - timerPoint);

if(valid) analyzeUrmData(cmdrd);
// else SerialPort.println("Invalid feedback"); //Get an invalid error command

}

}

void analyzeUrmData(byte cmd[]){

byte sumCheck = 0;
for(int h = 0;h < 7; h ++) sumCheck += cmd[h];

if(sumCheck == cmd[7] && cmd[3] == 2 && cmd[4] == 2){

byte id = cmd[2] - startAddr;
urmData[id] = cmd[5] * 256 + cmd[6];

// SerialPort.print(id);
// SerialPort.print(":");
// SerialPort.println(urmData[id]);

}
else if(cmd[3] == 2 && cmd[4] == 2){
SerialPort.print("Sum error");
}

}
 

วิธีการชำระเงิน

ชำระเงินค่าสินค้าโดยการโอนเงินเข้าบัญชีธนาคาร KBANK, SCB, BBL,TMB

กรุณาเก็บหลักฐานการโอนเงินของท่านไว้เพื่อแจ้งการชำระเงินด้วยค่ะ

 

ท่านสามารถแจ้งการชำระเงินผ่านระบบอัตโนมัติได้โดย Click Link ข้างล่างค่ะ

https://www.arduitronics.com/informpayment

 

บมจ. ธนาคารกสิกรไทย สาขาเซ็นทรัล แจ้งวัฒนะ ออมทรัพย์
ธนาคารไทยพาณิชย์ จำกัด (มหาชน) สาขาเซ็นทรัล แจ้งวัฒนะ ออมทรัพย์
ธนาคารกรุงเทพ จำกัด (มหาชน) สาขาเซนทรัล พระราม 3 สะสมทรัพย์
ธนาคารทหารไทยธนชาต จำกัด (มหาชน) สาขาเซนทรัล พระราม 3 กระแสรายวัน

เพิ่มเพื่อน

@rfm0967y

ติดต่อสอบถาม

เพิ่มเพื่อน

CATEGORY

Sensors / Modules [1695]

CONTACT US

มือถือ 0887823467 แฟกซ์ 02-0153201

Join เป็นสมาชิกร้านค้า

ร้านArduitronics
ร้านArduitronics
/www.arduitronics.com/
Join เป็นสมาชิกร้าน
2118
สมัครสมาชิกร้านนี้ เพื่อรับสิทธิพิเศษ

STATISTICS

หน้าที่เข้าชม15,375,394 ครั้ง
ผู้ชมทั้งหมด5,878,472 ครั้ง
เปิดร้าน21 พ.ค. 2556
ร้านค้าอัพเดท5 ก.ย. 2568

MEMBER

พูดคุย-สอบถาม