URM37 3.2

Hello folks,

I'm preparing for my A-level exams a project about Arduino boards, and I need a little help with it..

I do have an Arduino Uno, with a URM37 v3.2 sensor. After hours of work, I've learned many things about it, except how to wire and programm it correctly.

Could anyone give start me up? Currently I do have a fresh Arduino installation on Windows 7 (I was working those hours on my Ubuntu laptop), so I should need a new library, I suppose.

Many thanks, Amoeba

Edit:

I've wired it once so that it gave an output, but I think it wasn't a DISTANCE value. It returned: Measurement -1 Timeout

Something this way...

Currently, this is my setup:

Code:

#include "URMSerial.h" 


// The measurement we're taking 
#define DISTANCE 1 
#define TEMPERATURE 2 
#define ERROR 3 
#define NOTREADY 4 

URMSerial urm; 

void setup() { 
Serial.begin(9600); 
urm.begin(2,3,9600); 
} 

void loop(){
int value;
urm.requestMeasurementOrTimeout(DISTANCE, value);
Serial.println(value);
if(value < 25)
{
Serial.println("turnright");
}
else
{
Serial.println("turnleft");
}
delay(200);
}

Wiring:
Arduino Uno is connected with an USB cable.
Arduino 5V → 5V URM37 (1)
Arduino GRND → GRND URM37 (2)
Arduino Dig 2 → TXD URM37 (9)
Arduino Dig 3 → RXD URM37(8 )

My serialmonitor does give an output:

turnright
-6655
turnright
-6655
turnright
-6655
turnright
-6655
turnright

Always, no matter what I do. If I put an object right in front of it, or 4 metres away, it won’t change the output.

Pff

Can you share where you got your library and information to get started?

I found this Wiki link but, I am sure there must be more out on the internet.
http://www.milesburton.com/URM37_Ultrasonic_Distance_Measurement_Library

If you search his index you will find more. http://www.milesburton.com/Arduino

Yes, I am using that library. I got my information from this topic: www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1288429609/11

I still don't get it...

I tried the example sketch, and even that one would not work for me. Am I doing something really wrong?

I see a couple of possibilities that I found in the manual using the link I provided below.

You may not have the PWR_ON - Enable pin set High so your sensor may not be turned on. The second thing is you need to have the jumpers set to TTL and not RS232.

From the manual: http://www.dfrobot.com/wiki/index.php?title=URM37_V3.2_Ultrasonic_Sensor_%28SKU:SEN0001%29

+VCC - +5V Power GND - Ground RST - Reset PWM - PWM Output 0?25000US?Every 50US represent 1cm MOTO - Servo control signal output 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

PWR_ON - Enable pin, enable the sensor when high RXD - RS232,TTL communication TXD - RS232,TTL communication

Well, I did put the jumpers to TTL mode. But how do I enable the sensor? (Wiring and the line of code?)

If you look at the picture showing the wiring, you will see a pin called "PWR ON". In the diagram they put +5volts to the pin to enable the sensor.

Hi, I just got this today and it is working for me. But...

I wired it according to this page: http://www.milesburton.com/URM37_Ultrasonic_Distance_Measurement_Library

Jumpers to TTL mode.

1 = 5v 2 = GND 7 = 5v 8 = 3 9 = 2

Downloaded the library at: http://download.milesburton.com/Arduino/URM37/URM37_1.5.0.zip

Opened the example: MeasurementBySoftwareSerial.pde

In the code it says: urm.begin(6,7,9600);  // RX Pin, TX Pin, Baud Rate

When I use: urm.begin(3, 2,9600);                // RX Pin, TX Pin, Baud Rate I get -1 (timeout)

But when it to: urm.begin(2, 3, 9600);

It works! I get correct measurements! Checked it with a an other distance meter. Same results.

The comment is confusing: // RX Pin, TX Pin, Baud Rate

Good work! Pin 7 was the PWR ON pin I was talking about that needed 5v.

But when it to: Code: urm.begin(2, 3, 9600); It works! I get correct measurements! Checked it with a an other distance meter. Same results. The comment is confusing: Code: // RX Pin, TX Pin, Baud Rate

Somewhere the TX, RX labeling or how it got wired must have been incorrect so, when you changed the pin definitions you solved the wires being connected incorrectly...you fixed the issue. I think I would have did the same thing you did though.

It is working so, congratulations!