Recent Changes - Search:

Home

edit SideBar

SRF-02

The SRF-02  is a compact ultrasonic range finder. We have two of them mounted on the mast of our robot. They are functionally equivalent to the SRF-10.

The SRF-02 can be operated from a standard 9600 baud serial line or, as in our case, an I2C bus. To use serial mode, you must connect the mode pin to ground, for I2C operation leave it unconnected.

I2C Address

The default address of the SRF-02 unit is 0xE0. This is a problem if you are using more than one unit on the same I2C bus as there will be collisions on the bus, so it is necessary to give each unit its own unique address. The address can be changed by writing a series of values to location 0x00. The following must be sent consecutively in order, followed by the address you wish to use: 0xA0 0xAA 0xA5 [address] where [address] is an even address from 0xE0 to 0xFE. Keep in mind that the address must be even, as the least significant bit is dropped when addressing on the I2C bus.

We use addresses 0xE0 and 0xE4 for our SRF-02 units, and 0xE2 for our SRF-10.

The address you assign the unit will be stored internally unless you change it again, so you only have to do it once.

Getting a Reading

To initiate a sonar reading, you must write to the device at location 0x00 with the desired reading. The SRF-02 can provide results in inches, centimeters, or the duration of the ping in milliseconds should you choose to do your own calibration. This might be beneficial if you are working in extreme temperatures where the speed of sound varies through the air. The value you write to 0x00 determines what unit the result will have:

  • 0x50 - inches
  • 0x51 - centimeters
  • 0x52 - milliseconds

You must wait for at least 65 milliseconds before attempting to read the results. During this time, the unit will respond with 0xFF until the ranging is completed. The results of the ranging will be stored in registers 2 and 3 for the high byte and low byte respectively. You can easily put these two values together to get the complete reading using a bit shift and ORing the two together, as so:

int result = ( dataByteHigh << 8 ) | dataByteLow;

Beam Pattern/FoV

The beam pattern of the SRF-02 is not documented, but we found it to be a conical shape extending outward with a radius of ~15 degrees. The minimum ranging distance is documented to be between 6 and 11 cm or so, but this is irrelevant in our setup as they are mounted that far back on the robot (IE: It will be physically hitting a wall before we get a reading like that!)

Edit - History - Print - Recent Changes - Search
Page last modified on April 21, 2008, at 06:49 PM EST