SRF08 Issue

Hi

I am running a test project with SRF08 library.. the sensor works but never seems to return a distance great that 1.2-1.6 M
I have set the gain register to 0x31 and the location register to 0x8C but that has made no difference.

Has anyone got any ideas?

Many Thanks

Mike

#include <SonarSRF.h>
#include <SonarSRF02.h>
#include <SonarSRF08.h>
#include <Wire.h>

#define MAIN_08_ADDRESS (0x70)
SonarSRF08 MainSonar;

// Setup Analogue Gain
// http://www.robot-electronics.co.uk/htm/srf08tech.html section "Analogue Gain"
#define GAIN_REGISTER 0x31
// Setup Range Location
// http://www.robot-electronics.co.uk/htm/srf08tech.html section "Changing the Range"
#define LOCATION_REGISTER 0x8C

char unit = 'c'; // 'i' for inches, 'c' for centimeters, 'm' for micro-seconds

void setup() {
    Serial.begin(9600);

    MainSonar.connect(MAIN_08_ADDRESS, GAIN_REGISTER, LOCATION_REGISTER);
//    isConnected("SRF08", MainSonar.getSoft());
}

void loop() {
    float sensorReading = 0;
    sensorReading = MainSonar.getRange(unit);
    distance("sensor", sensorReading);
}

// Print out distance
void distance(String reference, int sensorReading) {
    Serial.print("Distance from " + reference + ": ");
    Serial.print(sensorReading);
    Serial.println(unit);
}

// Print out distance
void isConnected(String reference, int sensorSoft) {
    if (sensorSoft >= 0)
    {
        Serial.print("Sensor " + reference + " connected (");
        Serial.print(sensorSoft);
        Serial.println(")");
    }
    else
    {
        Serial.println("Sensor " + reference + " not detected");
    }
}

can you post a link to the datasheet and the library?

SRF08 Ultra sonic range finder

Did you read the instructions ? There is some change to the timing you can make which optimises the response time for different ranges.

But real world experience tends to suggest that you won't get much better than 1.5 to 2 metres anyway.

Hi

Yeah I believe I have a suitable timer in place to allow the range find to work to the maximum range.

Has anyone else experienced range problems? Whats the point of an SRF08 if it has no more range than say the SRF02 etc?

Regards

Mike