node-red-contrib-periph-pressure 1.5.3 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/examples/mpl3115a2/demo.json +122 -0
- package/examples/ms5607/demo.json +91 -0
- package/examples/ms5611/demo.json +91 -0
- package/examples/spl06/demo.json +136 -0
- package/nodes/mpl3115a2/mpl3115a2.html +95 -0
- package/nodes/mpl3115a2/mpl3115a2.js +64 -0
- package/nodes/ms5607/ms5607.html +90 -0
- package/nodes/ms5607/ms5607.js +56 -0
- package/nodes/ms5611/ms5611.html +90 -0
- package/nodes/ms5611/ms5611.js +56 -0
- package/nodes/spl06/spl06.html +98 -0
- package/nodes/spl06/spl06.js +56 -0
- package/package.json +25 -5
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# node-red-contrib-periph-pressure
|
|
2
2
|
|
|
3
|
-
Node-RED nodes for pressure sensor chips: BMP085, BMP180, BMP280, BMP384, BMP581, LPS22DF, LPS22HB, LPS28DFW, LPS33HW, MPL115A2 — part of the [Periph](https://github.com/tuhde/Periph) library.
|
|
3
|
+
Node-RED nodes for pressure sensor chips: BMP085, BMP180, BMP280, BMP384, BMP581, LPS22DF, LPS22HB, LPS28DFW, LPS33HW, MPL115A2, MPL3115A2, MS5607, MS5611, SPL06 — part of the [Periph](https://github.com/tuhde/Periph) library.
|
|
4
4
|
|
|
5
|
-
**Supported chips (
|
|
5
|
+
**Supported chips (14):** BMP085, BMP180, BMP280, BMP384, BMP581, LPS22DF, LPS22HB, LPS28DFW, LPS33HW, MPL115A2, MPL3115A2, MS5607, MS5611, SPL06.
|
|
6
6
|
|
|
7
7
|
Each chip has a sensor/actuator node plus a shared `-device` config node that holds the bus settings. Importable example flows are in [`examples/`](https://github.com/tuhde/Periph/tree/main/nodejs/packages/node-red-contrib-periph-pressure/examples).
|
|
8
8
|
|
|
@@ -40,6 +40,14 @@ npm install node-red-contrib-periph-pressure
|
|
|
40
40
|
| `lps33hw` | input | Reads pressure and temperature from an LPS33HW water-resistant MEMS absolute pressure sensor. |
|
|
41
41
|
| `mpl115a2-device` | config | Bus configuration for a MPL115A2 |
|
|
42
42
|
| `mpl115a2` | input | Reads the barometric pressure (50–115 kPa) and an approximate temperature from an NXP MPL115A2 over I²C (address 0x60). |
|
|
43
|
+
| `mpl3115a2-device` | config | I²C bus and address for a MPL3115A2 |
|
|
44
|
+
| `mpl3115a2` | input | Reads absolute pressure (or altitude) and temperature from an NXP MPL3115A2 over I²C (address 0x60) with one conversion per message. |
|
|
45
|
+
| `ms5607-device` | config | I²C bus and address for a MS5607 |
|
|
46
|
+
| `ms5607` | input | Reads temperature and barometric pressure from a TE Connectivity MS5607 over I²C (address 0x77, or 0x76 with CSB high). Each message converts the temperature and then the pressure and applies the first- and second-order compensation. |
|
|
47
|
+
| `ms5611-device` | config | I²C bus and address for a MS5611 |
|
|
48
|
+
| `ms5611` | input | Reads temperature and barometric pressure from a TE Connectivity MS5611 over I²C (address 0x77, or 0x76 with CSB high). Each message converts the temperature and then the pressure and applies the first- and second-order compensation. |
|
|
49
|
+
| `spl06-device` | config | I²C bus and address for a SPL06 |
|
|
50
|
+
| `spl06` | input | Reads temperature and absolute pressure from a Goertek SPL06-007 over I²C (address 0x77 or 0x76), one compensated measurement per message. |
|
|
43
51
|
|
|
44
52
|
## Links
|
|
45
53
|
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "mpl3115a2-tab",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "MPL3115A2 weather station",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "Reads pressure and temperature from an MPL3115A2 every 5 s and formats them as \"1013.3 hPa / 25.0 °C\". Each message triggers one conversion; a second inject with msg.altitude = true returns the altitude in metres relative to the sea-level pressure set in the device node."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "mpl3115a2-inject",
|
|
11
|
+
"type": "inject",
|
|
12
|
+
"z": "mpl3115a2-tab",
|
|
13
|
+
"name": "5 s timer",
|
|
14
|
+
"props": [
|
|
15
|
+
{
|
|
16
|
+
"p": "payload"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"repeat": "5",
|
|
20
|
+
"crontab": "",
|
|
21
|
+
"once": false,
|
|
22
|
+
"onceDelay": 0.1,
|
|
23
|
+
"topic": "",
|
|
24
|
+
"payloadType": "date",
|
|
25
|
+
"x": 160,
|
|
26
|
+
"y": 160,
|
|
27
|
+
"wires": [
|
|
28
|
+
[
|
|
29
|
+
"mpl3115a2-node"
|
|
30
|
+
]
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "mpl3115a2-device-1",
|
|
35
|
+
"type": "mpl3115a2-device",
|
|
36
|
+
"name": "MPL3115A2",
|
|
37
|
+
"bus": "1",
|
|
38
|
+
"address": "0x60",
|
|
39
|
+
"oversample": "128",
|
|
40
|
+
"seaLevel": "101325"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "mpl3115a2-node",
|
|
44
|
+
"type": "mpl3115a2",
|
|
45
|
+
"z": "mpl3115a2-tab",
|
|
46
|
+
"name": "MPL3115A2",
|
|
47
|
+
"x": 380,
|
|
48
|
+
"y": 160,
|
|
49
|
+
"wires": [
|
|
50
|
+
[
|
|
51
|
+
"mpl3115a2-format"
|
|
52
|
+
]
|
|
53
|
+
],
|
|
54
|
+
"device": "mpl3115a2-device-1"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "mpl3115a2-format",
|
|
58
|
+
"type": "function",
|
|
59
|
+
"z": "mpl3115a2-tab",
|
|
60
|
+
"name": "Format",
|
|
61
|
+
"func": "if (msg.payload.altitude_m !== undefined) {\n msg.payload = msg.payload.altitude_m.toFixed(1) + ' m / ' + msg.payload.temperature_c.toFixed(1) + ' °C';\n} else {\n msg.payload = (msg.payload.pressure_pa / 100).toFixed(1) + ' hPa / ' + msg.payload.temperature_c.toFixed(1) + ' °C';\n}\nreturn msg;",
|
|
62
|
+
"outputs": 1,
|
|
63
|
+
"noerr": 0,
|
|
64
|
+
"initialize": "",
|
|
65
|
+
"finalize": "",
|
|
66
|
+
"libs": [],
|
|
67
|
+
"x": 600,
|
|
68
|
+
"y": 160,
|
|
69
|
+
"wires": [
|
|
70
|
+
[
|
|
71
|
+
"mpl3115a2-debug"
|
|
72
|
+
]
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "mpl3115a2-debug",
|
|
77
|
+
"type": "debug",
|
|
78
|
+
"z": "mpl3115a2-tab",
|
|
79
|
+
"name": "Reading",
|
|
80
|
+
"active": true,
|
|
81
|
+
"tosidebar": true,
|
|
82
|
+
"console": false,
|
|
83
|
+
"tostatus": false,
|
|
84
|
+
"complete": "payload",
|
|
85
|
+
"targetType": "msg",
|
|
86
|
+
"statusVal": "",
|
|
87
|
+
"statusType": "auto",
|
|
88
|
+
"x": 800,
|
|
89
|
+
"y": 160,
|
|
90
|
+
"wires": []
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "mpl3115a2-inject-alt",
|
|
94
|
+
"type": "inject",
|
|
95
|
+
"z": "mpl3115a2-tab",
|
|
96
|
+
"name": "altitude",
|
|
97
|
+
"props": [
|
|
98
|
+
{
|
|
99
|
+
"p": "payload"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"p": "altitude",
|
|
103
|
+
"v": "true",
|
|
104
|
+
"vt": "bool"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"repeat": "",
|
|
108
|
+
"crontab": "",
|
|
109
|
+
"once": false,
|
|
110
|
+
"onceDelay": 0.1,
|
|
111
|
+
"topic": "",
|
|
112
|
+
"payload": "",
|
|
113
|
+
"payloadType": "date",
|
|
114
|
+
"x": 160,
|
|
115
|
+
"y": 240,
|
|
116
|
+
"wires": [
|
|
117
|
+
[
|
|
118
|
+
"mpl3115a2-node"
|
|
119
|
+
]
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "ms5607-tab",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "MS5607 barometer",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "Reads temperature and pressure from an MS5607 every 5 s, computes the altitude relative to the standard sea-level pressure (101325 Pa) and formats it as \"25.0 °C / 101325 Pa / 0.0 m\". Each message triggers one measurement at the configured oversampling ratio."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "ms5607-inject",
|
|
11
|
+
"type": "inject",
|
|
12
|
+
"z": "ms5607-tab",
|
|
13
|
+
"name": "5 s timer",
|
|
14
|
+
"props": [
|
|
15
|
+
{
|
|
16
|
+
"p": "payload"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"repeat": "5",
|
|
20
|
+
"crontab": "",
|
|
21
|
+
"once": false,
|
|
22
|
+
"onceDelay": 0.1,
|
|
23
|
+
"topic": "",
|
|
24
|
+
"payloadType": "date",
|
|
25
|
+
"x": 160,
|
|
26
|
+
"y": 160,
|
|
27
|
+
"wires": [
|
|
28
|
+
[
|
|
29
|
+
"ms5607-node"
|
|
30
|
+
]
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "ms5607-device-1",
|
|
35
|
+
"type": "ms5607-device",
|
|
36
|
+
"name": "MS5607",
|
|
37
|
+
"bus": "1",
|
|
38
|
+
"address": "0x77",
|
|
39
|
+
"oversampling": "4096"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "ms5607-node",
|
|
43
|
+
"type": "ms5607",
|
|
44
|
+
"z": "ms5607-tab",
|
|
45
|
+
"name": "MS5607",
|
|
46
|
+
"x": 380,
|
|
47
|
+
"y": 160,
|
|
48
|
+
"wires": [
|
|
49
|
+
[
|
|
50
|
+
"ms5607-format"
|
|
51
|
+
]
|
|
52
|
+
],
|
|
53
|
+
"device": "ms5607-device-1"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "ms5607-format",
|
|
57
|
+
"type": "function",
|
|
58
|
+
"z": "ms5607-tab",
|
|
59
|
+
"name": "Format",
|
|
60
|
+
"func": "const p = msg.payload.pressure_pa;\nconst alt = 44330 * (1 - Math.pow(p / 101325, 1 / 5.255));\nmsg.payload = msg.payload.temperature_c.toFixed(1) + ' °C / ' + p.toFixed(0) + ' Pa / ' + alt.toFixed(1) + ' m';\nreturn msg;",
|
|
61
|
+
"outputs": 1,
|
|
62
|
+
"noerr": 0,
|
|
63
|
+
"initialize": "",
|
|
64
|
+
"finalize": "",
|
|
65
|
+
"libs": [],
|
|
66
|
+
"x": 600,
|
|
67
|
+
"y": 160,
|
|
68
|
+
"wires": [
|
|
69
|
+
[
|
|
70
|
+
"ms5607-debug"
|
|
71
|
+
]
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "ms5607-debug",
|
|
76
|
+
"type": "debug",
|
|
77
|
+
"z": "ms5607-tab",
|
|
78
|
+
"name": "Reading",
|
|
79
|
+
"active": true,
|
|
80
|
+
"tosidebar": true,
|
|
81
|
+
"console": false,
|
|
82
|
+
"tostatus": false,
|
|
83
|
+
"complete": "payload",
|
|
84
|
+
"targetType": "msg",
|
|
85
|
+
"statusVal": "",
|
|
86
|
+
"statusType": "auto",
|
|
87
|
+
"x": 800,
|
|
88
|
+
"y": 160,
|
|
89
|
+
"wires": []
|
|
90
|
+
}
|
|
91
|
+
]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "ms5611-tab",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "MS5611 barometer",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "Reads temperature and pressure from an MS5611 every 5 s, computes the altitude relative to the standard sea-level pressure (101325 Pa) and formats it as \"25.0 °C / 101325 Pa / 0.0 m\". Each message triggers one measurement at the configured oversampling ratio."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "ms5611-inject",
|
|
11
|
+
"type": "inject",
|
|
12
|
+
"z": "ms5611-tab",
|
|
13
|
+
"name": "5 s timer",
|
|
14
|
+
"props": [
|
|
15
|
+
{
|
|
16
|
+
"p": "payload"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"repeat": "5",
|
|
20
|
+
"crontab": "",
|
|
21
|
+
"once": false,
|
|
22
|
+
"onceDelay": 0.1,
|
|
23
|
+
"topic": "",
|
|
24
|
+
"payloadType": "date",
|
|
25
|
+
"x": 160,
|
|
26
|
+
"y": 160,
|
|
27
|
+
"wires": [
|
|
28
|
+
[
|
|
29
|
+
"ms5611-node"
|
|
30
|
+
]
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "ms5611-device-1",
|
|
35
|
+
"type": "ms5611-device",
|
|
36
|
+
"name": "MS5611",
|
|
37
|
+
"bus": "1",
|
|
38
|
+
"address": "0x77",
|
|
39
|
+
"oversampling": "4096"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "ms5611-node",
|
|
43
|
+
"type": "ms5611",
|
|
44
|
+
"z": "ms5611-tab",
|
|
45
|
+
"name": "MS5611",
|
|
46
|
+
"x": 380,
|
|
47
|
+
"y": 160,
|
|
48
|
+
"wires": [
|
|
49
|
+
[
|
|
50
|
+
"ms5611-format"
|
|
51
|
+
]
|
|
52
|
+
],
|
|
53
|
+
"device": "ms5611-device-1"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "ms5611-format",
|
|
57
|
+
"type": "function",
|
|
58
|
+
"z": "ms5611-tab",
|
|
59
|
+
"name": "Format",
|
|
60
|
+
"func": "const p = msg.payload.pressure_pa;\nconst alt = 44330 * (1 - Math.pow(p / 101325, 1 / 5.255));\nmsg.payload = msg.payload.temperature_c.toFixed(1) + ' °C / ' + p.toFixed(0) + ' Pa / ' + alt.toFixed(1) + ' m';\nreturn msg;",
|
|
61
|
+
"outputs": 1,
|
|
62
|
+
"noerr": 0,
|
|
63
|
+
"initialize": "",
|
|
64
|
+
"finalize": "",
|
|
65
|
+
"libs": [],
|
|
66
|
+
"x": 600,
|
|
67
|
+
"y": 160,
|
|
68
|
+
"wires": [
|
|
69
|
+
[
|
|
70
|
+
"ms5611-debug"
|
|
71
|
+
]
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "ms5611-debug",
|
|
76
|
+
"type": "debug",
|
|
77
|
+
"z": "ms5611-tab",
|
|
78
|
+
"name": "Reading",
|
|
79
|
+
"active": true,
|
|
80
|
+
"tosidebar": true,
|
|
81
|
+
"console": false,
|
|
82
|
+
"tostatus": false,
|
|
83
|
+
"complete": "payload",
|
|
84
|
+
"targetType": "msg",
|
|
85
|
+
"statusVal": "",
|
|
86
|
+
"statusType": "auto",
|
|
87
|
+
"x": 800,
|
|
88
|
+
"y": 160,
|
|
89
|
+
"wires": []
|
|
90
|
+
}
|
|
91
|
+
]
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "spl06-tab",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "SPL06 altimeter",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "Barometric altimeter with an SPL06-007. An inject node fires every 2 s and triggers one temperature and pressure measurement. A function node converts the pressure into altitude with the international barometric formula (reference 101325 Pa, editable in the function) and feeds a dashboard gauge; the debug node shows the full reading in pascals, degrees Celsius and metres."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "spl06-inject",
|
|
11
|
+
"type": "inject",
|
|
12
|
+
"z": "spl06-tab",
|
|
13
|
+
"name": "every 2 s",
|
|
14
|
+
"props": [
|
|
15
|
+
{
|
|
16
|
+
"p": "payload"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"repeat": "2",
|
|
20
|
+
"crontab": "",
|
|
21
|
+
"once": true,
|
|
22
|
+
"onceDelay": 0.5,
|
|
23
|
+
"topic": "",
|
|
24
|
+
"payloadType": "date",
|
|
25
|
+
"x": 150,
|
|
26
|
+
"y": 160,
|
|
27
|
+
"wires": [
|
|
28
|
+
[
|
|
29
|
+
"spl06-node"
|
|
30
|
+
]
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "spl06-device-1",
|
|
35
|
+
"type": "spl06-device",
|
|
36
|
+
"name": "SPL06",
|
|
37
|
+
"bus": "1",
|
|
38
|
+
"address": "0x77",
|
|
39
|
+
"oversampling": "16"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "spl06-node",
|
|
43
|
+
"type": "spl06",
|
|
44
|
+
"z": "spl06-tab",
|
|
45
|
+
"name": "SPL06",
|
|
46
|
+
"device": "spl06-device-1",
|
|
47
|
+
"x": 340,
|
|
48
|
+
"y": 160,
|
|
49
|
+
"wires": [
|
|
50
|
+
[
|
|
51
|
+
"spl06-altitude"
|
|
52
|
+
]
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "spl06-altitude",
|
|
57
|
+
"type": "function",
|
|
58
|
+
"z": "spl06-tab",
|
|
59
|
+
"name": "Altitude",
|
|
60
|
+
"func": "const seaLevelPa = 101325;\nconst p = msg.payload.pressure_pa;\nmsg.payload.altitude_m = 44330 * (1 - Math.pow(p / seaLevelPa, 1 / 5.255));\nreturn [msg, { payload: Math.round(msg.payload.altitude_m * 10) / 10 }];",
|
|
61
|
+
"outputs": 2,
|
|
62
|
+
"noerr": 0,
|
|
63
|
+
"initialize": "",
|
|
64
|
+
"finalize": "",
|
|
65
|
+
"libs": [],
|
|
66
|
+
"x": 530,
|
|
67
|
+
"y": 160,
|
|
68
|
+
"wires": [
|
|
69
|
+
[
|
|
70
|
+
"spl06-debug"
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
"spl06-gauge"
|
|
74
|
+
]
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "spl06-debug",
|
|
79
|
+
"type": "debug",
|
|
80
|
+
"z": "spl06-tab",
|
|
81
|
+
"name": "Reading",
|
|
82
|
+
"active": true,
|
|
83
|
+
"tosidebar": true,
|
|
84
|
+
"console": false,
|
|
85
|
+
"tostatus": false,
|
|
86
|
+
"complete": "payload",
|
|
87
|
+
"targetType": "msg",
|
|
88
|
+
"statusVal": "",
|
|
89
|
+
"statusType": "auto",
|
|
90
|
+
"x": 740,
|
|
91
|
+
"y": 120,
|
|
92
|
+
"wires": []
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "spl06-gauge",
|
|
96
|
+
"type": "ui_gauge",
|
|
97
|
+
"z": "spl06-tab",
|
|
98
|
+
"name": "Altitude gauge",
|
|
99
|
+
"group": "spl06-group-1",
|
|
100
|
+
"order": 1,
|
|
101
|
+
"width": 6,
|
|
102
|
+
"height": 4,
|
|
103
|
+
"gtype": "gage",
|
|
104
|
+
"title": "Altitude",
|
|
105
|
+
"label": "m",
|
|
106
|
+
"format": "{{value}}",
|
|
107
|
+
"min": -100,
|
|
108
|
+
"max": 1000,
|
|
109
|
+
"colors": [
|
|
110
|
+
"#00b500",
|
|
111
|
+
"#e6e600",
|
|
112
|
+
"#ca3838"
|
|
113
|
+
],
|
|
114
|
+
"seg1": "",
|
|
115
|
+
"seg2": "",
|
|
116
|
+
"x": 750,
|
|
117
|
+
"y": 200,
|
|
118
|
+
"wires": []
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": "spl06-group-1",
|
|
122
|
+
"type": "ui_group",
|
|
123
|
+
"name": "SPL06 Altimeter",
|
|
124
|
+
"tab": "spl06-ui-tab-1",
|
|
125
|
+
"order": 1,
|
|
126
|
+
"disp": true,
|
|
127
|
+
"width": 6
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"id": "spl06-ui-tab-1",
|
|
131
|
+
"type": "ui_tab",
|
|
132
|
+
"name": "SPL06 Demo",
|
|
133
|
+
"icon": "dashboard",
|
|
134
|
+
"order": 1
|
|
135
|
+
}
|
|
136
|
+
]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<!-- Config node: one instance per physical device -->
|
|
2
|
+
<script type="text/javascript">
|
|
3
|
+
RED.nodes.registerType('mpl3115a2-device', {
|
|
4
|
+
category: 'config',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' },
|
|
7
|
+
bus: { value: '1', required: true, validate: RED.validators.number() },
|
|
8
|
+
address: { value: '0x60' },
|
|
9
|
+
oversample: { value: '128' },
|
|
10
|
+
seaLevel: { value: '101325' }
|
|
11
|
+
},
|
|
12
|
+
label: function() {
|
|
13
|
+
return this.name || ('MPL3115A2 @ ' + this.address + ' (bus ' + this.bus + ')');
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script type="text/html" data-template-name="mpl3115a2-device">
|
|
19
|
+
<div class="form-row">
|
|
20
|
+
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
21
|
+
<input type="text" id="node-config-input-name" placeholder="MPL3115A2">
|
|
22
|
+
</div>
|
|
23
|
+
<div class="form-row">
|
|
24
|
+
<label for="node-config-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
|
|
25
|
+
<input type="number" id="node-config-input-bus" min="0" style="width:80px"> (Linux /dev/i2c-N)
|
|
26
|
+
</div>
|
|
27
|
+
<div class="form-row">
|
|
28
|
+
<label for="node-config-input-address"><i class="fa fa-microchip"></i> I²C address</label>
|
|
29
|
+
<input type="text" id="node-config-input-address" style="width:80px" placeholder="0x60"> (fixed address)
|
|
30
|
+
</div>
|
|
31
|
+
<div class="form-row">
|
|
32
|
+
<label for="node-config-input-oversample"><i class="fa fa-cog"></i> Oversample ratio</label>
|
|
33
|
+
<select id="node-config-input-oversample" style="width:120px">
|
|
34
|
+
<option value="1">1</option><option value="2">2</option><option value="4">4</option>
|
|
35
|
+
<option value="8">8</option><option value="16">16</option><option value="32">32</option>
|
|
36
|
+
<option value="64">64</option><option value="128" selected>128</option>
|
|
37
|
+
</select>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="form-row">
|
|
40
|
+
<label for="node-config-input-seaLevel"><i class="fa fa-globe"></i> Sea-level pressure</label>
|
|
41
|
+
<input type="number" id="node-config-input-seaLevel" style="width:120px" min="0"> Pa (for altitude readings)
|
|
42
|
+
</div>
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<!-- Read node -->
|
|
46
|
+
<script type="text/javascript">
|
|
47
|
+
RED.nodes.registerType('mpl3115a2', {
|
|
48
|
+
category: 'Peripheral',
|
|
49
|
+
color: '#C084FC',
|
|
50
|
+
defaults: {
|
|
51
|
+
name: { value: '' },
|
|
52
|
+
device: { value: '', type: 'mpl3115a2-device', required: true }
|
|
53
|
+
},
|
|
54
|
+
inputs: 1,
|
|
55
|
+
outputs: 1,
|
|
56
|
+
icon: 'bridge.svg',
|
|
57
|
+
label: function() { return this.name || 'MPL3115A2'; },
|
|
58
|
+
paletteLabel: 'MPL3115A2'
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<script type="text/html" data-template-name="mpl3115a2">
|
|
63
|
+
<div class="form-row">
|
|
64
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
65
|
+
<input type="text" id="node-input-name" placeholder="MPL3115A2">
|
|
66
|
+
</div>
|
|
67
|
+
<div class="form-row">
|
|
68
|
+
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
69
|
+
<input type="text" id="node-input-device">
|
|
70
|
+
</div>
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<script type="text/html" data-help-name="mpl3115a2">
|
|
74
|
+
<p>Reads absolute pressure (or altitude) and temperature from an NXP MPL3115A2 over I²C (address 0x60)
|
|
75
|
+
with one conversion per message.</p>
|
|
76
|
+
<h3>Inputs</h3>
|
|
77
|
+
<dl class="message-properties">
|
|
78
|
+
<dt>payload <span class="property-type">any</span></dt>
|
|
79
|
+
<dd>Any incoming message triggers one measurement.</dd>
|
|
80
|
+
<dt class="optional">altitude <span class="property-type">boolean</span></dt>
|
|
81
|
+
<dd>If <code>true</code>, the chip is switched to altimeter mode and the altitude is returned.</dd>
|
|
82
|
+
</dl>
|
|
83
|
+
<h3>Outputs</h3>
|
|
84
|
+
<dl class="message-properties">
|
|
85
|
+
<dt>payload.pressure_pa <span class="property-type">number</span></dt>
|
|
86
|
+
<dd>Pressure in Pa (barometer reading).</dd>
|
|
87
|
+
<dt>payload.altitude_m <span class="property-type">number</span></dt>
|
|
88
|
+
<dd>Altitude in metres relative to the configured sea-level pressure (when <code>msg.altitude</code> is true).</dd>
|
|
89
|
+
<dt>payload.temperature_c <span class="property-type">number</span></dt>
|
|
90
|
+
<dd>Temperature in °C.</dd>
|
|
91
|
+
</dl>
|
|
92
|
+
<h3>Configuration</h3>
|
|
93
|
+
<p>I²C bus number, I²C address (0x60), the oversample ratio (1 to 128) and the sea-level pressure in Pa,
|
|
94
|
+
set in the <b>mpl3115a2-device</b> config node.</p>
|
|
95
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = function(RED) {
|
|
4
|
+
const { I2CConnection } = require('periph/src/connection/i2c');
|
|
5
|
+
const { MPL3115A2Full } = require('periph/src/chips/pressure/mpl3115a2');
|
|
6
|
+
|
|
7
|
+
function MPL3115A2DeviceNode(config) {
|
|
8
|
+
RED.nodes.createNode(this, config);
|
|
9
|
+
const node = this;
|
|
10
|
+
try {
|
|
11
|
+
const address = parseInt(config.address, 16) || 0x60;
|
|
12
|
+
const connection = new I2CConnection(parseInt(config.bus), address);
|
|
13
|
+
node.connection = connection;
|
|
14
|
+
node.driver = new MPL3115A2Full(connection);
|
|
15
|
+
node.ready = (async () => {
|
|
16
|
+
await node.driver.init();
|
|
17
|
+
const ratio = parseInt(config.oversample);
|
|
18
|
+
await node.driver.setOversample(isNaN(ratio) ? 128 : ratio);
|
|
19
|
+
const slp = parseFloat(config.seaLevel);
|
|
20
|
+
await node.driver.setSeaLevelPressure(isNaN(slp) ? 101325 : slp);
|
|
21
|
+
})();
|
|
22
|
+
node.ready.catch((e) => {
|
|
23
|
+
node.error('MPL3115A2 init failed: ' + e.message);
|
|
24
|
+
});
|
|
25
|
+
} catch (e) {
|
|
26
|
+
node.error('MPL3115A2 init failed: ' + e.message);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
node.on('close', function() {
|
|
30
|
+
if (node.connection) node.connection.close();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
RED.nodes.registerType('mpl3115a2-device', MPL3115A2DeviceNode);
|
|
34
|
+
|
|
35
|
+
function MPL3115A2ReadNode(config) {
|
|
36
|
+
RED.nodes.createNode(this, config);
|
|
37
|
+
const node = this;
|
|
38
|
+
const deviceNode = RED.nodes.getNode(config.device) || {};
|
|
39
|
+
|
|
40
|
+
node.on('input', async function(msg, send, done) {
|
|
41
|
+
if (!deviceNode.driver) {
|
|
42
|
+
node.error('MPL3115A2 not initialised', msg);
|
|
43
|
+
done();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
await deviceNode.ready;
|
|
48
|
+
if (msg.altitude === true) {
|
|
49
|
+
const altitude_m = await deviceNode.driver.readAltitude();
|
|
50
|
+
const temperature_c = await deviceNode.driver.readTemperature();
|
|
51
|
+
msg.payload = { altitude_m, temperature_c };
|
|
52
|
+
} else {
|
|
53
|
+
const { pressure_pa, temperature_c } = await deviceNode.driver.read();
|
|
54
|
+
msg.payload = { pressure_pa, temperature_c };
|
|
55
|
+
}
|
|
56
|
+
send(msg);
|
|
57
|
+
done();
|
|
58
|
+
} catch (e) {
|
|
59
|
+
done(e);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
RED.nodes.registerType('mpl3115a2', MPL3115A2ReadNode);
|
|
64
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!-- Config node: one instance per physical device -->
|
|
2
|
+
<script type="text/javascript">
|
|
3
|
+
RED.nodes.registerType('ms5607-device', {
|
|
4
|
+
category: 'config',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' },
|
|
7
|
+
bus: { value: '1', required: true, validate: RED.validators.number() },
|
|
8
|
+
address: { value: '0x77' },
|
|
9
|
+
oversampling: { value: '4096' }
|
|
10
|
+
},
|
|
11
|
+
label: function() {
|
|
12
|
+
return this.name || ('MS5607 @ ' + this.address + ' (bus ' + this.bus + ')');
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script type="text/html" data-template-name="ms5607-device">
|
|
18
|
+
<div class="form-row">
|
|
19
|
+
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
20
|
+
<input type="text" id="node-config-input-name" placeholder="MS5607">
|
|
21
|
+
</div>
|
|
22
|
+
<div class="form-row">
|
|
23
|
+
<label for="node-config-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
|
|
24
|
+
<input type="number" id="node-config-input-bus" min="0" style="width:80px"> (Linux /dev/i2c-N)
|
|
25
|
+
</div>
|
|
26
|
+
<div class="form-row">
|
|
27
|
+
<label for="node-config-input-address"><i class="fa fa-microchip"></i> I²C address</label>
|
|
28
|
+
<select id="node-config-input-address" style="width:100px">
|
|
29
|
+
<option value="0x77">0x77 (CSB = GND)</option>
|
|
30
|
+
<option value="0x76">0x76 (CSB = VDD)</option>
|
|
31
|
+
</select>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="form-row">
|
|
34
|
+
<label for="node-config-input-oversampling"><i class="fa fa-cog"></i> Oversampling</label>
|
|
35
|
+
<select id="node-config-input-oversampling" style="width:100px">
|
|
36
|
+
<option value="256">256</option>
|
|
37
|
+
<option value="512">512</option>
|
|
38
|
+
<option value="1024">1024</option>
|
|
39
|
+
<option value="2048">2048</option>
|
|
40
|
+
<option value="4096">4096</option>
|
|
41
|
+
</select>
|
|
42
|
+
</div>
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<!-- Read node -->
|
|
46
|
+
<script type="text/javascript">
|
|
47
|
+
RED.nodes.registerType('ms5607', {
|
|
48
|
+
category: 'Peripheral',
|
|
49
|
+
color: '#C084FC',
|
|
50
|
+
defaults: {
|
|
51
|
+
name: { value: '' },
|
|
52
|
+
device: { value: '', type: 'ms5607-device', required: true }
|
|
53
|
+
},
|
|
54
|
+
inputs: 1,
|
|
55
|
+
outputs: 1,
|
|
56
|
+
icon: 'bridge.svg',
|
|
57
|
+
label: function() { return this.name || 'MS5607'; },
|
|
58
|
+
paletteLabel: 'MS5607'
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<script type="text/html" data-template-name="ms5607">
|
|
63
|
+
<div class="form-row">
|
|
64
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
65
|
+
<input type="text" id="node-input-name" placeholder="MS5607">
|
|
66
|
+
</div>
|
|
67
|
+
<div class="form-row">
|
|
68
|
+
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
69
|
+
<input type="text" id="node-input-device">
|
|
70
|
+
</div>
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<script type="text/html" data-help-name="ms5607">
|
|
74
|
+
<p>Reads temperature and barometric pressure from a TE Connectivity MS5607 over I²C (address 0x77, or 0x76 with CSB
|
|
75
|
+
high). Each message converts the temperature and then the pressure and applies the first- and second-order compensation.</p>
|
|
76
|
+
<h3>Inputs</h3>
|
|
77
|
+
<dl class="message-properties">
|
|
78
|
+
<dt>payload <span class="property-type">any</span></dt>
|
|
79
|
+
<dd>Any incoming message triggers one measurement.</dd>
|
|
80
|
+
</dl>
|
|
81
|
+
<h3>Outputs</h3>
|
|
82
|
+
<dl class="message-properties">
|
|
83
|
+
<dt>payload.temperature_c <span class="property-type">number</span></dt>
|
|
84
|
+
<dd>Temperature in °C.</dd>
|
|
85
|
+
<dt>payload.pressure_pa <span class="property-type">number</span></dt>
|
|
86
|
+
<dd>Pressure in pascals (1 Pa = 0.01 mbar).</dd>
|
|
87
|
+
</dl>
|
|
88
|
+
<h3>Configuration</h3>
|
|
89
|
+
<p>I²C bus number, I²C address (0x76 / 0x77) and the oversampling ratio (256 to 4096), set in the <b>ms5607-device</b> config node.</p>
|
|
90
|
+
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = function(RED) {
|
|
4
|
+
const { I2CConnection } = require('periph/src/connection/i2c');
|
|
5
|
+
const { MS5607Full } = require('periph/src/chips/pressure/ms5607');
|
|
6
|
+
|
|
7
|
+
function MS5607DeviceNode(config) {
|
|
8
|
+
RED.nodes.createNode(this, config);
|
|
9
|
+
const node = this;
|
|
10
|
+
try {
|
|
11
|
+
const address = parseInt(config.address, 16) || 0x77;
|
|
12
|
+
const connection = new I2CConnection(parseInt(config.bus), address);
|
|
13
|
+
node.connection = connection;
|
|
14
|
+
node.driver = new MS5607Full(connection);
|
|
15
|
+
node.ready = (async () => {
|
|
16
|
+
await node.driver.init();
|
|
17
|
+
const osr = parseInt(config.oversampling);
|
|
18
|
+
node.driver.setOversampling(isNaN(osr) ? 4096 : osr);
|
|
19
|
+
})();
|
|
20
|
+
node.ready.catch((e) => {
|
|
21
|
+
node.error('MS5607 init failed: ' + e.message);
|
|
22
|
+
});
|
|
23
|
+
} catch (e) {
|
|
24
|
+
node.error('MS5607 init failed: ' + e.message);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
node.on('close', function() {
|
|
28
|
+
if (node.connection) node.connection.close();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
RED.nodes.registerType('ms5607-device', MS5607DeviceNode);
|
|
32
|
+
|
|
33
|
+
function MS5607ReadNode(config) {
|
|
34
|
+
RED.nodes.createNode(this, config);
|
|
35
|
+
const node = this;
|
|
36
|
+
const deviceNode = RED.nodes.getNode(config.device) || {};
|
|
37
|
+
|
|
38
|
+
node.on('input', async function(msg, send, done) {
|
|
39
|
+
if (!deviceNode.driver) {
|
|
40
|
+
node.error('MS5607 not initialised', msg);
|
|
41
|
+
done();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
await deviceNode.ready;
|
|
46
|
+
const { temperature_c, pressure_pa } = await deviceNode.driver.read();
|
|
47
|
+
msg.payload = { temperature_c, pressure_pa };
|
|
48
|
+
send(msg);
|
|
49
|
+
done();
|
|
50
|
+
} catch (e) {
|
|
51
|
+
done(e);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
RED.nodes.registerType('ms5607', MS5607ReadNode);
|
|
56
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!-- Config node: one instance per physical device -->
|
|
2
|
+
<script type="text/javascript">
|
|
3
|
+
RED.nodes.registerType('ms5611-device', {
|
|
4
|
+
category: 'config',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' },
|
|
7
|
+
bus: { value: '1', required: true, validate: RED.validators.number() },
|
|
8
|
+
address: { value: '0x77' },
|
|
9
|
+
oversampling: { value: '4096' }
|
|
10
|
+
},
|
|
11
|
+
label: function() {
|
|
12
|
+
return this.name || ('MS5611 @ ' + this.address + ' (bus ' + this.bus + ')');
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script type="text/html" data-template-name="ms5611-device">
|
|
18
|
+
<div class="form-row">
|
|
19
|
+
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
20
|
+
<input type="text" id="node-config-input-name" placeholder="MS5611">
|
|
21
|
+
</div>
|
|
22
|
+
<div class="form-row">
|
|
23
|
+
<label for="node-config-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
|
|
24
|
+
<input type="number" id="node-config-input-bus" min="0" style="width:80px"> (Linux /dev/i2c-N)
|
|
25
|
+
</div>
|
|
26
|
+
<div class="form-row">
|
|
27
|
+
<label for="node-config-input-address"><i class="fa fa-microchip"></i> I²C address</label>
|
|
28
|
+
<select id="node-config-input-address" style="width:100px">
|
|
29
|
+
<option value="0x77">0x77 (CSB = GND)</option>
|
|
30
|
+
<option value="0x76">0x76 (CSB = VDD)</option>
|
|
31
|
+
</select>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="form-row">
|
|
34
|
+
<label for="node-config-input-oversampling"><i class="fa fa-cog"></i> Oversampling</label>
|
|
35
|
+
<select id="node-config-input-oversampling" style="width:100px">
|
|
36
|
+
<option value="256">256</option>
|
|
37
|
+
<option value="512">512</option>
|
|
38
|
+
<option value="1024">1024</option>
|
|
39
|
+
<option value="2048">2048</option>
|
|
40
|
+
<option value="4096">4096</option>
|
|
41
|
+
</select>
|
|
42
|
+
</div>
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<!-- Read node -->
|
|
46
|
+
<script type="text/javascript">
|
|
47
|
+
RED.nodes.registerType('ms5611', {
|
|
48
|
+
category: 'Peripheral',
|
|
49
|
+
color: '#C084FC',
|
|
50
|
+
defaults: {
|
|
51
|
+
name: { value: '' },
|
|
52
|
+
device: { value: '', type: 'ms5611-device', required: true }
|
|
53
|
+
},
|
|
54
|
+
inputs: 1,
|
|
55
|
+
outputs: 1,
|
|
56
|
+
icon: 'bridge.svg',
|
|
57
|
+
label: function() { return this.name || 'MS5611'; },
|
|
58
|
+
paletteLabel: 'MS5611'
|
|
59
|
+
});
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<script type="text/html" data-template-name="ms5611">
|
|
63
|
+
<div class="form-row">
|
|
64
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
65
|
+
<input type="text" id="node-input-name" placeholder="MS5611">
|
|
66
|
+
</div>
|
|
67
|
+
<div class="form-row">
|
|
68
|
+
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
69
|
+
<input type="text" id="node-input-device">
|
|
70
|
+
</div>
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<script type="text/html" data-help-name="ms5611">
|
|
74
|
+
<p>Reads temperature and barometric pressure from a TE Connectivity MS5611 over I²C (address 0x77, or 0x76 with CSB
|
|
75
|
+
high). Each message converts the temperature and then the pressure and applies the first- and second-order compensation.</p>
|
|
76
|
+
<h3>Inputs</h3>
|
|
77
|
+
<dl class="message-properties">
|
|
78
|
+
<dt>payload <span class="property-type">any</span></dt>
|
|
79
|
+
<dd>Any incoming message triggers one measurement.</dd>
|
|
80
|
+
</dl>
|
|
81
|
+
<h3>Outputs</h3>
|
|
82
|
+
<dl class="message-properties">
|
|
83
|
+
<dt>payload.temperature_c <span class="property-type">number</span></dt>
|
|
84
|
+
<dd>Temperature in °C.</dd>
|
|
85
|
+
<dt>payload.pressure_pa <span class="property-type">number</span></dt>
|
|
86
|
+
<dd>Pressure in pascals (1 Pa = 0.01 mbar).</dd>
|
|
87
|
+
</dl>
|
|
88
|
+
<h3>Configuration</h3>
|
|
89
|
+
<p>I²C bus number, I²C address (0x76 / 0x77) and the oversampling ratio (256 to 4096), set in the <b>ms5611-device</b> config node.</p>
|
|
90
|
+
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = function(RED) {
|
|
4
|
+
const { I2CConnection } = require('periph/src/connection/i2c');
|
|
5
|
+
const { MS5611Full } = require('periph/src/chips/pressure/ms5611');
|
|
6
|
+
|
|
7
|
+
function MS5611DeviceNode(config) {
|
|
8
|
+
RED.nodes.createNode(this, config);
|
|
9
|
+
const node = this;
|
|
10
|
+
try {
|
|
11
|
+
const address = parseInt(config.address, 16) || 0x77;
|
|
12
|
+
const connection = new I2CConnection(parseInt(config.bus), address);
|
|
13
|
+
node.connection = connection;
|
|
14
|
+
node.driver = new MS5611Full(connection);
|
|
15
|
+
node.ready = (async () => {
|
|
16
|
+
await node.driver.init();
|
|
17
|
+
const osr = parseInt(config.oversampling);
|
|
18
|
+
node.driver.setOversampling(isNaN(osr) ? 4096 : osr);
|
|
19
|
+
})();
|
|
20
|
+
node.ready.catch((e) => {
|
|
21
|
+
node.error('MS5611 init failed: ' + e.message);
|
|
22
|
+
});
|
|
23
|
+
} catch (e) {
|
|
24
|
+
node.error('MS5611 init failed: ' + e.message);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
node.on('close', function() {
|
|
28
|
+
if (node.connection) node.connection.close();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
RED.nodes.registerType('ms5611-device', MS5611DeviceNode);
|
|
32
|
+
|
|
33
|
+
function MS5611ReadNode(config) {
|
|
34
|
+
RED.nodes.createNode(this, config);
|
|
35
|
+
const node = this;
|
|
36
|
+
const deviceNode = RED.nodes.getNode(config.device) || {};
|
|
37
|
+
|
|
38
|
+
node.on('input', async function(msg, send, done) {
|
|
39
|
+
if (!deviceNode.driver) {
|
|
40
|
+
node.error('MS5611 not initialised', msg);
|
|
41
|
+
done();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
await deviceNode.ready;
|
|
46
|
+
const { temperature_c, pressure_pa } = await deviceNode.driver.read();
|
|
47
|
+
msg.payload = { temperature_c, pressure_pa };
|
|
48
|
+
send(msg);
|
|
49
|
+
done();
|
|
50
|
+
} catch (e) {
|
|
51
|
+
done(e);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
RED.nodes.registerType('ms5611', MS5611ReadNode);
|
|
56
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<!-- Config node: one instance per physical device -->
|
|
2
|
+
<script type="text/javascript">
|
|
3
|
+
RED.nodes.registerType('spl06-device', {
|
|
4
|
+
category: 'config',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' },
|
|
7
|
+
bus: { value: '1', required: true, validate: RED.validators.number() },
|
|
8
|
+
address: { value: '0x77' },
|
|
9
|
+
oversampling: { value: '16' }
|
|
10
|
+
},
|
|
11
|
+
label: function() {
|
|
12
|
+
return this.name || ('SPL06 @ ' + this.address + ' (bus ' + this.bus + ')');
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script type="text/html" data-template-name="spl06-device">
|
|
18
|
+
<div class="form-row">
|
|
19
|
+
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
20
|
+
<input type="text" id="node-config-input-name" placeholder="SPL06">
|
|
21
|
+
</div>
|
|
22
|
+
<div class="form-row">
|
|
23
|
+
<label for="node-config-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
|
|
24
|
+
<input type="number" id="node-config-input-bus" min="0" style="width:80px"> (Linux /dev/i2c-N)
|
|
25
|
+
</div>
|
|
26
|
+
<div class="form-row">
|
|
27
|
+
<label for="node-config-input-address"><i class="fa fa-microchip"></i> I²C address</label>
|
|
28
|
+
<select id="node-config-input-address" style="width:120px">
|
|
29
|
+
<option value="0x77" selected>0x77 (SDO high / open)</option>
|
|
30
|
+
<option value="0x76">0x76 (SDO low)</option>
|
|
31
|
+
</select>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="form-row">
|
|
34
|
+
<label for="node-config-input-oversampling"><i class="fa fa-cog"></i> Pressure oversampling</label>
|
|
35
|
+
<select id="node-config-input-oversampling" style="width:120px">
|
|
36
|
+
<option value="1">1×</option><option value="2">2×</option><option value="4">4×</option>
|
|
37
|
+
<option value="8">8×</option><option value="16" selected>16×</option><option value="32">32×</option>
|
|
38
|
+
<option value="64">64×</option><option value="128">128×</option>
|
|
39
|
+
</select>
|
|
40
|
+
</div>
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<!-- Read node -->
|
|
44
|
+
<script type="text/javascript">
|
|
45
|
+
RED.nodes.registerType('spl06', {
|
|
46
|
+
category: 'Peripheral',
|
|
47
|
+
color: '#C084FC',
|
|
48
|
+
defaults: {
|
|
49
|
+
name: { value: '' },
|
|
50
|
+
device: { value: '', type: 'spl06-device', required: true }
|
|
51
|
+
},
|
|
52
|
+
inputs: 1,
|
|
53
|
+
outputs: 1,
|
|
54
|
+
icon: 'bridge.svg',
|
|
55
|
+
label: function() { return this.name || 'SPL06'; },
|
|
56
|
+
paletteLabel: 'SPL06'
|
|
57
|
+
});
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<script type="text/html" data-template-name="spl06">
|
|
61
|
+
<div class="form-row">
|
|
62
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
63
|
+
<input type="text" id="node-input-name" placeholder="SPL06">
|
|
64
|
+
</div>
|
|
65
|
+
<div class="form-row">
|
|
66
|
+
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
67
|
+
<input type="text" id="node-input-device">
|
|
68
|
+
</div>
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<script type="text/html" data-help-name="spl06">
|
|
72
|
+
<p>Reads temperature and absolute pressure from a Goertek SPL06-007 over I²C (address 0x77 or 0x76),
|
|
73
|
+
one compensated measurement per message.</p>
|
|
74
|
+
<h3>Inputs</h3>
|
|
75
|
+
<dl class="message-properties">
|
|
76
|
+
<dt>payload <span class="property-type">any</span></dt>
|
|
77
|
+
<dd>Any incoming message triggers one temperature and one pressure measurement.</dd>
|
|
78
|
+
</dl>
|
|
79
|
+
<h3>Outputs</h3>
|
|
80
|
+
<dl class="message-properties">
|
|
81
|
+
<dt>payload.temperature_c <span class="property-type">number</span></dt>
|
|
82
|
+
<dd>Temperature in degrees Celsius.</dd>
|
|
83
|
+
<dt>payload.pressure_pa <span class="property-type">number</span></dt>
|
|
84
|
+
<dd>Absolute pressure in pascals.</dd>
|
|
85
|
+
</dl>
|
|
86
|
+
<h3>Configuration</h3>
|
|
87
|
+
<dl class="message-properties">
|
|
88
|
+
<dt>I²C bus <span class="property-type">number</span></dt>
|
|
89
|
+
<dd>Linux bus number N of <code>/dev/i2c-N</code>.</dd>
|
|
90
|
+
<dt>I²C address <span class="property-type">0x76 | 0x77</span></dt>
|
|
91
|
+
<dd>0x77 with SDO high or open (default), 0x76 with SDO low.</dd>
|
|
92
|
+
<dt>Pressure oversampling <span class="property-type">1–128</span></dt>
|
|
93
|
+
<dd>More oversampling lowers the noise (16× ≈ 0.5 Pa RMS) but lengthens each measurement
|
|
94
|
+
(16×: about 28 ms, 128×: about 207 ms). The temperature always uses the external sensor at 1×.</dd>
|
|
95
|
+
</dl>
|
|
96
|
+
<h3>Details</h3>
|
|
97
|
+
<p>The chip stays in standby between messages. Its calibration coefficients are read once at start-up.</p>
|
|
98
|
+
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = function(RED) {
|
|
4
|
+
const { I2CConnection } = require('periph/src/connection/i2c');
|
|
5
|
+
const { SPL06Full } = require('periph/src/chips/pressure/spl06');
|
|
6
|
+
|
|
7
|
+
function SPL06DeviceNode(config) {
|
|
8
|
+
RED.nodes.createNode(this, config);
|
|
9
|
+
const node = this;
|
|
10
|
+
try {
|
|
11
|
+
const address = parseInt(config.address, 16) || 0x77;
|
|
12
|
+
const connection = new I2CConnection(parseInt(config.bus), address);
|
|
13
|
+
node.connection = connection;
|
|
14
|
+
node.driver = new SPL06Full(connection);
|
|
15
|
+
node.ready = (async () => {
|
|
16
|
+
await node.driver.init();
|
|
17
|
+
const osr = parseInt(config.oversampling);
|
|
18
|
+
await node.driver.setPressureConfig(isNaN(osr) ? 16 : osr, 1);
|
|
19
|
+
})();
|
|
20
|
+
node.ready.catch((e) => {
|
|
21
|
+
node.error('SPL06 init failed: ' + e.message);
|
|
22
|
+
});
|
|
23
|
+
} catch (e) {
|
|
24
|
+
node.error('SPL06 init failed: ' + e.message);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
node.on('close', function() {
|
|
28
|
+
if (node.connection) node.connection.close();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
RED.nodes.registerType('spl06-device', SPL06DeviceNode);
|
|
32
|
+
|
|
33
|
+
function SPL06ReadNode(config) {
|
|
34
|
+
RED.nodes.createNode(this, config);
|
|
35
|
+
const node = this;
|
|
36
|
+
const deviceNode = RED.nodes.getNode(config.device) || {};
|
|
37
|
+
|
|
38
|
+
node.on('input', async function(msg, send, done) {
|
|
39
|
+
if (!deviceNode.driver) {
|
|
40
|
+
node.error('SPL06 not initialised', msg);
|
|
41
|
+
done();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
await deviceNode.ready;
|
|
46
|
+
const { temperature_c, pressure_pa } = await deviceNode.driver.read();
|
|
47
|
+
msg.payload = { temperature_c, pressure_pa };
|
|
48
|
+
send(msg);
|
|
49
|
+
done();
|
|
50
|
+
} catch (e) {
|
|
51
|
+
done(e);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
RED.nodes.registerType('spl06', SPL06ReadNode);
|
|
56
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-periph-pressure",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Node-RED nodes for pressure sensor chips: BMP085, BMP180, BMP280, BMP384, BMP581, LPS22DF, LPS22HB, LPS28DFW, LPS33HW, MPL115A2",
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "Node-RED nodes for pressure sensor chips: BMP085, BMP180, BMP280, BMP384, BMP581, LPS22DF, LPS22HB, LPS28DFW, LPS33HW, MPL115A2, MPL3115A2, MS5607, MS5611, SPL06",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node-red",
|
|
7
7
|
"pressure",
|
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
"lps22hb",
|
|
20
20
|
"lps28dfw",
|
|
21
21
|
"lps33hw",
|
|
22
|
-
"mpl115a2"
|
|
22
|
+
"mpl115a2",
|
|
23
|
+
"mpl3115a2",
|
|
24
|
+
"ms5607",
|
|
25
|
+
"ms5611",
|
|
26
|
+
"spl06"
|
|
23
27
|
],
|
|
24
28
|
"node-red": {
|
|
25
29
|
"version": ">=3.0.0",
|
|
@@ -33,11 +37,27 @@
|
|
|
33
37
|
"lps33hw": "nodes/lps33hw/lps33hw.js",
|
|
34
38
|
"lps22hb": "nodes/lps22hb/lps22hb.js",
|
|
35
39
|
"lps22df": "nodes/lps22df/lps22df.js",
|
|
36
|
-
"mpl115a2": "nodes/mpl115a2/mpl115a2.js"
|
|
40
|
+
"mpl115a2": "nodes/mpl115a2/mpl115a2.js",
|
|
41
|
+
"mpl3115a2": "nodes/mpl3115a2/mpl3115a2.js",
|
|
42
|
+
"ms5607": "nodes/ms5607/ms5607.js",
|
|
43
|
+
"ms5611": "nodes/ms5611/ms5611.js",
|
|
44
|
+
"spl06": "nodes/spl06/spl06.js"
|
|
37
45
|
}
|
|
38
46
|
},
|
|
39
47
|
"dependencies": {
|
|
40
48
|
"periph": "*"
|
|
41
49
|
},
|
|
42
|
-
"license": "MIT"
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/tuhde/Periph/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/tuhde/Periph/tree/main/nodejs/packages/node-red-contrib-periph-pressure#readme",
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "git+https://github.com/tuhde/Periph.git",
|
|
61
|
+
"directory": "nodejs/packages/node-red-contrib-periph-pressure"
|
|
62
|
+
}
|
|
43
63
|
}
|