URM37 V3.2 not working

Hi everyone,
I have just bought a URM37 V3.2 sensor but unfortunately it is not working. The context is the following one:
Arduino MEGA 2560
Sensor URM37 V3.2 (TTL mode). Pin 9 connected to pin 6 of Arduino. Pin 8 connected to pin 7 of Arduino
The code I am using is the one provided by DFROBOT (I did not change it, just copy and paste):
/*
DistanceBySoftwareSerial.pde - URM 37 Control Library Version 2.0.0
Author: Miles Burton, [email protected]
Copyright (c) 2009 Miles Burton All Rights Reserved
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or dfrobot FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// # This library is a improvement version of URM 37 Control Library Version 2.0.0 from Miles Burton
// # Original Author: Miles Burton, [email protected]
// #
// # Editor : Lauren from DFRobot
// # Date : 08.05.2012
// # Product name: URM V3.2 ultrasonic sensor TTL connection with Arduino
// # Product SKU : SEN0001
// # Version : 1.0
// # Update the library to make it compatible with the Arduino IDE 1.0 or the latest version
// # Description:
// # The sketch for using the URM37 from DFRobot based on the Software Serial library
// # You could drive the URM37 with 2 digital pins on your Arduino board, and it works stable.
// # Connection:
// # VCC (Arduino) -> Pin 1 VCC (URM37 V3.2)
// # GND (Arduino) -> Pin 2 GND (URM37 V3.2)
// # Pin 6 (Arduino) -> Pin 9 TXD (URM37 V3.2)
// # Pin 7 (Arduino) -> Pin 8 RXD (URM37 V3.2)
// #
#include "URMSerial.h"
// The measurement we're taking
#define DISTANCE 1
#define TEMPERATURE 2
#define ERROR 3
#define NOTREADY 4
#define TIMEOUT 5
URMSerial urm;
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
urm.begin(6,7,9600); // RX Pin, TX Pin, Baud Rate
Serial.println("URM37 Library by Miles Burton"); // Shameless plug
}
void loop()
{
Serial.print("Measurement: ");
delay(2000);
Serial.println(getMeasurement()); // Output measurement
}
int value; // This value will be populated
int getMeasurement()
{
// Request a distance reading from the URM37
switch(urm.requestMeasurementOrTimeout(DISTANCE, value)) // Find out the type of request
{
case DISTANCE: // Double check the reading we recieve is of DISTANCE type
// Serial.println(value); // Fetch the distance in centimeters from the URM37
return value;
break;
case TEMPERATURE:
return value;
break;
case ERROR:
Serial.println("Error");
break;
case NOTREADY:
Serial.println("Not Ready");
break;
case TIMEOUT:
Serial.println("Timeout");
break;
}
return -1;
}
The output is always the same: TIMEOUT. So basically, I get no value.
Can anyone help on this issue?
Best regards,
Miguel
I have just bought a URM37 V3.2 sensor but unfortunately it is not working. The context is the following one:
Arduino MEGA 2560
Sensor URM37 V3.2 (TTL mode). Pin 9 connected to pin 6 of Arduino. Pin 8 connected to pin 7 of Arduino
The code I am using is the one provided by DFROBOT (I did not change it, just copy and paste):
/*
DistanceBySoftwareSerial.pde - URM 37 Control Library Version 2.0.0
Author: Miles Burton, [email protected]
Copyright (c) 2009 Miles Burton All Rights Reserved
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or dfrobot FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// # This library is a improvement version of URM 37 Control Library Version 2.0.0 from Miles Burton
// # Original Author: Miles Burton, [email protected]
// #
// # Editor : Lauren from DFRobot
// # Date : 08.05.2012
// # Product name: URM V3.2 ultrasonic sensor TTL connection with Arduino
// # Product SKU : SEN0001
// # Version : 1.0
// # Update the library to make it compatible with the Arduino IDE 1.0 or the latest version
// # Description:
// # The sketch for using the URM37 from DFRobot based on the Software Serial library
// # You could drive the URM37 with 2 digital pins on your Arduino board, and it works stable.
// # Connection:
// # VCC (Arduino) -> Pin 1 VCC (URM37 V3.2)
// # GND (Arduino) -> Pin 2 GND (URM37 V3.2)
// # Pin 6 (Arduino) -> Pin 9 TXD (URM37 V3.2)
// # Pin 7 (Arduino) -> Pin 8 RXD (URM37 V3.2)
// #
#include "URMSerial.h"
// The measurement we're taking
#define DISTANCE 1
#define TEMPERATURE 2
#define ERROR 3
#define NOTREADY 4
#define TIMEOUT 5
URMSerial urm;
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
urm.begin(6,7,9600); // RX Pin, TX Pin, Baud Rate
Serial.println("URM37 Library by Miles Burton"); // Shameless plug
}
void loop()
{
Serial.print("Measurement: ");
delay(2000);
Serial.println(getMeasurement()); // Output measurement
}
int value; // This value will be populated
int getMeasurement()
{
// Request a distance reading from the URM37
switch(urm.requestMeasurementOrTimeout(DISTANCE, value)) // Find out the type of request
{
case DISTANCE: // Double check the reading we recieve is of DISTANCE type
// Serial.println(value); // Fetch the distance in centimeters from the URM37
return value;
break;
case TEMPERATURE:
return value;
break;
case ERROR:
Serial.println("Error");
break;
case NOTREADY:
Serial.println("Not Ready");
break;
case TIMEOUT:
Serial.println("Timeout");
break;
}
return -1;
}
The output is always the same: TIMEOUT. So basically, I get no value.
Can anyone help on this issue?
Best regards,
Miguel
2013-10-31 11:14:37 Hello,
Sorry for bringing up an old post, but today I started using a URM37 V3.2 for a school project.
The only problem I encounter is, I'm not getting any information out of it.
I've use the library from Lauren which I managed to get from this website.
This gave me timeout errors.
After that I used the code you (Jose) provided, but that didn't work out either.
The terminal shows the following:
[img]http://img69.imageshack.us/img69/6530/5u5k.png[/img]
One thing that I am sure of is the wiring. I'm using this:
[img]https://www.dfrobot.com/wiki/images/8/8d/URM37_ConnectionDiagram.png[/img]
Thanks in advance,
Dutch_Gabber
Dutch_Gabber
Sorry for bringing up an old post, but today I started using a URM37 V3.2 for a school project.
The only problem I encounter is, I'm not getting any information out of it.
I've use the library from Lauren which I managed to get from this website.
This gave me timeout errors.
After that I used the code you (Jose) provided, but that didn't work out either.
The terminal shows the following:
[img]http://img69.imageshack.us/img69/6530/5u5k.png[/img]
One thing that I am sure of is the wiring. I'm using this:
[img]https://www.dfrobot.com/wiki/images/8/8d/URM37_ConnectionDiagram.png[/img]
Thanks in advance,
Dutch_Gabber

2013-10-31 11:14:37 Hello,
Sorry for bringing up an old post, but today I started using a URM37 V3.2 for a school project.
The only problem I encounter is, I'm not getting any information out of it.
I've use the library from Lauren which I managed to get from this website.
This gave me timeout errors.
After that I used the code you (Jose) provided, but that didn't work out either.
The terminal shows the following:
[img]http://img69.imageshack.us/img69/6530/5u5k.png[/img]
One thing that I am sure of is the wiring. I'm using this:
[img]https://www.dfrobot.com/wiki/images/8/8d/URM37_ConnectionDiagram.png[/img]
Thanks in advance,
Dutch_Gabber
Dutch_Gabber
Sorry for bringing up an old post, but today I started using a URM37 V3.2 for a school project.
The only problem I encounter is, I'm not getting any information out of it.
I've use the library from Lauren which I managed to get from this website.
This gave me timeout errors.
After that I used the code you (Jose) provided, but that didn't work out either.
The terminal shows the following:
[img]http://img69.imageshack.us/img69/6530/5u5k.png[/img]
One thing that I am sure of is the wiring. I'm using this:
[img]https://www.dfrobot.com/wiki/images/8/8d/URM37_ConnectionDiagram.png[/img]
Thanks in advance,
Dutch_Gabber

2013-07-17 01:09:11 ????
??, ?????? ???? ????????.
Eu posso entender português falado o leido, mas eu não posso escrevê-lo sem a ajuda do google! :P
Um abraço,
Jose
??, ?????? ???? ????????.
Eu posso entender português falado o leido, mas eu não posso escrevê-lo sem a ajuda do google! :P
Um abraço,

2013-07-17 01:09:11 ????
??, ?????? ???? ????????.
Eu posso entender português falado o leido, mas eu não posso escrevê-lo sem a ajuda do google! :P
Um abraço,
Jose
??, ?????? ???? ????????.
Eu posso entender português falado o leido, mas eu não posso escrevê-lo sem a ajuda do google! :P
Um abraço,

2013-07-16 23:21:15 [quote="Jose"]
Hi Portugal!
Tudo bem?
Take a look at this:
[url=http://arduino.cc/en/Reference/SoftwareSerial]http://arduino.cc/en/Reference/SoftwareSerial[/url]
That is what you want to use if you want to change the Serial port on a Arduino. Give it a go, if you have any problems, paste your code here.
I think my Portuguese is better than my Chinese :P But I am quite surprised! Have you studied Chinese?
Cheers^^
[/quote]
Olá,
wo xian zài zài b?'?rtú daxuè xue xi han hü. Ou dito de outra forma, eu ando a estudar Mandarim na Universidade do Porto.
Um abraço,
Portugal
Hi Portugal!
Tudo bem?
Take a look at this:
[url=http://arduino.cc/en/Reference/SoftwareSerial]http://arduino.cc/en/Reference/SoftwareSerial[/url]
That is what you want to use if you want to change the Serial port on a Arduino. Give it a go, if you have any problems, paste your code here.
I think my Portuguese is better than my Chinese :P But I am quite surprised! Have you studied Chinese?
Cheers^^
[/quote]
Olá,
wo xian zài zài b?'?rtú daxuè xue xi han hü. Ou dito de outra forma, eu ando a estudar Mandarim na Universidade do Porto.
Um abraço,

2013-07-16 23:21:15 [quote="Jose"]
Hi Portugal!
Tudo bem?
Take a look at this:
[url=http://arduino.cc/en/Reference/SoftwareSerial]http://arduino.cc/en/Reference/SoftwareSerial[/url]
That is what you want to use if you want to change the Serial port on a Arduino. Give it a go, if you have any problems, paste your code here.
I think my Portuguese is better than my Chinese :P But I am quite surprised! Have you studied Chinese?
Cheers^^
[/quote]
Olá,
wo xian zài zài b?'?rtú daxuè xue xi han hü. Ou dito de outra forma, eu ando a estudar Mandarim na Universidade do Porto.
Um abraço,
Portugal
Hi Portugal!
Tudo bem?
Take a look at this:
[url=http://arduino.cc/en/Reference/SoftwareSerial]http://arduino.cc/en/Reference/SoftwareSerial[/url]
That is what you want to use if you want to change the Serial port on a Arduino. Give it a go, if you have any problems, paste your code here.
I think my Portuguese is better than my Chinese :P But I am quite surprised! Have you studied Chinese?
Cheers^^
[/quote]
Olá,
wo xian zài zài b?'?rtú daxuè xue xi han hü. Ou dito de outra forma, eu ando a estudar Mandarim na Universidade do Porto.
Um abraço,

2013-07-16 19:42:10 Hi Portugal!
Tudo bem?
Take a look at this:
[url=http://arduino.cc/en/Reference/SoftwareSerial]http://arduino.cc/en/Reference/SoftwareSerial[/url]
That is what you want to use if you want to change the Serial port on a Arduino. Give it a go, if you have any problems, paste your code here.
I think my Portuguese is better than my Chinese :P But I am quite surprised! Have you studied Chinese?
Cheers^^
Jose
Tudo bem?
Take a look at this:
[url=http://arduino.cc/en/Reference/SoftwareSerial]http://arduino.cc/en/Reference/SoftwareSerial[/url]
That is what you want to use if you want to change the Serial port on a Arduino. Give it a go, if you have any problems, paste your code here.
I think my Portuguese is better than my Chinese :P But I am quite surprised! Have you studied Chinese?
Cheers^^

2013-07-16 19:42:10 Hi Portugal!
Tudo bem?
Take a look at this:
[url=http://arduino.cc/en/Reference/SoftwareSerial]http://arduino.cc/en/Reference/SoftwareSerial[/url]
That is what you want to use if you want to change the Serial port on a Arduino. Give it a go, if you have any problems, paste your code here.
I think my Portuguese is better than my Chinese :P But I am quite surprised! Have you studied Chinese?
Cheers^^
Jose
Tudo bem?
Take a look at this:
[url=http://arduino.cc/en/Reference/SoftwareSerial]http://arduino.cc/en/Reference/SoftwareSerial[/url]
That is what you want to use if you want to change the Serial port on a Arduino. Give it a go, if you have any problems, paste your code here.
I think my Portuguese is better than my Chinese :P But I am quite surprised! Have you studied Chinese?
Cheers^^

2013-07-16 09:37:38 [quote="Jose"]
Hi Miguel,
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.
[/quote]
Hi Jose,
in order to use this code and ports 3 and 2, what must I change on the code? Using ports 1 and 0 is not a good options as it blocks the communication between the PC and the Arduino.
Portugal
Hi Miguel,
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.
[/quote]
Hi Jose,
in order to use this code and ports 3 and 2, what must I change on the code? Using ports 1 and 0 is not a good options as it blocks the communication between the PC and the Arduino.

2013-07-16 09:37:38 [quote="Jose"]
Hi Miguel,
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.
[/quote]
Hi Jose,
in order to use this code and ports 3 and 2, what must I change on the code? Using ports 1 and 0 is not a good options as it blocks the communication between the PC and the Arduino.
Portugal
Hi Miguel,
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.
[/quote]
Hi Jose,
in order to use this code and ports 3 and 2, what must I change on the code? Using ports 1 and 0 is not a good options as it blocks the communication between the PC and the Arduino.

2013-07-16 06:35:13 [quote="Jose"]
Hi Miguel,
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.
[/quote]
Hi there,
the copy you provided solved the problem :-)
Wo hen hao. Xiexie.
Portugal
Hi Miguel,
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.
[/quote]
Hi there,
the copy you provided solved the problem :-)
Wo hen hao. Xiexie.

2013-07-16 06:35:13 [quote="Jose"]
Hi Miguel,
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.
[/quote]
Hi there,
the copy you provided solved the problem :-)
Wo hen hao. Xiexie.
Portugal
Hi Miguel,
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.
[/quote]
Hi there,
the copy you provided solved the problem :-)
Wo hen hao. Xiexie.

2013-07-15 20:54:54 Hi Miguel,
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.
Jose
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.

2013-07-15 20:54:54 Hi Miguel,
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.
Jose
I saw the serial example sketch is inside the library but not on the wiki, please download the library and load the sketch if you are not doing so already. or copy from this one:
[code]
// # Connection:
// # Pin12 (Arduino) -> Pin 1 VCC (URM V3.2)
// # GND (Arduino) -> Pin 2 GND (URM V3.2)
// # Pin 0 (Arduino) -> Pin 9 TXD (URM V3.2)
// # Pin 1 (Arduino) -> Pin 8 RXD (URM V3.2)
// #
int URPower = 12; // Ultrasound power pin
int val = 0;
int USValue = 0;
int timecount = 0; // Echo counter
boolean flag=true;
uint8_t DMcmd[4] = {
0x22, 0x00, 0x00, 0x22}; //distance measure command
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
Serial.println("Init the sensor");
pinMode(URPower, OUTPUT);
digitalWrite(URPower, HIGH); // Set to High
delay(200); //Give sensor some time to start up --Added By crystal from Singapo, Thanks Crystal.
}
void loop()
{
flag = true;
//Sending distance measure command : 0x22, 0x00, 0x00, 0x22 ;
for(int i=0;i<4;i++)
{
Serial.write(DMcmd[i]);
}
delay(40); //delay for 75 ms
unsigned long timer = millis();
while(millis() - timer < 30)
{
if(Serial.available()>0)
{
int header=Serial.read(); //0x22
int highbyte=Serial.read();
int lowbyte=Serial.read();
int sum=Serial.read();//sum
if(header == 0x22){
if(highbyte==255)
{
USValue=65525; //if highbyte =255 , the reading is invalid.
}
else
{
USValue = highbyte*255+lowbyte;
}
Serial.print("Distance=");
Serial.println(USValue);
flag=false;
}
else{
while(Serial.available()) byte bufferClear = Serial.read();
break;
}
}
}
delay(20);
}
[/code]
[quote]
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
[/quote]
This will not work if you have something connected to Rx Tx pins from Arduino. It blocks communcation with Arduino. So you have to unplug it when you want to upload.

2013-07-13 03:28:42 [quote="Jose"]
Hi Miguel,
Did you connect pin 1 and pin 2 as well ?
Make sure there is a green LED on the back turned on
Cheers
[/quote]
Hi Jose,
In terms of connections, I did the following tests:
Arduino: Arduino MEGA2560 (IDE 1.0.5)
Sensor: URM37 V3.2 (the green led on the back of the board is constantly on), TTL Mode and only 4 pins connected: pin 9 (TX), 8 (RX), 2 (GND) and 1 (VCC).
First experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 6
Sensor's pin 8 connected to pin 7
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(6,7,9600);
The output of the "urm.requestMeasurementOrTimeout(DISTANCE, value)" is always TIMEOUT.
------------------------------------------------------------------------------------------------------------------------
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
------------------------------------------------------------------------------------------------------------------------
Third Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 2
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(2,1,9600);
The output of the "urm.requestMeasurementOrTimeout(DISTANCE, value)" is always TIMEOUT.
------------------------------------------------------------------------------------------------------------------------
I hope you find the problem through this description.
Best regards,
Miguel
Portugal
Hi Miguel,
Did you connect pin 1 and pin 2 as well ?
Make sure there is a green LED on the back turned on
Cheers
[/quote]
Hi Jose,
In terms of connections, I did the following tests:
Arduino: Arduino MEGA2560 (IDE 1.0.5)
Sensor: URM37 V3.2 (the green led on the back of the board is constantly on), TTL Mode and only 4 pins connected: pin 9 (TX), 8 (RX), 2 (GND) and 1 (VCC).
First experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 6
Sensor's pin 8 connected to pin 7
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(6,7,9600);
The output of the "urm.requestMeasurementOrTimeout(DISTANCE, value)" is always TIMEOUT.
------------------------------------------------------------------------------------------------------------------------
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
------------------------------------------------------------------------------------------------------------------------
Third Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 2
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(2,1,9600);
The output of the "urm.requestMeasurementOrTimeout(DISTANCE, value)" is always TIMEOUT.
------------------------------------------------------------------------------------------------------------------------
I hope you find the problem through this description.
Best regards,
Miguel

2013-07-13 03:28:42 [quote="Jose"]
Hi Miguel,
Did you connect pin 1 and pin 2 as well ?
Make sure there is a green LED on the back turned on
Cheers
[/quote]
Hi Jose,
In terms of connections, I did the following tests:
Arduino: Arduino MEGA2560 (IDE 1.0.5)
Sensor: URM37 V3.2 (the green led on the back of the board is constantly on), TTL Mode and only 4 pins connected: pin 9 (TX), 8 (RX), 2 (GND) and 1 (VCC).
First experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 6
Sensor's pin 8 connected to pin 7
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(6,7,9600);
The output of the "urm.requestMeasurementOrTimeout(DISTANCE, value)" is always TIMEOUT.
------------------------------------------------------------------------------------------------------------------------
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
------------------------------------------------------------------------------------------------------------------------
Third Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 2
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(2,1,9600);
The output of the "urm.requestMeasurementOrTimeout(DISTANCE, value)" is always TIMEOUT.
------------------------------------------------------------------------------------------------------------------------
I hope you find the problem through this description.
Best regards,
Miguel
Portugal
Hi Miguel,
Did you connect pin 1 and pin 2 as well ?
Make sure there is a green LED on the back turned on
Cheers
[/quote]
Hi Jose,
In terms of connections, I did the following tests:
Arduino: Arduino MEGA2560 (IDE 1.0.5)
Sensor: URM37 V3.2 (the green led on the back of the board is constantly on), TTL Mode and only 4 pins connected: pin 9 (TX), 8 (RX), 2 (GND) and 1 (VCC).
First experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 6
Sensor's pin 8 connected to pin 7
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(6,7,9600);
The output of the "urm.requestMeasurementOrTimeout(DISTANCE, value)" is always TIMEOUT.
------------------------------------------------------------------------------------------------------------------------
Second Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 0
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(0,1,9600);
When I try to upload the code, I always get a timeout communicating with the programmer. Therefore, the code is not uploaded.
------------------------------------------------------------------------------------------------------------------------
Third Experience:
------------------------------------------------------------------------------------------------------------------------
Sensor's pin 9 connected to pin 2
Sensor's pin 8 connected to pin 1
Sensor's pin 1 connected to +5v
Sensor's pin 2 connected to gnd
code: urm.begin(2,1,9600);
The output of the "urm.requestMeasurementOrTimeout(DISTANCE, value)" is always TIMEOUT.
------------------------------------------------------------------------------------------------------------------------
I hope you find the problem through this description.
Best regards,
Miguel

2013-07-11 03:34:39 Hi Miguel,
Did you connect pin 1 and pin 2 as well ?
Make sure there is a green LED on the back turned on
Cheers
Jose
Did you connect pin 1 and pin 2 as well ?
Make sure there is a green LED on the back turned on
Cheers

2013-07-11 03:34:39 Hi Miguel,
Did you connect pin 1 and pin 2 as well ?
Make sure there is a green LED on the back turned on
Cheers
Jose
Did you connect pin 1 and pin 2 as well ?
Make sure there is a green LED on the back turned on
Cheers

2013-07-11 02:52:29 Hi everyone,
I have just bought a URM37 V3.2 sensor but unfortunately it is not working. The context is the following one:
Arduino MEGA 2560
Sensor URM37 V3.2 (TTL mode). Pin 9 connected to pin 6 of Arduino. Pin 8 connected to pin 7 of Arduino
The code I am using is the one provided by DFROBOT (I did not change it, just copy and paste):
/*
DistanceBySoftwareSerial.pde - URM 37 Control Library Version 2.0.0
Author: Miles Burton, [email protected]
Copyright (c) 2009 Miles Burton All Rights Reserved
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or dfrobot FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// # This library is a improvement version of URM 37 Control Library Version 2.0.0 from Miles Burton
// # Original Author: Miles Burton, [email protected]
// #
// # Editor : Lauren from DFRobot
// # Date : 08.05.2012
// # Product name: URM V3.2 ultrasonic sensor TTL connection with Arduino
// # Product SKU : SEN0001
// # Version : 1.0
// # Update the library to make it compatible with the Arduino IDE 1.0 or the latest version
// # Description:
// # The sketch for using the URM37 from DFRobot based on the Software Serial library
// # You could drive the URM37 with 2 digital pins on your Arduino board, and it works stable.
// # Connection:
// # VCC (Arduino) -> Pin 1 VCC (URM37 V3.2)
// # GND (Arduino) -> Pin 2 GND (URM37 V3.2)
// # Pin 6 (Arduino) -> Pin 9 TXD (URM37 V3.2)
// # Pin 7 (Arduino) -> Pin 8 RXD (URM37 V3.2)
// #
#include "URMSerial.h"
// The measurement we're taking
#define DISTANCE 1
#define TEMPERATURE 2
#define ERROR 3
#define NOTREADY 4
#define TIMEOUT 5
URMSerial urm;
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
urm.begin(6,7,9600); // RX Pin, TX Pin, Baud Rate
Serial.println("URM37 Library by Miles Burton"); // Shameless plug
}
void loop()
{
Serial.print("Measurement: ");
delay(2000);
Serial.println(getMeasurement()); // Output measurement
}
int value; // This value will be populated
int getMeasurement()
{
// Request a distance reading from the URM37
switch(urm.requestMeasurementOrTimeout(DISTANCE, value)) // Find out the type of request
{
case DISTANCE: // Double check the reading we recieve is of DISTANCE type
// Serial.println(value); // Fetch the distance in centimeters from the URM37
return value;
break;
case TEMPERATURE:
return value;
break;
case ERROR:
Serial.println("Error");
break;
case NOTREADY:
Serial.println("Not Ready");
break;
case TIMEOUT:
Serial.println("Timeout");
break;
}
return -1;
}
The output is always the same: TIMEOUT. So basically, I get no value.
Can anyone help on this issue?
Best regards,
Miguel
Portugal
I have just bought a URM37 V3.2 sensor but unfortunately it is not working. The context is the following one:
Arduino MEGA 2560
Sensor URM37 V3.2 (TTL mode). Pin 9 connected to pin 6 of Arduino. Pin 8 connected to pin 7 of Arduino
The code I am using is the one provided by DFROBOT (I did not change it, just copy and paste):
/*
DistanceBySoftwareSerial.pde - URM 37 Control Library Version 2.0.0
Author: Miles Burton, [email protected]
Copyright (c) 2009 Miles Burton All Rights Reserved
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or dfrobot FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// # This library is a improvement version of URM 37 Control Library Version 2.0.0 from Miles Burton
// # Original Author: Miles Burton, [email protected]
// #
// # Editor : Lauren from DFRobot
// # Date : 08.05.2012
// # Product name: URM V3.2 ultrasonic sensor TTL connection with Arduino
// # Product SKU : SEN0001
// # Version : 1.0
// # Update the library to make it compatible with the Arduino IDE 1.0 or the latest version
// # Description:
// # The sketch for using the URM37 from DFRobot based on the Software Serial library
// # You could drive the URM37 with 2 digital pins on your Arduino board, and it works stable.
// # Connection:
// # VCC (Arduino) -> Pin 1 VCC (URM37 V3.2)
// # GND (Arduino) -> Pin 2 GND (URM37 V3.2)
// # Pin 6 (Arduino) -> Pin 9 TXD (URM37 V3.2)
// # Pin 7 (Arduino) -> Pin 8 RXD (URM37 V3.2)
// #
#include "URMSerial.h"
// The measurement we're taking
#define DISTANCE 1
#define TEMPERATURE 2
#define ERROR 3
#define NOTREADY 4
#define TIMEOUT 5
URMSerial urm;
void setup() {
Serial.begin(9600); // Sets the baud rate to 9600
urm.begin(6,7,9600); // RX Pin, TX Pin, Baud Rate
Serial.println("URM37 Library by Miles Burton"); // Shameless plug
}
void loop()
{
Serial.print("Measurement: ");
delay(2000);
Serial.println(getMeasurement()); // Output measurement
}
int value; // This value will be populated
int getMeasurement()
{
// Request a distance reading from the URM37
switch(urm.requestMeasurementOrTimeout(DISTANCE, value)) // Find out the type of request
{
case DISTANCE: // Double check the reading we recieve is of DISTANCE type
// Serial.println(value); // Fetch the distance in centimeters from the URM37
return value;
break;
case TEMPERATURE:
return value;
break;
case ERROR:
Serial.println("Error");
break;
case NOTREADY:
Serial.println("Not Ready");
break;
case TIMEOUT:
Serial.println("Timeout");
break;
}
return -1;
}
The output is always the same: TIMEOUT. So basically, I get no value.
Can anyone help on this issue?
Best regards,
Miguel
