Connecting the SRF08 Sonar Module to the OOPic-R

Introduction
The SRF08 modules use the I2C bus for
communication. This example shows how to connect the SRF08 to the OOPic-R,
however it is expandable to up 16 SRF08's on the I2C bus. The SCL (clock) and SDA (data) lines are connected to the OOPic
LSCL and LSDA - the OOPic Local I2C bus. The OOPic is able to power two
SRF08's. If you want to use more
then you will need to use the separate 5v supply available on the OOPic-R Do not connect the
SRF08 to the OOPic
connectors labeled I2C, this is the OOPic network connector and is not used
by the oI2C object.
Circuit Schematic for connecting the SRF08 Sonar Module to the OOPic-R
Changing the SRF08 I2C Address
You only need to do this if you want a different address from the default
0xE0 the unit is supplied with. If you are using more than one SRF08, then you
will need to make sure they are all programmed to different addresses. The SRF08
to OOPic page shows how to connect two SRF08's to the original OOPic and
reprogram their addresses. The principle is the same for the OOPic-R. The
example below assumes you are using the default 0xE0 address.
Reading the Light Sensor and Range Registers
The following program shows how to read the version, light sensor and range
registers. With the OOPic-R running, these can be viewed by double clicking the
on-screen object symbols in the OOPic compiler debug window.
The sample code below can be downloaded here.
|
'** I2C Routines for OOPic-R ** '** with the SRF08 Ultrasonic Ranger Modules ** '** ** '** Copyright 2003 - Devantech Ltd ** '** Commercial use of this software is prohibited ** '** Private and educational use only is permitted ** '** ** '** Written by Gerald Coe - January 2003 ** '** ** '*********************************************************** '** ** '** To view the Version, Light Sensor or Range Values ** '** Double click the object in the Debug Panel ** '** ** '*********************************************************** Dim SRF08 As New oI2C ' Create the SRF08
object Sub main() SRF08.Location = 1 ' Light
Sensor Register SRF08.Width = cv16bit ' 2 byte wide transfer |
You can find more information on the SRF08 here