|The URM37 V3.2 Ultrasonic Sensor was the first thing that I connected to my Arduino. It is a cool little piece of kit. It is actually a sonar device in that it bounces ultrasonic beams off of things to measure their distance from the sensor by timing the echo.|
Note that the product to the right is NOT precisely the same device as I am using but does offer most of the same features.
In any case, the one that I amusing can be connected either via PWM or serial (TTL or RS232) and if you use the serial interface you can also measure the temperature. I just wanted simple range finding on command so I used the PWM input. The user manual covers a lot more of the capabilities than I need!
Below is the Arduino code to read from the sensor. This presumes you have already set the pins to output and input respectively and declared their variables!
range = pulseIn(inputPin, LOW);
rangeCM = range / 50;
The only issue that I have had with this sensor has been one related to power. If you don't give it good power it will limit the range of the sensor. Drove me nuts.
- Power: +5V
- Current: <20mA
- Working temperature: -10 ~ +70 C
- Detecting range: 4cm-3m (3-5m is possible, but depending on situations)
- Resolution: 1cm
- Interface: PWM, RS232 or TTL (via Jumper)
- 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