SRF02 address problem

General & specific discussions on our Ultrasonic Rangers

Moderator: chris

SRF02 address problem

Postby pangalou » Thu Nov 03, 2011 10:07 am

Hi,

I have 4 SRF02 and they are being given different address respectively. After several successful tries of getting the range of the different addresses of SRF02, i plug out my usb connection from the Arduino and replug it back. After that, 2 of my SRF02 changed back to its default (factory) addresses. May I know what wrong with it? The other 2 SRF02 are perfectly fine and do not change their address automatically, while the 2 problemetic ones are the ones who keep resetting their addresses. My connections of the SRF02 are basicly I2c connection, with all the SDAs of the SRF connected to the SDA of the Arduino and same with the SCL. I provide 1.8kohm resistors for both ports like what was recommended.

Thank you
pangalou
 
Posts: 5
Joined: Thu Nov 03, 2011 9:57 am

Re: SRF02 address problem

Postby Gerry » Thu Nov 03, 2011 11:27 am

This sounds like a power switching problem.
The I2C address in the SRF02 is stored in EEPROM and it is going to take quite a voltage spike to do this.

How was the arduino powered when it happened. Was it just the USB or was there a separate power supply as well. Also how are the SRF02's powered, from the Arduino or a separate supply?
User avatar
Gerry
Site Admin
 
Posts: 245
Joined: Wed Nov 08, 2006 12:28 pm

Re: SRF02 address problem

Postby pangalou » Thu Nov 03, 2011 12:21 pm

The Arduino is powered through usb from my computer, and from there i read my serial print of the distance that is range from it. All 4 SRF02 are powered from the 5V and grounded from the Arduino directly. But if it is a voltage spike like you mentioned happens, wouldn't it be all my 4 SRF02 are resetted together? Instead of just the obvious 2 SRF02 that keep resetting?

Thanks for the reply btw.
pangalou
 
Posts: 5
Joined: Thu Nov 03, 2011 9:57 am

Re: SRF02 address problem

Postby chris » Fri Nov 04, 2011 11:47 am

Can you post the code that is running on the Arduino? Is it possible that a section of code is being executed that deal with the Address setting?
User avatar
chris
 
Posts: 172
Joined: Wed Nov 08, 2006 3:13 pm
Location: Norfolk, England

Re: SRF02 address problem

Postby pangalou » Fri Nov 04, 2011 12:10 pm

It is just completely same from http://www.grapelabs.org/arduino/librar ... sensor,but i just add 2 more sonar and i am using the library from it. even that i dont use the library, and i use the normal method from the arduino tutorial on srfrange, it still give me the same results. the 0x70 at the below code is just to see whether my sonars' addresses has been defaulted.

#include "Wire.h"
#include "SRF02.h"

SRF02 srf02[5] = {
SRF02(0x72, SRF02_CENTIMETERS),
SRF02(0x74, SRF02_CENTIMETERS),
SRF02(0x76, SRF02_CENTIMETERS),
SRF02(0x78, SRF02_CENTIMETERS),
SRF02(0x70, SRF02_CENTIMETERS)
};

unsigned long nextPrint = 0;

void setup() {
Serial.begin(9600);
Wire.begin();
SRF02::setInterval(500);
}

void loop() {
while (true) {
SRF02::update();
if (millis() > nextPrint) {
Serial.print(srf02[0].read());
Serial.print(",");
Serial.print(srf02[1].read());
Serial.print(",");
Serial.print(srf02[2].read());
Serial.print(",");
Serial.print(srf02[3].read());
Serial.print(",");
Serial.print(srf02[4].read());
Serial.println();
nextPrint = millis () + 1000;
}
}
}
pangalou
 
Posts: 5
Joined: Thu Nov 03, 2011 9:57 am

Re: SRF02 address problem

Postby Gerry » Mon Nov 07, 2011 12:12 pm

Do you have SRF02::configureDeviceId() still with in the code somewhere?
Just wondering if its getting called briefly if the arduino runs wild during power cuts.

Also what firmware version is in the SRF02s that fail, is it the same as the other two?
User avatar
Gerry
Site Admin
 
Posts: 245
Joined: Wed Nov 08, 2006 12:28 pm

Re: SRF02 address problem

Postby pangalou » Mon Nov 07, 2011 1:37 pm

Gerry wrote:Do you have SRF02::configureDeviceId() still with in the code somewhere?
Just wondering if its getting called briefly if the arduino runs wild during power cuts.


No,i replaced the configure code with the above code every time, even that i still have the configure code, it wont change the address since the address of the SRF has changed and will not obey the configure commands since it used for the previous address before setting.

Gerry wrote:Also what firmware version is in the SRF02s that fail, is it the same as the other two?


What do you mean by firmware version? I configure all of my SRF using the same configure command, just replace them with different addresses.....

Thank you
pangalou
 
Posts: 5
Joined: Thu Nov 03, 2011 9:57 am

Re: SRF02 address problem

Postby Gerry » Mon Nov 07, 2011 3:32 pm

Hi,
The software (or firmware) revision is in register 0. What do you get when you read that?
User avatar
Gerry
Site Admin
 
Posts: 245
Joined: Wed Nov 08, 2006 12:28 pm

Re: SRF02 address problem

Postby pangalou » Mon Nov 07, 2011 7:06 pm

Gerry wrote:Hi,
The software (or firmware) revision is in register 0. What do you get when you read that?



Hi,

All the sensors give me value '5' including the problemetic one.
pangalou
 
Posts: 5
Joined: Thu Nov 03, 2011 9:57 am

Re: SRF02 address problem

Postby Gerry » Tue Nov 08, 2011 10:39 am

Thanks, I have a new version I would like you to try.
Please contact support11@robot-electronics.co.uk
User avatar
Gerry
Site Admin
 
Posts: 245
Joined: Wed Nov 08, 2006 12:28 pm


Return to Ultrasonic Sensors

Who is online

Users browsing this forum: No registered users and 0 guests

cron