Connecting the SRF08 Sonar Module to the PICAXE-28x

Introduction
The SRF08 modules uses the I2C bus for communication. This example shows how to
connect the SRF08 to the PICAXE-28x. The SDA (data) and SCL (clock) lines are
connected to pins Input4 (pin15) and Input3 (pin14) on the PICAXE chip. These
are the pins used by the PICAXE-28x for the I2CIN and I2COUT commands. The
photograph above shows the SRF08 wired up on the PICAXE Experimenter Board.
Circuit Schematic for connecting the SRF08 Sonar Module to the PICAXE-28x

The schematic above shows 4k7 pull-up resistors on the SCL and SDA lines to Vdd. For greater noise immunity, I recommend pulling up using 1k8 resistors.
Changing the SRF08 I2C Address
Before you can use the multiple SRF08's you will need to re-program at least one
of the I2C addresses from the default address of 0xE0 they are supplied with.
The simple program below will do this. Make sure you only have one SRF08
connected when you do this. You only have to change the NEW_ADDRESS constant in
the program below to the address you want. For example if you want the SRF08 to
be at hex address 0xEC, then change NEW_ADDRESS to read;
symbol NEW_ADDRESS = $EC
' Place new address for SRF08 here
Now download the program to the PICAXE, you will see rapid brief flashes on the
Red Led on the SRF08 indicating that the change of address was successful and
the range displayed on the debug screen. It is wise to make a note of the new
address on the SRF08 itself. The following program can be downloaded here.
'*********************************************************** '** ** '** SRF08 Demonstration Software for the PICAXE-28x ** '** showing how to change the SRF08 I2C address ** '** ** '** Copyright 2003 - Devantech Ltd ** '** Commercial use of this software is prohibited ** '** Private and educational use only is permitted ** '** ** '** Written by Gerald Coe - May 2003 ** '** ** '*********************************************************** ' NEW_ADDRESS can be set to any of E0, E2, E4,
E6, E8, EA, EC, EE main: ' now show range reading to prove address change
is OK |
Displaying Light Sensor and Range readings on a PC Debug window
The following sample code will display the software revision, light sensor
reading and the 1st range reading for the SRF08 in a Debug window on the PC.
The code below can be downloaded here.
'*********************************************************** '** ** '** SRF08 Demonstration Software for the PICAXE-28x ** '** ** '** Copyright 2003 - Devantech Ltd ** '** Commercial use of this software is prohibited ** '** Private and educational use only is permitted ** '** ** '** Written by Gerald Coe - May 2003 ** '** ** '*********************************************************** main: i2cslave $E0,i2cfast,i2cbyte ' Define i2c slave address for the SRF08 loop: debug
w0
' Display Software Revision goto loop |
You can find more information on the SRF08 here and the PICAXE here