-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsensors.xml
457 lines (431 loc) · 14.1 KB
/
sensors.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sensors>
<sensor id="1" valuetype="temperature_and_humidity">
<name>Temperature and Humidity</name>
<chipset>AM-2301</chipset>
<buslist>
<bus>s-wire</bus>
</buslist>
<read>
<reply length="5">
<param type="temperature">
<bitfield start="0" size="12"></bitfield>
</param>
<param type="humidity">
<bitfield start="12" size="12"></bitfield>
</param>
<param type="crc_8">
<bitfield start="32" size="8" />
</param>
</reply>
</read>
</sensor>
<sensor id="2" valuetype="temperature">
<name>Temperature</name>
<chipset>MCP9808</chipset>
<buslist>
<bus>i2c</bus>
<bus>1-wire</bus>
</buslist>
<read>
<command>CC 55 FF EA AA</command>
<reply length="2">
<param type="temperature">
<bitfield start="0" size="16"></bitfield>
</param>
</reply>
</read>
</sensor>
<sensor id="3" valuetype="acdc_current">
<name>AC ~220V presence</name>
<chipset>DS2406p+</chipset>
<buslist>
<bus>1-wire</bus>
</buslist>
<read>
<command>F5 24 FF</command>
<reply length="1">
<param type="boolean">
<bitfield start="3" size="1" />
</param>
<!--
<param type="boolean">
<bitfield start="4" size="1" />
</param>
-->
</reply>
</read>
</sensor>
<sensor id="4" valuetype="flood">
<name>Water flood</name>
<chipset>DS2406p+</chipset>
<buslist>
<bus>1-wire</bus>
</buslist>
<read>
<command>F5 24 FF</command> <!-- or F5 48 FF -->
<reply length="1">
<param type="boolean" name="Channel 1">
<bitfield start="3" size="1" />
</param>
<!--
-->
<!--
<param type="boolean" name="Channel 2">
<bitfield start="4" size="1" />
</param>
-->
</reply>
</read>
</sensor>
<sensor id="5" valuetype="light">
<name>Ambient light intensity</name>
<chipset>BH1731VFC</chipset>
<buslist>
<bus>i2c</bus>
</buslist>
<init>
<command>00</command> <!-- OFF -->
<command>01</command> <!-- ON -->
<command>12</command> <!-- SET HIGH PRECISION -->
</init>
<read>
<reply length="2">
<param byteorder="msb-first" result="yes">
<!-- simple case: extract value from bitfield, shift it in
position and scale by 1.2 to achieve light value in luxes.
We use reciprocal value of 1.2 to avoid divide
-->
<bitfield start="0" size="16" shift="0" scale="0.833333333" />
</param>
</reply>
</read>
</sensor>
<sensor id="6" valuetype="reed_switch">
<name>Door open/close status</name>
<chipset>Reed switch</chipset>
<buslist>
<bus>dc</bus>
</buslist>
<read>
<reply length="1">
<param type="boolean" name="Switch status">
<bitfield start="0" size="8" />
</param>
</reply>
</read>
</sensor>
<sensor id="7" tibbo_id="1" valuetype="pressure">
<name>Barometric pressure</name>
<chipset>MPL115A2</chipset>
<buslist>
<bus>i2c</bus>
</buslist>
<init>
<command>04</command>
<reply length="8">
<param byteorder="lsb-first">
<!-- convert 4 fixed-point sensor coefficient values into
floating-point numbers and put it in the const registers
-->
<code>
mov r0, word data[0]
swap r0
float r0
mov r1, 1
shl r1, 3
float r1
div r0, r1
mov c0, r0
mov r0, word data[2]
swap r0
float r0
mov r1, 1
shl r1, 13
float r1
div r0, r1
mov c1, r0
mov r0, word data[4]
swap r0
float r0
mov r1, 1
shl r1, 14
float r1
div r0, r1
mov c2, r0
mov r0, word data[6]
swap r0
float r0
mov r1, 1
shl r1, 24
float r1
div r0, r1
mov c3, r0
</code>
</param>
</reply>
</init>
<read>
<command>12 00</command>
<command>00</command>
<reply length="4">
<param name="Barometric pressure kPa" suffix="kPa">
<code>
mov r0, word data[2]
swap r0
shr r0, 6
and r0, 0x3ff
float r0
mov r1, word data[0]
swap r1
shr r1, 6
and r1, 0x3ff
float r1
mov r2, r0
mul r0, c3
add r0, c1
mul r0, r1
add r0, c0
mul r2, c2
add r0, r2
div r0, 15.737
add r0, 50.0
mul r0, 7.50062
</code>
</param>
</reply>
</read>
</sensor>
<sensor id="8" valuetype="byte">
<name>8-bit parallel port</name>
<chipset>MCP23008</chipset>
<buslist>
<bus>i2c</bus>
</buslist>
<read>
<command>09</command>
<reply length="1">
<param type="byte" name="Value">
<bitfield start="0" size="8" />
</param>
</reply>
</read>
</sensor>
<sensor id="9" valuetype="humidity">
<name>Humidity (temperature compensated)</name>
<chipset>HIH 6130</chipset>
<buslist>
<bus>i2c</bus>
</buslist>
<read>
<command></command>
<reply length="4">
<param type="float" name="Value">
<code>
mov r0, word data[0]
swap r0
and r0, 0x3fff
float r0
div r0, 16383.0
mul r0, 165.0
add r0, -40.0
</code>
</param>
</reply>
</read>
</sensor>
<sensor id="10" valuetype="temperature">
<name>Temperature</name>
<chipset>DS18B20</chipset>
<buslist>
<bus>1-wire</bus>
</buslist>
<read>
<command>44</command>
<command delay="10ms">BE</command>
<reply length="2">
<param type="float" name="Temperature">
<code>
mov r0, word data[0]
and r0, 0x87ff
float r0
div r0, 16.0
</code>
<!-- <bitfield start="0" size="16" scale="0.0625" /> -->
</param>
</reply>
</read>
</sensor>
<sensor id="11" valuetype="acceleration_three_axis">
<name>Accelerometer (3-axis)</name>
<chipset>ADXL312</chipset>
<buslist>
<bus>i2c</bus>
</buslist>
<init>
<command>2D 00</command>
<command>2D 08</command> <!-- POWER_CTL: Measure -->
<command>31 08</command> <!-- Data format: FULL_RES -->
<command>38 00</command> <!-- FIFO_CTL: bypass FIFO -->
</init>
<read>
<command>32</command>
<reply length="6">
<param type="float" name="accel">
<code>
mov r0, word data[2]
swap r0
and r0, 0x3ff
float r0
</code>
</param>
</reply>
</read>
</sensor>
<sensor id="16" valuetype="voltage">
<name>4-channel ADC, raw data</name>
<chipset>LTC2309</chipset>
<buslist>
<bus>i2c</bus>
</buslist>
<!-- no initialization required -->
<read>
<!-- Initiate conversion on all of the 4 channels. T{conv} is 1.3 to 1.8 µs -->
<command>88</command>
<command>98</command>
<command>A8</command>
<command>B8</command>
<!-- Discard previous results, and re-initiate conversion reading back actual data -->
<command>88</command>
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
<command>98</command>
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
<command>A8</command>
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
<command>B8</command>
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
</read>
</sensor>
<sensor id="17" valuetype="voltage">
<name>4-channel ADC, millivolts</name>
<chipset>LTC2309</chipset>
<buslist>
<bus>i2c</bus>
</buslist>
<!-- no initialization required -->
<read>
<!-- Initiate conversion on all of the 4 channels. T{conv} is 1.3 to 1.8 µs -->
<command>88</command>
<command>98</command>
<command>A8</command>
<command>B8</command>
<!-- Discard previous results, and re-initiate conversion reading back actual data -->
<command>88</command>
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
<command>98</command>
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
<command>A8</command>
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
<command>B8</command>
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
</read>
</sensor>
<!-- Following is Tibbo sensors on modbus
-->
<sensor id="32" valuetype="temperature_and_humidity" tibbo_id="1">
<name>Tibbo's Temperature and Humidity sensor</name>
<chipset>ModBus</chipset>
<buslist>
<bus>modbus</bus>
</buslist>
<!-- no initialization required -->
<read>
<register>501</register>
<reply length="4">
<param type="float">
<bitfield start="0" size="32" />
</param>
</reply>
</read>
</sensor>
<sensor id="33" valuetype="flood" tibbo_id="2">
<name>Tibbo's Flood Detection sensor</name>
<chipset>ModBus</chipset>
<buslist>
<bus>modbus</bus>
</buslist>
<!-- no initialization required -->
<read>
<register>901</register><!-- ModBus register # in hex -->
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
</read>
</sensor>
<sensor id="34" valuetype="flood" tibbo_id="3">
<name>Tibbo's Flood Detection sensor V2</name>
<chipset>ModBus</chipset>
<buslist>
<bus>modbus</bus>
</buslist>
<!-- no initialization required -->
<read>
<register>1901</register><!-- ModBus register # in hex -->
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
</read>
</sensor>
<sensor id="35" valuetype="flood" tibbo_id="4">
<name>Tibbo's Flood Detection sensor V2</name>
<chipset>ModBus</chipset>
<buslist>
<bus>modbus</bus>
</buslist>
<!-- no initialization required -->
<read>
<register>401</register><!-- ModBus register # in hex -->
<reply length="2">
<param type="word">
<bitfield start="0" size="16" />
</param>
</reply>
</read>
</sensor>
</sensors>