SRF08 sonar and arduino

Hi,
really newbie in big troubles!
I'm trying to get readings from a Devantech SRF08 ultrasound sensor
connected to an Arduino using I2C/TWI
(actually I'm using digital input 0 and 1 on Arduino for the SCL and SDA: is it correct?).

I've found some code made by
Nicholas Zambetti http://www.zambetti.com and James Tichenor http://www.jamestichenor.net
but when I try to upload it to the board I always get a message saying
"Sketch too big; try deleting code, removing floats, or see (...)
Binary sketch size: 7970bytes (of a 7168 byte maximum)"
I can't delete pieces of code, maybe some lines in the "TwoWire.h" included but really don't know...

What can I do to make it work?
Can Arduino be used with this sonar or
do I have to get something else? (another sonar or another board)

Please help, I'm stuck on this!
gio

  • SRF08 code-------------------

#include <TwoWire.h>

void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(19200); // start serial communication at 19200bps
}

int reading = 0;

void loop()
{
// step 1: instruct sensor to read echoes
Wire.beginTransmission(112); // transmit to device #112 (0x70)
// the address specified in the datasheet is 224 (0xE0)
// but i2c adressing uses the high 7 bits so it's 112
Wire.send(0x00); // sets register pointer to the command register (0x00)
Wire.send(0x51); // command sensor to measure in cm (0x51)
// use 0x52 for ping microseconds
Wire.endTransmission(); // stop transmitting

// step 2: wait for readings to happen
delay(70); // datasheet suggests at least 65 milliseconds

// step 3: instruct sensor to return a particular echo reading
Wire.beginTransmission(112); // transmit to device #112
Wire.send(0x02); // sets register pointer to echo #1 register (0x02)
Wire.endTransmission(); // stop transmitting

// step 4: request reading from sensor
Wire.requestFrom(112, 2); // request 2 bytes from slave device #112

// step 5: receive reading from sensor
if(2 <= Wire.available()) // if two bytes were received
{
reading = Wire.receive(); // receive high byte (overwrites previous reading)
reading = reading << 8; // shift high byte to be high 8 bits
reading |= Wire.receive(); // receive low byte as lower 8 bits
Serial.println(reading); // print the reading
}

delay(250); // wait 250ms
}

i'll reply to myself,
you can't use srf08 with arduino,
get maxbotix ez-1 instead,
it's cheaper, got the same range and is much simpler to use (interfacing+coding)

I am too researching on ultrasonic distance measuring and came across the MaxSonar-EZ1. As of today I wasn't able to find dealers (in germany) selling the PING made by Parallax, which seem to be sold as units of 4 devices :-? but I still need to find a supplier of the EZ1 here in germany.

What did you finally do to resolve the problem concerning the size of the sketch?

Did you see this article http://itp.nyu.edu/physcomp/sensors/Reports/SRF04SonarRangerfor interfacing with the SRF?

Hi,
maybe the new arduino software release (0005 - 2006.09.06 )
can solve the problem, if the extra 1k memory
"Smaller core libraries (~4.5 KB instead of 5.5 KB)"
is enough to store the i2c code...
don't have much time to do this now, I'll let you know if I manage to make it work.
Anyway you can but the ez1 sonar from www.sparkfun.com,
if you need something already working and tested, get the ez1.
Have nice days,
ciao
gio

You may as well buy them directly from maxbotix.com, payments via PayPal or credit cards accepted. Why bother a supplier :wink:
Once I'll have enough dough for three units, I'll have a got at them too!