SRF08 ranger on Arduino

330 views
Skip to first unread message

KM6VV

unread,
Mar 29, 2013, 9:27:46 PM3/29/13
to hbrob...@googlegroups.com
I've got a single SRF08 ranger running on the supplied 0xF8 address, but
I can't get it to work on the other addresses (I need several sensors).
I have verified the ranger to be addressed to 0xE8, but the ranger does
not reply to either the programmed address 0xE8, or the +4 address the
author uses for subsequent calls.

The author suggests:

New_Address += 4; // offset address not sure why this is but it works
for this address

http://www.ros.org/wiki/rosserial_arduino/Tutorials/SRF08%20Ultrasonic%20Range%20Finder

I have implemented a multi-ranger program in the past (on a 2620 PIC),
and I didn't need to do any "+4" trick to get it working. It also worked
on all six addresses. I have not yet "ported" my my code to the Atmel (I
wanted to use the Sonar_srf08 library).

There is a newer version of the library, but it's essentially the same,
just added gain and range parameters to several wire.writes.

http://playground.arduino.cc/Main/SonarSrf08

Any ideas or fixes?

Thanks, Alan

George Campbell

unread,
Mar 30, 2013, 12:10:40 PM3/30/13
to hbrob...@googlegroups.com
I didn't like that one so I wrote my own and I was able to use it to change the I2C addresses. If you uncomment the SRF08_DEBUG at the top of the .cpp file it will print gobs of debugging info.

SRF08.cpp
SRF08.h

KM6VV

unread,
Mar 30, 2013, 1:01:44 PM3/30/13
to hbrob...@googlegroups.com
Hi George,

Thanks a lot!

Late last night I figured out the problem with the SonarSRF08 library,
the author forgot to shift the address down 1. That sends the right
values to Wire.rite, and also eliminates the +4 hack to the calling
code. I wonder how it ever ran.

I'm now able to cycle through my three sonar modules quite nicely.

Alan KM6VV

On 3/30/2013 9:10 AM, George Campbell wrote:
> I didn't like that one so I wrote my own and I was able to use it to change the I2C addresses. If you uncomment the SRF08_DEBUG at the top of the .cpp file it will print gobs of debugging info.
>
>
Reply all
Reply to author
Forward
0 new messages