The DFRobot URM05 High Power Ultrasonic Range Finder is based on electrostatic senscomp's 6500 ultrasound transducer design. It can measure a distances of up to 10m. The angle between the ultrasound probes is only 15 °, while the majority of the ultrasound is 60 °.
//Arduino Sample code for DFRobot URM05 ultrasonic sensor //Last modified 9th Feb 2011 //www.DFRobot.com #define ECHO 9 #define INIT 10 #define BINH 11 void setup() { Serial.begin(9600); pinMode(ECHO, INPUT);//高电平脉宽读取引脚 pinMode(INIT, OUTPUT); //开始出发引脚 pinMode(BINH, OUTPUT); //消隐抑制 digitalWrite(INIT, LOW); digitalWrite(BINH, LOW); } void loop() { Measure(); delay(10); } void Measure() { static int ultraValue; //declare a static value to store the value of the sensor int val = 0; int timecount = 0; digitalWrite(INIT, HIGH);//trigger the sensor delayMicroseconds(900); digitalWrite(BINH, HIGH);//终止消隐 do { val = digitalRead(ECHO);//Read the PWM width if (1000 == timecount) break; timecount ++; delayMicroseconds(53); } while(val == LOW); digitalWrite(INIT, LOW); digitalWrite(BINH, LOW); ultraValue = timecount + 10;//Add a bias to the final the value Serial.println(ultraValue);//Send the ultrasonic sensor value to serial port }