Connecting the SRF08 Sonar Module to the Dios Mini Ultra

Introduction
The SRF08 modules use the I2C bus for
communication. This example shows how to connect an SRF08 to the Dios Mini
Ultra. It is expandable to up 16 SRF08's on the I2C bus. The SDA (data) and SCL (clock) lines are connected to
pins Port0 and Port1 on the Dios.
Circuit Schematic for connecting the SRF08 Sonar Module to the Dios Mini Ultra
The schematic above shows 4k7 pull-up resistors on the SCL and SDA lines to Vdd. For greater noise immunity,1k8 resistors could be used.
Displaying Light Sensor and Range readings in a PC Debug window
The following sample code will display the SRF08 software version, light sensor
reading and the 1st range reading in a Debug window on the PC
.
The sample code below can be downloaded here.
'Example program to control SRF08 func main() const sda 0 const scl 1 const SRF08_1 $E0 ' default SRF08 I2C bus address const Ver_reg 0 ' SRF08 register addresses const Light_reg 1 ' SRF08 Light sensor register const Range_reg 2 ' SRF08 1st Range register dim Ver, Light, Range loop: I2cout(sda,scl,SRF08_1,0,81) Ver = I2cin(sda,scl,SRF08_1, Ver_reg) Light = I2cin(sda,scl,SRF08_1, Light_reg) Range.byte(1) = I2cin(sda,scl,SRF08_1,Range_reg) ' high byte Range.byte(0) = I2cin(sda,scl,SRF08_1,Range_reg+1) ' low byte print "Version ", Ver, ", Light ", Light, ", Range ",Range,"cm" goto loop endfunc include \lib\DiosI2c.lib |
You can find more information on the SRF08 here