Product Information
170 0xAA 2nd in sequence to change I2C address
Ranging Mode
To initiate a ranging, write one of the above commands to the command register and wait
the required amount of time for completion and read as many results as you wish. The
echo buffer is cleared at the start of each ranging. The first echo range is placed in
locations 2,3. the second in 4,5, etc. If a location (high and low bytes) is 0, then there will
be no further reading in the rest of the registers. The default and recommended time for
completion of ranging is 65mS, however you can shorten this by writing to the range
register before issuing a ranging command. Light sensor data at location 1 will also have
been updated after a ranging command.
ANN Mode
ANN mode (Artificial Neural Network) is designed to provide the multi echo data in a
way that is easier to input to a neural network, at least I hope it is - I've not actually done
it yet. ANN mode provides a 32 byte buffer (locations 4 to 35 inclusive) where each byte
represents the 65536uS maximum flight time divided into 32 chunks of 2048uS each -
equivalent to about 352mm of range. If an echo is received within a bytes time slot then it
will be set to no-zero, otherwise it will be zero. So if an echo is received from within the
first 352mm, location 4 will be non-zero. If an object is detected 3m away the location 12
will be non-zero (3000/352 = 8) (8+4=12). Arranging the data like this should be better
for a neural net than the other formats. The input to your network should be 0 if the byte
is zero and 1 if its non-zero. I have a SOFM (Self Organizing Feature Map) in mind for
the neural net, but will hopefully be useful for any type.
Location 4
Location 5
Location 6
Location 7
Locations 8
- 35
0 - 352mm
353 -
705mm
706 -
1057mm
1058 -
1410mm
and so on
Locations 2,3 contain the range of the nearest object converted to inches, cm or uS and is
the same as for Ranging Mode.
Checking for Completion of Ranging
You do not have to use a timer on your own controller to wait for ranging to finish. You
can take advantage of the fact that the SRF08 will not respond to any I2C activity whilst
ranging. Therefore, if you try to read from the SRF08 (we use the software revision
number a location 0) then you will get 255 (0xFF) whilst ranging. This is because the I2C
data line (SDA) is pulled high if nothing is driving it. As soon as the ranging is complete
the SRF08 will again respond to the I2C bus, so just keep reading the register until its not
255 (0xFF) anymore. You can then read the sonar data. Your controller can take
advantage of this to perform other tasks while the SRF08 is ranging.
Changing the Range
The maximum range of the SRF08 is set by an internal timer. By default, this is 65mS or
the equivalent of 11 metres of range. This is much further than the 6 metres the SRF08 is