URM37 V3.2 Ultrasonic Sensor (SKU:SEN0001)


URM37 V3.2 Ultrasonic Sensor uses an industrial level AVR processor as the main processing unit. It comes with a temperature correction which is very unique in its class. This sensor is perfect for any number of applications that require you to perform measurements between moving or stationary objects. Naturally, robotics applications are very popular but you’ll also find this product to be useful in security systems or as an infrared replacement if so desired.sensor measures distance using sonar; an ultrasonic (well above human hearing) pulse is transmitted from the unit and distance-to-target is determined by measuring the time required for the echo return.

 Specification

  • Power: +5V
  • Current: <20mA
  • Working temperature: -10℃~+70℃
  • Detecting range: 4cm-5m
  • Resolution: 1cm
  • Interface: RS232 (TTL), PWM
  • Servo control: One servo control output
  • Operating Mode: Serial; (PWM) passive control mode; Autonomous Mode; On/OFF Mode
  • Temperature sensor: 12 bits reading from serial port
  • Size: 22mm × 51 mm
  • Weight: 30g

Figure 2: URM37 V3.2 Pin Definition

 

1. +VCC – +5V Power
2. GND – Ground
3. RST – Reset
4. PWM – PWM Output 0-25000US,Every 50US represent 1cm
5. MOTO – Servo control signal output
6. COMP/TRIG

 

COMP – On/OFF mode, when the detecting distance is smaller than a pre-set value, this pin pulls low.
TRIG – PWM or RS232 trigger pin

 

7. NC
8. RXD – RS232,TTL communication
9. TXD – RS232,TTL communication

Compare with other ultrasonic sensor

Compare with SRF08 and XL-MaxSonar-WRC1 Ultrasonic Distance Sensor Evaluating

 Hardware requierments

  1. 1×URM37 V3.2 Ultrasonic Sensor
  2. 1×Arduino Microcontroller
  3. 1×IO Expansion Shield For Arduino(V5)
  4. 1×USB cable

Tools used

  • 4×jumper wire

Software

  • Arduino IDE

Working Mode Selection

The working mode can be changed by writing 0x00, 0x01 or 0x02 to EEPROM through serial port.

Mode 1: Serial passive control mode

Under this mode, the sensor is always waiting for command from serial port. Every time it receives a command, it will return the distance and wait for the next command. The degree in the command will be used to control a servo motor to rotate corresponding degree. Please note that this mode is always on. It can not be switch on or off.

Jumper setting for RS232 and TTL output

The selection of RS232 or TTL output level is switched by changing three jumpers (J1, J2, J3). A diagram below illustrates the setting:

Warning: Do not connect to TTL MCU when the output mode is set to RS232, doing so will permanently damage the unit.

This feature is only available for Rev2 and after. If there are no jumpers on the back of the sensor, the sensor is Rev1 and hence not supporting this feature.

 

TTL Mode Connection Diagram

 

Mode 2: Autonomous trigger mode

 

Under this mode, the sensor will make a sensor reading every 25ms and compare the reading with a threshold (pre-set, user is able to define this value by writing EEPROM), if the reading is equal or smaller than the threshold, pin COMP/TRIG will have low output. In the meantime, pin PWM will output the distance reading, every 50us low level stands for 1cm, by counting the number of these pulses, the distance can be calculated. This mode can be simply used as an ON/OFF switch.

 

Mode 3: PWM passive control mode

 

Under this mode, a low pull on pin COMP/TRIG will trigger a sensor reading. The width of the pulse is proportional to the servo rotating degree. After a successful sensor reading, Pin PWM will output pulses, every 50us represents 1cm. If the reading is invalid, a 50000us pulse will be returned.

 

// # Editor    :Jiang from DFRobot
// # Data      :24.07.2012
// # Product name:ultrasonic scanner
// # Product SKU:SEN0001
// # Version :  0.1
// # Description:
// # The Sketch for scanning 180 degree area 4-500cm detecting range
// # Connection:
// #       Pin 1 VCC (URM V3.2) -> VCC (Arduino)
// #       Pin 2 GND (URM V3.2) -> GND (Arduino)
// #       Pin 4 PWM (URM V3.2) -> Pin 3 (Arduino)
// #       Pin 6 COMP/TRIG (URM V3.2) -> Pin 5 (Arduino)
// #
int URPWM = 3; // PWM Output 0-25000US,Every 50US represent 1cm
int URTRIG=5; // PWM trigger pin
unsigned int Distance=0;
uint8_t EnPwmCmd[4]={0x44,0x22,0xbb,0x01};    // distance measure command
void setup(){                                 // Serial initialization
  Serial.begin(9600);                         // Sets the baud rate to 9600
  PWM_Mode_Setup();
}
void loop()
{
 PWM_Mode();
 delay(20);
}                      //PWM mode setup function
void PWM_Mode_Setup(){
  pinMode(URTRIG,OUTPUT);                     // A low pull on pin COMP/TRIG
  digitalWrite(URTRIG,HIGH);                  // Set to HIGH

  pinMode(URPWM, INPUT);                      // Sending Enable PWM mode command

  for(int i=0;i<4;i++){
      Serial.write(EnPwmCmd[i]);
   }
}
void PWM_Mode(){                              // a low pull on pin COMP/TRIG  triggering a sensor reading
    digitalWrite(URTRIG, LOW);
    digitalWrite(URTRIG, HIGH);               // reading Pin PWM will output pulses

    unsigned long DistanceMeasured=pulseIn(URPWM,LOW);

    if(DistanceMeasured==50000){              // the reading is invalid.
      Serial.print("Invalid");   
   }
    else{
      Distance=DistanceMeasured/50;           // every 50us low level stands for 1cm
   }
  Serial.print("Distance=");
  Serial.print(Distance);
  Serial.println("cm");
}

 

Related posts:

About author

This article was written by admin

Admin has over twenty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles. Working presently as Development Manager in India. A firm Believer in Knowledge grows when it shared.

Comments

No Comments

Leave your comment

Your email address will not be published. Required fields are marked *