SRF08 Max Analogue Gain

Can somebody please explain what does it mean by Max Analogue Gain, how does it work in SRF08 and how do you decide which of it to use? Help.

Much appreciated!

Hi,
To get answers about specs you need to post the spec or a link.

http://www.robot-electronics.co.uk/htm/srf08tech.shtml

The maximum analog gain refers to the gain of the ultrasonic receiver.
It is chosen to help stop stray reflections from previous pings from begin detected.

As the time from the ping transmit increases, the receiver automatically becomes more and more sensitive (gain goes up), as the the longer time for the return echo will mean it will be weaker to detect.

If you are getting spurious measurements from the detector, it may be from objects way in the background of the object you are aiming to detect, these returns will however be a lot weaker than expected.

You can, by adjusting the Max Gain for your application, if you have false readings, to lower the gain and make the receiver not detect the weaker signal.

I hope that makes sense.

Tom..... :slight_smile:

TomGeorge:
You can, by adjusting the Max Gain for your application, if you have false readings, to lower the gain and make the receiver not detect the weaker signal.

I hope that makes sense.

Tom..... :slight_smile:

But how to adjust the Max Gain in my coding? Do i have to add a few more coding or change anything?
Here's the attached code:

#include <Wire.h>

byte highByte = 0x00;
byte lowByte = 0x00;

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

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.write(byte(0x00));      // sets register pointer to the command register (0x00)  
  Wire.write(byte(0x51));      // command sensor to measure in "inches" (0x50) 
                               // use 0x51 for centimeters
                               // 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.write(byte(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
  {
    highByte = Wire.read();  // receive high byte (overwrites previous reading)
                             
    lowByte = Wire.read(); // receive low byte as lower 8 bits
    reading = (highByte << 8) + lowByte;
    Serial.println(reading);   // print the reading
  }

  delay(250);                  // wait a bit since people have to read the output :)
}