Subversion Repositories svnkaklik

Rev

Rev 409 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
359 kaklik 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<!-- saved from url=(0054)http://www.robot-electronics.co.uk/htm/srf08tech.shtml -->
3
<HTML><HEAD><TITLE>SRF08 Ultra sonic range finder</TITLE>
4
<META http-equiv=Content-Type content="text/html; charset=windows-1253">
5
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
6
<BODY>
7
<P align=center><B><FONT size=5>SRF08 Ultra sonic range finder </FONT><FONT 
8
size=3><BR>Technical Specification</FONT></B></P>
9
<P align=left>Communication with the SRF08 ultrasonic rangefinder is via the I2C 
10
bus. This is available on popular controllers such as the OOPic and Stamp BS2p, 
11
as well as a wide variety of micro-controllers. To the programmer the SRF08 
12
behaves in the same way as the ubiquitous 24xx series eeprom's, except that the 
13
I2C address is different. The default shipped address of the SRF08 is 0xE0. It 
14
can be changed by the user to any of 16 addresses E0, E2, E4, E6, E8, EA, EC, 
15
EE, F0, F2, F4, F6, F8, FA, FC or FE, therefore up to 16 sonar's can be used. In 
16
addition to the above addresses, all sonar's on the I2C bus will respond to 
17
address 0 - the General Broadcast address. This means that writing a ranging 
18
command to I2C address 0 (0x00) will start all sonar's ranging at the same time. 
19
This should be useful in ANN Mode (See below). The results must be read 
20
individually from each sonar's real address. We have <A 
21
href="http://www.robot-electronics.co.uk/htm/examples.shtml">examples</A> of 
22
using the SRF08 module with a wide range of popular controllers.</P>
23
<P align=left><B>Connections<BR></B>The "Do Not Connect" pin should be left 
24
unconnected. It is actually the CPU MCLR line and is used once only in our 
25
workshop to program the PIC16F872 on-board after assembly, and has an internal 
26
pull-up resistor. The SCL and SDA lines should each have a pull-up resistor to 
27
+5v somewhere on the I2C bus. You only need one pair of resistors, not a pair 
28
for every module. They are normally located with the bus master rather than the 
29
slaves. The SRF08 is always a slave - never a bus master. If you need them, I 
30
recommend 1.8k resistors. Some modules such as the OOPic already have pull-up 
31
resistors and you do not need to add any more. &nbsp;</P>
32
<P align=center><IMG height=232 
33
src="SRF08 Ultra sonic range finder_files/srf08con.jpg" width=302 border=0></P>
34
<P align=left><B>Registers</B><BR>&nbsp;The SRF08 appears as a set of 36 
35
registers.</P>
36
<DIV align=center>
37
<CENTER>
38
<TABLE cellSpacing=0 cellPadding=0 width="53%" bgColor=#ffffcc border=1>
39
  <TBODY>
40
  <TR>
41
    <TD width="24%">
42
      <P align=center>Location</P></TD>
43
    <TD width="32%">
44
      <P align=center>Read</P></TD>
45
    <TD width="44%">
46
      <P align=center>Write</P></TD></TR>
47
  <TR>
48
    <TD width="24%">
49
      <P align=center>0</P></TD>
50
    <TD width="32%">
51
      <P align=center>Software Revision</P></TD>
52
    <TD width="44%">
53
      <P align=center>Command Register</P></TD></TR>
54
  <TR>
55
    <TD width="24%">
56
      <P align=center>1</P></TD>
57
    <TD width="32%">
58
      <P align=center>Light Sensor</P></TD>
59
    <TD width="44%">
60
      <P align=center>Max Gain Register (default 31)&nbsp;</P></TD></TR>
61
  <TR>
62
    <TD width="24%">
63
      <P align=center>2</P></TD>
64
    <TD width="32%">
65
      <P align=center>1st Echo High Byte</P></TD>
66
    <TD width="44%">
67
      <P align=center>Range Register (default 255)</P></TD></TR>
68
  <TR>
69
    <TD width="24%">
70
      <P align=center>3</P></TD>
71
    <TD width="32%">
72
      <P align=center>1st Echo Low Byte</P></TD>
73
    <TD width="44%">
74
      <P align=center>N/A</P></TD></TR>
75
  <TR>
76
    <TD width="24%">
77
      <P align=center>~~~~</P></TD>
78
    <TD width="32%">
79
      <P align=center>~~~~</P></TD>
80
    <TD width="44%">
81
      <P align=center>~~~~</P></TD></TR>
82
  <TR>
83
    <TD width="24%">
84
      <P align=center>34</P></TD>
85
    <TD width="32%">
86
      <P align=center>17th Echo High Byte</P></TD>
87
    <TD width="44%">
88
      <P align=center>N/A</P></TD></TR>
89
  <TR>
90
    <TD width="24%">
91
      <P align=center>35</P></TD>
92
    <TD width="32%">
93
      <P align=center>17th Echo Low Byte</P></TD>
94
    <TD width="44%">
95
      <P align=center>N/A</P></TD></TR></TBODY></TABLE></CENTER></DIV>
96
<P align=left>Only locations 0, 1 and 2 can be written to. Location 0 is the 
97
command register and is used to start a ranging session. It cannot be read. 
98
Reading from location 0 returns the SRF08 software revision.&nbsp; By default, 
99
the ranging lasts for 65mS, but can be changed by writing to the range register 
100
at location 2. If you do so, then you will likely need to change the analogue 
101
gain by writing to location 1. See the <B>Changing Range</B> and <B>Analogue 
102
Gain</B> sections below.</P>
103
<P align=left>Location 1 is the onboard light sensor. This data is updated every 
104
time a new ranging command has completed and can be read when range data is 
105
read. The next two locations, 2 and 3, are the 16bit unsigned result from the 
106
latest ranging - high byte first. The meaning of this value depends on the 
107
command used, and is either the range in inches, or the range in cm or the 
108
flight time in uS. A value of zero indicates that no objects were detected. 
109
There are up to a further 16 results indicating echo's from more distant 
110
objects.&nbsp;</P>
111
<P align=left><B>Commands</B><BR>The are three commands to initiate a ranging 
112
(80 to 82), to return the result in inches, centimeters or microseconds. There 
113
is also an ANN mode (Artificial Neural Network) mode which is described later 
114
and a set of commands to change the I2C address.</P>
115
<DIV align=center>
116
<CENTER>
117
<TABLE cellSpacing=0 cellPadding=0 width="77%" bgColor=#ffffcc border=1>
118
  <TBODY>
119
  <TR>
120
    <TD align=middle width="34%" colSpan=2>Command</TD>
121
    <TD align=middle width="94%" rowSpan=2>Action</TD></TR>
122
  <TR>
123
    <TD align=middle width="16%">Decimal</TD>
124
    <TD align=middle width="18%">Hex</TD></TR>
125
  <TR>
126
    <TD align=middle width="16%">80</TD>
127
    <TD align=middle width="18%">0x50</TD>
128
    <TD align=left width="94%">Ranging Mode - Result in inches</TD></TR>
129
  <TR>
130
    <TD align=middle width="16%">81</TD>
131
    <TD align=middle width="18%">0x51</TD>
132
    <TD align=left width="94%">Ranging Mode - Result in centimeters</TD></TR>
133
  <TR>
134
    <TD align=middle width="16%">82</TD>
135
    <TD align=middle width="18%">0x52</TD>
136
    <TD align=left width="94%">Ranging Mode - Result in micro-seconds</TD></TR>
137
  <TR>
138
    <TD align=middle width="16%">&nbsp;</TD>
139
    <TD align=middle width="18%">&nbsp;</TD>
140
    <TD align=left width="94%">&nbsp;</TD></TR>
141
  <TR>
142
    <TD align=middle width="16%">83</TD>
143
    <TD align=middle width="18%">0x53</TD>
144
    <TD align=left width="94%">ANN Mode - Result in inches</TD></TR>
145
  <TR>
146
    <TD align=middle width="16%">84</TD>
147
    <TD align=middle width="18%">0x54</TD>
148
    <TD align=left width="94%">ANN Mode - Result in centimeters</TD></TR>
149
  <TR>
150
    <TD align=middle width="16%">85</TD>
151
    <TD align=middle width="18%">0x55</TD>
152
    <TD align=left width="94%">ANN Mode - Result in micro-seconds</TD></TR>
153
  <TR>
154
    <TD align=middle width="16%">&nbsp;</TD>
155
    <TD align=middle width="18%">&nbsp;</TD>
156
    <TD align=left width="94%">&nbsp;</TD></TR>
157
  <TR>
158
    <TD align=middle width="16%">160</TD>
159
    <TD align=middle width="18%">0xA0</TD>
160
    <TD align=left width="94%">1st in sequence to change I2C address</TD></TR>
161
  <TR>
162
    <TD align=middle width="16%">165</TD>
163
    <TD align=middle width="18%">0xA5</TD>
164
    <TD align=left width="94%">3rd in sequence to change I2C address</TD></TR>
165
  <TR>
166
    <TD align=middle width="16%">170</TD>
167
    <TD align=middle width="18%">0xAA</TD>
168
    <TD align=left width="94%">2nd in sequence to change I2C 
169
  address</TD></TR></TBODY></TABLE></CENTER></DIV>
170
<P align=left><B>Ranging Mode</B><BR>To initiate a ranging, write one of the 
171
above commands to the command register and wait the required amount of time for 
172
completion and read as many results as you wish. The echo buffer is cleared at 
173
the start of each ranging. The first echo range is placed in locations 2,3. the 
174
second in 4,5, etc. If a location (high and low bytes) is 0, then there will be 
175
no further reading in the rest of the registers. The default and recommended 
176
time for completion of ranging is 65mS, however you can shorten this by writing 
177
to the range register before issuing a ranging command. Light sensor data at 
178
location 1 will also have been updated after a ranging command.&nbsp;</P>
179
<P align=left><B>ANN Mode<BR></B>ANN mode (Artificial Neural Network) is 
180
designed to provide the multi echo data in a way that is easier to input to a 
181
neural network, at least I hope it is - I've not actually done it yet. ANN mode 
182
provides a 32 byte buffer (locations 4 to 35 inclusive) where each byte 
183
represents the 65536uS maximum flight time divided into 32 chunks of 2048uS each 
184
- equivalent to about 352mm of range. If an echo is received within a bytes time 
185
slot then it will be set to no-zero, otherwise it will be zero. So if an echo is 
186
received from within the first 352mm, location 4 will be non-zero. If an object 
187
is detected 3m away the location 12 will be non-zero (3000/352 = 8) (8+4=12). 
188
Arranging the data like this should be better for a neural net than the other 
189
formats. The input to your network should be 0 if the byte is zero and 1 if its 
190
non-zero. I have a SOFM (Self Organizing Feature Map) in mind for the neural 
191
net, but will hopefully be useful for any type. </P>
192
<DIV align=center>
193
<CENTER>
194
<TABLE cellSpacing=0 cellPadding=0 width="71%" bgColor=#ffffcc border=1>
195
  <TBODY>
196
  <TR>
197
    <TD align=middle width="20%">Location 4</TD>
198
    <TD align=middle width="20%">Location 5</TD>
199
    <TD align=middle width="20%">Location 6</TD>
200
    <TD align=middle width="20%">Location 7</TD>
201
    <TD align=middle width="20%">Locations 8 - 35</TD></TR>
202
  <TR>
203
    <TD align=middle width="20%">0 - 352mm</TD>
204
    <TD align=middle width="20%">353 - 705mm</TD>
205
    <TD align=middle width="20%">706 - 1057mm</TD>
206
    <TD align=middle width="20%">1058 - 1410mm</TD>
207
    <TD align=middle width="20%">and so on</TD></TR></TBODY></TABLE></CENTER></DIV>
208
<P align=left>Locations 2,3 contain the range of the nearest object converted to 
209
inches, cm or uS and is the same as for Ranging Mode.</P>
210
<P align=left><B>Checking for Completion of Ranging</B><BR>You do not have to 
211
use a timer on your own controller to wait for ranging to finish. You can take 
212
advantage of the fact that the SRF08 will not respond to any I2C activity whilst 
213
ranging. Therefore, if you try to read from the SRF08 (we use the software 
214
revision number a location 0) then you will get 255 (0xFF) whilst ranging. This 
215
is because the I2C data line (SDA) is pulled high if nothing is driving it. As 
216
soon as the ranging is complete the SRF08 will again respond to the I2C bus, so 
217
just keep reading the register until its not 255 (0xFF) anymore. You can then 
218
read the sonar data. Your controller can take advantage of this to perform other 
219
tasks while the SRF08 is ranging.&nbsp;</P>
220
<P align=left><B>Changing the Range</B><BR>The maximum range of the SRF08 is set 
221
by an internal timer. By default, this is 65mS or the equivalent of 11 metres of 
222
range. This is much further than the 6 metres the SRF08&nbsp; is actually 
223
capable of. It is possible to reduce the time the SRF08 listens for an echo, and 
224
hence the range, by writing to the range register at location 2. The range can 
225
be set in steps of about 43mm (0.043m or 1.68 inches) up to 11 
226
metres.&nbsp;<BR>The range is ((Range Register x 43mm) + 43mm) so setting the 
227
Range Register to 0 (0x00) gives a maximum range of 43mm. Setting the Range 
228
Register to 1 (0x01) gives a maximum range of 86mm. More usefully, 24 (0x18) 
229
gives a range of 1 metre and 140 (0x8C) is 6 metres. Setting 255 (0xFF) gives 
230
the original 11 metres (255 x 43 + 43 is 11008mm). There are two reasons you may 
231
wish to reduce the range.<BR>1. To get at the range information quicker<BR>2. To 
232
be able to fire the SRF08 at a faster rate.<BR>If you only wish to get at the 
233
range information a bit sooner and will continue to fire the SRF08 at 65ms of 
234
slower, then all will be well. However if you wish to fire the SRF08 at a faster 
235
rate than 65mS, you will definitely need to reduce the gain - see next 
236
section.<BR>The range is set to maximum every time the SRF08 is powered-up. If 
237
you need a different range, change it once as part of your system initialization 
238
code.<BR></P>
239
<P align=left><B>Analogue Gain</B><BR>The analogue gain register sets the 
240
<I>Maximum</I> gain of the analogue stages. To set the maximum gain, just write 
241
one of these values to the gain register at location 1. During a ranging, the 
242
analogue gain starts off at its minimum value of 94. This is increased at 
243
approx. 70uS intervals up to the maximum gain setting, set by register 
244
1.&nbsp;Maximum possible gain is reached after about 390mm of range. The purpose 
245
of providing a limit to the maximum gain is to allow you to fire the sonar more 
246
rapidly than 65mS. Since the ranging can be very short, a new ranging can be 
247
initiated as soon as the previous range data has been read. A potential hazard 
248
with this is that the second ranging may pick up a distant echo returning from 
249
the previous "ping", give a false result of a close by object when there is 
250
none. To reduce this possibility, the maximum gain can be reduced to limit the 
251
modules sensitivity to the weaker distant echo, whilst still able to detect 
252
close by objects. The maximum gain setting is stored only in the CPU's RAM and 
253
is initialized to maximum on power-up, so if you only want do a ranging every 
254
65mS, or longer, you can ignore the Range and Gain Registers.<BR><I><B><FONT 
255
color=#ff00ff>Note</FONT></B></I> - Effective in Ranging Mode only, in ANN mode, 
256
gain is controlled automatically.&nbsp;</P>
257
<DIV align=center>
258
<CENTER>
259
<TABLE height=714 cellSpacing=0 cellPadding=0 width=428 bgColor=#ffffcc 
260
border=1>
261
  <TBODY>
262
  <TR>
263
    <TD align=middle width=157 colSpan=2 height=19>Gain Register</TD>
264
    <TD align=middle width=265 height=40 rowSpan=2>Maximum Analogue Gain</TD></TR>
265
  <TR>
266
    <TD align=middle width=77 height=19>Decimal</TD>
267
    <TD align=middle width=80 height=19>Hex</TD></TR>
268
  <TR>
269
    <TD align=middle width=74 height=19>0</TD>
270
    <TD align=middle width=81 height=19>0x00</TD>
271
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 94</TD></TR>
272
  <TR>
273
    <TD align=middle width=74 height=19>1</TD>
274
    <TD align=middle width=81 height=19>0x01</TD>
275
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 97</TD></TR>
276
  <TR>
277
    <TD align=middle width=74 height=19>2</TD>
278
    <TD align=middle width=81 height=19>0x02</TD>
279
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
280
100</TD></TR>
281
  <TR>
282
    <TD align=middle width=74 height=19>3</TD>
283
    <TD align=middle width=81 height=19>0x03</TD>
284
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
285
103</TD></TR>
286
  <TR>
287
    <TD align=middle width=74 height=19>4</TD>
288
    <TD align=middle width=81 height=19>0x04</TD>
289
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
290
107</TD></TR>
291
  <TR>
292
    <TD align=middle width=74 height=19>5</TD>
293
    <TD align=middle width=81 height=19>0x05</TD>
294
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
295
110</TD></TR>
296
  <TR>
297
    <TD align=middle width=74 height=19>6</TD>
298
    <TD align=middle width=81 height=19>0x06</TD>
299
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
300
114</TD></TR>
301
  <TR>
302
    <TD align=middle width=74 height=19>7</TD>
303
    <TD align=middle width=81 height=19>0x07</TD>
304
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
305
118</TD></TR>
306
  <TR>
307
    <TD align=middle width=74 height=19>8</TD>
308
    <TD align=middle width=81 height=19>0x08</TD>
309
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
310
123</TD></TR>
311
  <TR>
312
    <TD align=middle width=74 height=19>9</TD>
313
    <TD align=middle width=81 height=19>0x09</TD>
314
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
315
128</TD></TR>
316
  <TR>
317
    <TD align=middle width=74 height=19>10</TD>
318
    <TD align=middle width=81 height=19>0x0A</TD>
319
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
320
133</TD></TR>
321
  <TR>
322
    <TD align=middle width=74 height=19>11</TD>
323
    <TD align=middle width=81 height=19>0x0B</TD>
324
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
325
139</TD></TR>
326
  <TR>
327
    <TD align=middle width=74 height=19>12</TD>
328
    <TD align=middle width=81 height=19>0x0C</TD>
329
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
330
145</TD></TR>
331
  <TR>
332
    <TD align=middle width=74 height=19>13</TD>
333
    <TD align=middle width=81 height=19>0x0D</TD>
334
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
335
152</TD></TR>
336
  <TR>
337
    <TD align=middle width=74 height=19>14</TD>
338
    <TD align=middle width=81 height=19>0x0E</TD>
339
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
340
159</TD></TR>
341
  <TR>
342
    <TD align=middle width=74 height=19>15</TD>
343
    <TD align=middle width=81 height=19>0x0F</TD>
344
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
345
168</TD></TR>
346
  <TR>
347
    <TD align=middle width=74 height=19>16</TD>
348
    <TD align=middle width=81 height=19>0x10</TD>
349
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
350
177</TD></TR>
351
  <TR>
352
    <TD align=middle width=74 height=19>17</TD>
353
    <TD align=middle width=81 height=19>0x11</TD>
354
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
355
187</TD></TR>
356
  <TR>
357
    <TD align=middle width=74 height=19>18</TD>
358
    <TD align=middle width=81 height=19>0x12</TD>
359
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
360
199</TD></TR>
361
  <TR>
362
    <TD align=middle width=74 height=19>19</TD>
363
    <TD align=middle width=81 height=19>0x13</TD>
364
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
365
212</TD></TR>
366
  <TR>
367
    <TD align=middle width=74 height=19>20</TD>
368
    <TD align=middle width=81 height=19>0x14</TD>
369
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
370
227</TD></TR>
371
  <TR>
372
    <TD align=middle width=74 height=19>21</TD>
373
    <TD align=middle width=81 height=19>0x15</TD>
374
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
375
245</TD></TR>
376
  <TR>
377
    <TD align=middle width=74 height=19>22</TD>
378
    <TD align=middle width=81 height=19>0x16</TD>
379
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
380
265</TD></TR>
381
  <TR>
382
    <TD align=middle width=74 height=19>23</TD>
383
    <TD align=middle width=81 height=19>0x17</TD>
384
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
385
288</TD></TR>
386
  <TR>
387
    <TD align=middle width=74 height=19>24</TD>
388
    <TD align=middle width=81 height=19>0x18</TD>
389
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
390
317</TD></TR>
391
  <TR>
392
    <TD align=middle width=74 height=19>25</TD>
393
    <TD align=middle width=81 height=19>0x18</TD>
394
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
395
352</TD></TR>
396
  <TR>
397
    <TD align=middle width=74 height=19>26</TD>
398
    <TD align=middle width=81 height=19>0x20</TD>
399
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
400
395</TD></TR>
401
  <TR>
402
    <TD align=middle width=74 height=19>27</TD>
403
    <TD align=middle width=81 height=19>0x21</TD>
404
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
405
450</TD></TR>
406
  <TR>
407
    <TD align=middle width=74 height=19>28</TD>
408
    <TD align=middle width=81 height=19>0x22</TD>
409
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
410
524</TD></TR>
411
  <TR>
412
    <TD align=middle width=74 height=19>29</TD>
413
    <TD align=middle width=81 height=19>0x23</TD>
414
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
415
626</TD></TR>
416
  <TR>
417
    <TD align=middle width=74 height=19>30</TD>
418
    <TD align=middle width=81 height=19>0x24</TD>
419
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
420
777</TD></TR>
421
  <TR>
422
    <TD align=middle width=74 height=19>31</TD>
423
    <TD align=middle width=81 height=19>0x25</TD>
424
    <TD align=middle width=265 height=19>Set Maximum Analogue Gain to 
425
  1025</TD></TR></TBODY></TABLE></CENTER></DIV>
426
<P align=left>Note that the relationship between the Gain Register setting and 
427
the actual gain is not a linear one. Also there is no magic formula to say "use 
428
this gain setting with that range setting". It depends on the size, shape and 
429
material of the object and what else is around in the room. Try playing with 
430
different settings until you get the result you want. If you appear to get false 
431
readings, it may be echo's from previous "pings", try going back to firing the 
432
SRF08 every 65mS or longer (slower).&nbsp;<BR>If you are in any doubt about the 
433
Range and Gain Registers, remember they are automatically set by the SRF08 to 
434
their default values when it is powered-up. You can ignore and forget about them 
435
and the SRF08 will work fine, detecting objects up to 6 metres away every 65mS 
436
or slower.</P>
437
<P align=left><B>Light Sensor</B><BR>The SRF08 has a light sensor on-board. A 
438
reading of the light intensity is made by the SRF08 each time a ranging takes 
439
place in either Ranging or ANN Modes ( The A/D conversion is actually done just 
440
before the "ping" whilst the +/- 10v generator is stabilizing). The reading 
441
increases as the brightness increases, so you will get a maximum value in bright 
442
light and minimum value in darkness. It should get close to 2-3 in complete 
443
darkness and up to about 248 (0xF8) in bright light. The light intensity can be 
444
read from the Light Sensor Register at&nbsp; location 1 at the same time that 
445
you are reading the range data.</P>
446
<P align=left><B>LED</B><BR>The red LED is used to flash out a code for the I2C 
447
address on power-up (see below). It also gives a brief flash during the "ping" 
448
whilst ranging.</P>
449
<P align=left><B>Changing the I2C Bus Address</B><BR>To change the I2C address 
450
of the SRF08 you must have only one sonar on the bus. Write the 3 sequence 
451
commands in the correct order followed by the address. Example; to change the 
452
address of a sonar currently at 0xE0 (the default shipped address) to 0xF2, 
453
write the following to address 0xE0; (0xA0, 0xAA, 0xA5, 0xF2 ). These commands 
454
must be sent in the correct sequence to change the I2C address, additionally, No 
455
other command may be issued in the middle of the sequence. The sequence must be 
456
sent to the command register at location 0, which means 4 separate write 
457
transactions on the I2C bus. When done, you should label the sonar with its 
458
address, however if you do forget, just power it up without sending any 
459
commands. The SRF08 will flash its address out on the LED. One long flash 
460
followed by a number of shorter flashes indicating its address. The flashing is 
461
terminated immediately on sending a command the SRF08.</P>
462
<DIV align=center>
463
<CENTER>
464
<TABLE cellSpacing=0 cellPadding=0 width="45%" bgColor=#ffffcc border=1>
465
  <TBODY>
466
  <TR>
467
    <TD align=middle width="45%" colSpan=2>Address</TD>
468
    <TD align=middle width="25%" rowSpan=2>Long Flash</TD>
469
    <TD align=middle width="30%" rowSpan=2>Short flashes</TD></TR>
470
  <TR>
471
    <TD align=middle width="23%">Decimal</TD>
472
    <TD align=middle width="22%">Hex</TD></TR>
473
  <TR>
474
    <TD align=middle width="23%">224</TD>
475
    <TD align=middle width="22%">E0</TD>
476
    <TD align=middle width="25%">1</TD>
477
    <TD align=middle width="30%">0</TD></TR>
478
  <TR>
479
    <TD align=middle width="23%">226</TD>
480
    <TD align=middle width="22%">E2</TD>
481
    <TD align=middle width="25%">1</TD>
482
    <TD align=middle width="30%">1</TD></TR>
483
  <TR>
484
    <TD align=middle width="23%">228</TD>
485
    <TD align=middle width="22%">E4</TD>
486
    <TD align=middle width="25%">1</TD>
487
    <TD align=middle width="30%">2</TD></TR>
488
  <TR>
489
    <TD align=middle width="23%">230</TD>
490
    <TD align=middle width="22%">E6</TD>
491
    <TD align=middle width="25%">1</TD>
492
    <TD align=middle width="30%">3</TD></TR>
493
  <TR>
494
    <TD align=middle width="23%">232</TD>
495
    <TD align=middle width="22%">E8</TD>
496
    <TD align=middle width="25%">1</TD>
497
    <TD align=middle width="30%">4</TD></TR>
498
  <TR>
499
    <TD align=middle width="23%">234</TD>
500
    <TD align=middle width="22%">EA</TD>
501
    <TD align=middle width="25%">1</TD>
502
    <TD align=middle width="30%">5</TD></TR>
503
  <TR>
504
    <TD align=middle width="23%">236</TD>
505
    <TD align=middle width="22%">EC</TD>
506
    <TD align=middle width="25%">1</TD>
507
    <TD align=middle width="30%">6</TD></TR>
508
  <TR>
509
    <TD align=middle width="23%">238</TD>
510
    <TD align=middle width="22%">EE</TD>
511
    <TD align=middle width="25%">1</TD>
512
    <TD align=middle width="30%">7</TD></TR>
513
  <TR>
514
    <TD align=middle width="23%">240</TD>
515
    <TD align=middle width="22%">F0</TD>
516
    <TD align=middle width="25%">1</TD>
517
    <TD align=middle width="30%">8</TD></TR>
518
  <TR>
519
    <TD align=middle width="23%">242</TD>
520
    <TD align=middle width="22%">F2</TD>
521
    <TD align=middle width="25%">1</TD>
522
    <TD align=middle width="30%">9</TD></TR>
523
  <TR>
524
    <TD align=middle width="23%">244</TD>
525
    <TD align=middle width="22%">F4</TD>
526
    <TD align=middle width="25%">1</TD>
527
    <TD align=middle width="30%">10</TD></TR>
528
  <TR>
529
    <TD align=middle width="23%">246</TD>
530
    <TD align=middle width="22%">F6</TD>
531
    <TD align=middle width="25%">1</TD>
532
    <TD align=middle width="30%">11</TD></TR>
533
  <TR>
534
    <TD align=middle width="23%">248</TD>
535
    <TD align=middle width="22%">F8</TD>
536
    <TD align=middle width="25%">1</TD>
537
    <TD align=middle width="30%">12</TD></TR>
538
  <TR>
539
    <TD align=middle width="23%">250</TD>
540
    <TD align=middle width="22%">FA</TD>
541
    <TD align=middle width="25%">1</TD>
542
    <TD align=middle width="30%">13</TD></TR>
543
  <TR>
544
    <TD align=middle width="23%">252</TD>
545
    <TD align=middle width="22%">FC</TD>
546
    <TD align=middle width="25%">1</TD>
547
    <TD align=middle width="30%">14</TD></TR>
548
  <TR>
549
    <TD align=middle width="23%">254</TD>
550
    <TD align=middle width="22%">FE</TD>
551
    <TD align=middle width="25%">1</TD>
552
    <TD align=middle width="30%">15</TD></TR></TBODY></TABLE></CENTER></DIV>
553
<P align=left>Take care not to set more than one sonar to the same address, 
554
there will be a bus collision and very unpredictable results.</P>
555
<P align=left><B>Current Consumption</B><BR>Average current consumption measured 
556
on our prototype is around 12mA during ranging, and 3mA standby. The module will 
557
automatically go to standby mode after a ranging, whilst waiting for a new 
558
command on the I2C bus. The actual measured current profile is as follows; </P>
559
<DIV align=center>
560
<CENTER>
561
<TABLE cellSpacing=0 width=400 bgColor=#ffffcc border=1>
562
  <TBODY>
563
  <TR>
564
    <TD align=middle width=253>Operation</TD>
565
    <TD align=middle width=62>Current</TD>
566
    <TD align=middle width=65>Duration</TD></TR>
567
  <TR>
568
    <TD align=middle width=253>Ranging command received - Power on</TD>
569
    <TD align=middle width=62>275mA</TD>
570
    <TD align=middle width=65>3uS</TD></TR>
571
  <TR>
572
    <TD align=middle width=253>+/- 10v generator Stabilization</TD>
573
    <TD align=middle width=62>
574
      <P align=center>25mA</P></TD>
575
    <TD align=middle width=65>600uS</TD></TR>
576
  <TR>
577
    <TD align=middle width=253>8 cycles of 40kHz "ping"</TD>
578
    <TD align=middle width=62>40mA</TD>
579
    <TD align=middle width=65>200uS</TD></TR>
580
  <TR>
581
    <TD align=middle width=253>Ranging</TD>
582
    <TD align=middle width=62>11mA</TD>
583
    <TD align=middle width=65>65mS max</TD></TR>
584
  <TR>
585
    <TD align=middle width=253>Standby</TD>
586
    <TD align=middle width=62>3mA</TD>
587
    <TD align=middle width=65>indefinite</TD></TR></TBODY></TABLE></CENTER></DIV>
588
<P align=left>The above values are for guidance only, they are not tested on 
589
production units. </P>
590
<P align=left>&nbsp;You can have a&nbsp; look at the <A 
591
href="http://www.robot-electronics.co.uk/images/srf08schematic.gif">schematic</A> 
592
and <A href="http://www.robot-electronics.co.uk/files/srf08.c">software</A> </P>
593
<P align=left>Your feedback/comments/criticisms and wish lists are very welcome, 
594
as always.<BR>Regards, Gerry. 
595
<BR>gerry@robot-electronics.co.uk</P></BODY></HTML>