Forum >Freeduino + URM04 + IO Expansion Shield For Arduino(V5) - not working
ArduinoGeneral

Freeduino + URM04 + IO Expansion Shield For Arduino(V5) - not working

userHead rxcoder 2012-02-07 14:13:25 54496 Views59 Replies
Hello. Sorry for bad English (I know its bad)

I have a question (I'm a novice) how to connect "URM04 V2.0 Ultrasonic sensor" to the board Freeduino. I connect, and then run the sketch of an example and nothing works.
Describe step by step the actions.
1. 1. connect to the board Freeduino (Duemilanove) shield "[url=http://www.dfrobot.com/index.php?route=product/product&filter_name=IO%20Expansion%20Shield&page=5&product_id=264]IO Expansion Shield For Arduino (V5)[/url]"
2. set jumpers to rs485.
3. connect "[url=http://www.dfrobot.com/index.php?route=product/product&filter_name=URM04%20V2.0%20Ultrasonic%20sensor&product_id=101]URM04 V2.0 Ultrasonic sensor[/url]"
4. set the sketch and watch the process through the "Serial Monitor" program Arduino. Sketch loaded from Manual and my sketch(at the end of message), who tries to start measuring and then read distance.

at that time:
- When connecting URM04 blinks 4 times the LED (this is good)
- In the "Serial Monitor" I see that URM04 not responding to commands.

a feeling that there is no data transfer over RS485. How can I test the port?


my sketch for testing:
[code]
#include <Metro.h>

Metro TriggerMetro = Metro(2000,true);
Metro distanceMetro = Metro(200);


int EN = 2;

byte cmd[7];
byte address = 0x12;
boolean start = true;

void setup()
{
pinMode(EN, OUTPUT);
Serial.begin(19200);
}

void loop()
{
if(TriggerMetro.check()==1)
{
if(start){// send a command to a different address
start=false;
digitalWrite(EN, HIGH);
for(int j= 0x11;j<0x18;j++){
address=j;
trigger();
}
digitalWrite(EN, LOW);
}
}
if((distanceMetro.check()==1) && (!start))
{
digitalWrite(EN, HIGH);
for(int j= 0x11;j<0x18;j++){
address=j;
getDistance();
}

digitalWrite(EN, LOW);
}

if (Serial.available()){
digitalWrite(EN, LOW);
Serial.println(Serial.read());
}
}


void trigger()// begin scan
{
cmd[0]= 0x55;
cmd[1]= 0xaa;
cmd[2]= address;
cmd[3]= 0x00;
cmd[4]= 0x01;
cmd[5]= cmd[0]+cmd[1]+cmd[2]+cmd[3]+cmd[4];
for(int j=0;j<6;j++){
Serial.print(cmd[j]);
}

}


void getDistance()//
{
cmd[0]= 0x55;
cmd[1]= 0xaa;
cmd[2]= address;
cmd[3]= 0x00;
cmd[4]= 0x02;
cmd[5]= cmd[0]+cmd[1]+cmd[2]+cmd[3]+cmd[4];
for(int j=0;j<6;j++){
Serial.print(cmd[j]);
}

}
[/code]
2012-04-18 18:39:34 Hi, peter

I think it means that you didn't get the feedback from the URM04 distance sensor. The sketch should be ok. So in my view, the problem maybe caused by your hardware connection.

1. So, you could check the schematic of the Arduino IO Expansion shield v5. Then try to figure out your problem.
2. Figure out whether you trigger the sensor measuring successfully. If the sensor get the trigger command via the RS485 interface, the led on the URM04 will blink. So please check it, to help you to figure out the distinguish the reason of the issue.

Regards
Lauren
userHeadPic Lauren
2012-04-18 18:39:34 Hi, peter

I think it means that you didn't get the feedback from the URM04 distance sensor. The sketch should be ok. So in my view, the problem maybe caused by your hardware connection.

1. So, you could check the schematic of the Arduino IO Expansion shield v5. Then try to figure out your problem.
2. Figure out whether you trigger the sensor measuring successfully. If the sensor get the trigger command via the RS485 interface, the led on the URM04 will blink. So please check it, to help you to figure out the distinguish the reason of the issue.

Regards
Lauren
userHeadPic Lauren
2012-04-18 18:39:34 Hi, peter

I think it means that you didn't get the feedback from the URM04 distance sensor. The sketch should be ok. So in my view, the problem maybe caused by your hardware connection.

1. So, you could check the schematic of the Arduino IO Expansion shield v5. Then try to figure out your problem.
2. Figure out whether you trigger the sensor measuring successfully. If the sensor get the trigger command via the RS485 interface, the led on the URM04 will blink. So please check it, to help you to figure out the distinguish the reason of the issue.

Regards
Lauren
userHeadPic Lauren
2012-04-18 18:39:34 Hi, peter

I think it means that you didn't get the feedback from the URM04 distance sensor. The sketch should be ok. So in my view, the problem maybe caused by your hardware connection.

1. So, you could check the schematic of the Arduino IO Expansion shield v5. Then try to figure out your problem.
2. Figure out whether you trigger the sensor measuring successfully. If the sensor get the trigger command via the RS485 interface, the led on the URM04 will blink. So please check it, to help you to figure out the distinguish the reason of the issue.

Regards
Lauren
userHeadPic Lauren
2012-04-18 18:39:34 Hi, peter

I think it means that you didn't get the feedback from the URM04 distance sensor. The sketch should be ok. So in my view, the problem maybe caused by your hardware connection.

1. So, you could check the schematic of the Arduino IO Expansion shield v5. Then try to figure out your problem.
2. Figure out whether you trigger the sensor measuring successfully. If the sensor get the trigger command via the RS485 interface, the led on the URM04 will blink. So please check it, to help you to figure out the distinguish the reason of the issue.

Regards
Lauren
userHeadPic Lauren
2012-04-18 18:39:34 Hi, peter

I think it means that you didn't get the feedback from the URM04 distance sensor. The sketch should be ok. So in my view, the problem maybe caused by your hardware connection.

1. So, you could check the schematic of the Arduino IO Expansion shield v5. Then try to figure out your problem.
2. Figure out whether you trigger the sensor measuring successfully. If the sensor get the trigger command via the RS485 interface, the led on the URM04 will blink. So please check it, to help you to figure out the distinguish the reason of the issue.

Regards
Lauren
userHeadPic Lauren
2012-04-18 11:40:47 Hello,

i've got it running,...or something like that. I do not have the IO Expansion shield. Just wired it together on a breadboard (IC Max485 +URM04 and Mega 2560). When i uploaded rxcoders code and open the console i was getting "Distance value: 0".

Any ideas why?


Thanks
Peter
userHeadPic arduinofish
2012-04-18 11:40:47 Hello,

i've got it running,...or something like that. I do not have the IO Expansion shield. Just wired it together on a breadboard (IC Max485 +URM04 and Mega 2560). When i uploaded rxcoders code and open the console i was getting "Distance value: 0".

Any ideas why?


Thanks
Peter
userHeadPic arduinofish
2012-04-18 11:40:47 Hello,

i've got it running,...or something like that. I do not have the IO Expansion shield. Just wired it together on a breadboard (IC Max485 +URM04 and Mega 2560). When i uploaded rxcoders code and open the console i was getting "Distance value: 0".

Any ideas why?


Thanks
Peter
userHeadPic arduinofish
2012-04-18 11:40:47 Hello,

i've got it running,...or something like that. I do not have the IO Expansion shield. Just wired it together on a breadboard (IC Max485 +URM04 and Mega 2560). When i uploaded rxcoders code and open the console i was getting "Distance value: 0".

Any ideas why?


Thanks
Peter
userHeadPic arduinofish
2012-04-18 11:40:47 Hello,

i've got it running,...or something like that. I do not have the IO Expansion shield. Just wired it together on a breadboard (IC Max485 +URM04 and Mega 2560). When i uploaded rxcoders code and open the console i was getting "Distance value: 0".

Any ideas why?


Thanks
Peter
userHeadPic arduinofish
2012-04-18 11:40:47 Hello,

i've got it running,...or something like that. I do not have the IO Expansion shield. Just wired it together on a breadboard (IC Max485 +URM04 and Mega 2560). When i uploaded rxcoders code and open the console i was getting "Distance value: 0".

Any ideas why?


Thanks
Peter
userHeadPic arduinofish
2012-02-10 23:15:55 Of course take it. But the code is not completed yet, there are some shortcomings. Although suitable for testing userHeadPic rxcoder
2012-02-10 23:15:55 Of course take it. But the code is not completed yet, there are some shortcomings. Although suitable for testing userHeadPic rxcoder
2012-02-10 23:15:55 Of course take it. But the code is not completed yet, there are some shortcomings. Although suitable for testing userHeadPic rxcoder
2012-02-10 23:15:55 Of course take it. But the code is not completed yet, there are some shortcomings. Although suitable for testing userHeadPic rxcoder
2012-02-10 23:15:55 Of course take it. But the code is not completed yet, there are some shortcomings. Although suitable for testing userHeadPic rxcoder
2012-02-10 23:15:55 Of course take it. But the code is not completed yet, there are some shortcomings. Although suitable for testing userHeadPic rxcoder
2012-02-10 19:20:07 ;D

Great post, thanks for sharing.  We will post your codes to help others who would like to try this sensor.
userHeadPic Lauren
2012-02-10 19:20:07 ;D

Great post, thanks for sharing.  We will post your codes to help others who would like to try this sensor.
userHeadPic Lauren