(SKU:RB-02S001)RB URF02 Ultrasonic Sensor

From ALSRobot-Wki
Jump to: navigation, search
125.jpg

Contents

overview

This newest URF02 Ultrasonic Sensor is researched and produced by Harbin Alseon Robotics Technology Co., Ltd. .The RB URF02 Ultrasonic Sensor is used exclusively for 5V power input. With the power supply, sensors keep transmitting at default transmit condition. Two modes of selection function are available: single-line mode only needs a signal line, greatly reduce the IO port resources; wire mode only needs a line of input and output signals. Detection distance can be accurate from 1cm to 500cm.RB URF02 Ultrasonic sensors can generate high frequency sound waves.

Technical parameters and performance

  1. Working voltage: +5v
  2. Working current :< 20mA
  3. Work frequency: 40 KHz
  4. Temperature range: -10°C-+70°C
  5. Detecting distance: 1cm-500cm
  6. Resolution: 0.5cm
  7. Accuracy: ±0.5%
  8. Sensitivity: detect objects 2cm in diameter over 1.8m
  9. Interface: TTL
  10. Detecting range: directional (horizontal/vertical) 65 degrees
  11. Weight: 9g
  12. Size: 46.7mm x 25.7mmx19mm
P-2.jpg

using method

Pin definition

The sensor pin is defined as

  • OUTPUT: output signal
  • INPUT: signal input
  • +: power supply (VCC)
  • -: (GND)
P-3.jpg

Connect Icon

Single wire mode connection:

Chaoshengbodanxian.jpg
  • INPUT port to the I/O port of the controller. 5V and +5V are respectively connected to the power of GND and GND.

Note: the mode selection switch (Mode) is set to the number 1 side when using a single line mode. Wire mode connection:

Chaoshengboshuangxian.jpg
  • INPUT, OUTPUT port to the I/O port of the controller. 5V and +5V are respectively connected to the power of GND and GND.

Note: the mode selection switch (Mode) is set to the number 2 side in the use of a two wire mode.

Application Routine

Sample code

Single line mode test: the hardware connection as shown in figure, the digital port 2 received ultrasonic INPUT, the switch to digital 1 side of the ultrasonic into the single line mode.

int duration;                          
int distance;                          
int srfPin = 2;                          
void setup() 
{ 
Serial.begin(9600); 
} 
void loop() 
{ 
  pinMode(srfPin, OUTPUT); 
  digitalWrite(srfPin, LOW);            
  delayMicroseconds(2); 
  digitalWrite(srfPin, HIGH);           
  delayMicroseconds(10); 
  digitalWrite(srfPin, LOW);            
  pinMode(srfPin, INPUT); 
  duration = pulseIn(srfPin, HIGH);         
  distance = duration/58;      
  Serial.println(distance);        
  delay(50);                             
} 


Double line mode test: the hardware connection is shown in the following figure, the number 4 is connected with the ultrasonic OUTPUT, the digital port 5 is connected with the ultrasonic INPUT, and the switch is dialed to the 2 side of the digital ultrasonic to enter the double line mode.

int inputPin=4;   
int outputPin=5;  
int ledpin=13;   
void setup() 
{ 
  Serial.begin(9600); 
  pinMode(ledpin,OUTPUT); 
  pinMode(inputPin, INPUT); 
  pinMode(outputPin, OUTPUT); 
}                                                                                                                                          
void loop() 
{ 
  digitalWrite(outputPin, LOW);
  delayMicroseconds(2); 
  digitalWrite(outputPin, HIGH); 

  delayMicroseconds(10); 
  digitalWrite(outputPin, LOW);     
  int distance = pulseIn(inputPin, HIGH);   
  distance= distance/58;    
  Serial.println(distance);                 
  delay(50);    
  if (distance >=50) 
  { 
     digitalWrite(ledpin,HIGH); 
  }
  else 
     digitalWrite(ledpin,LOW); 
} 

Program effect

  1. open serial assistant can observe the output value of the distance.
  2. open serial port assistant can be observed to the distance value, if the distance is less than 50 cm from the digital port 13 LED lights extinguished, distance is greater than 50 cm from the digital port 13 LED lights lit and serial print distance data.

Product recommendation

Buy address:RB URF02 Ultrasonic Sensor

Personal tools
Namespaces

Variants
Actions
Navigation
Tools