node-red-contrib-periph-pressure 1.5.0 → 1.5.2

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 CHANGED
@@ -17,21 +17,25 @@ npm install node-red-contrib-periph-pressure
17
17
  | Node | Kind | Description |
18
18
  |------|------|-------------|
19
19
  | `bmp085-device` | config | Bus configuration for a BMP085 |
20
- | `periph-bmp085` | input | Reads temperature and pressure from a BMP085 barometric pressure sensor over I²C. |
20
+ | `bmp085` | input | Reads temperature and pressure from a BMP085 barometric pressure sensor over I²C. |
21
21
  | `bmp180-device` | config | Bus configuration for a BMP180 |
22
- | `periph-bmp180` | input | Reads temperature and pressure from a BMP180 barometric pressure sensor over I²C. |
22
+ | `bmp180` | input | Reads temperature and pressure from a BMP180 barometric pressure sensor over I²C. |
23
23
  | `bmp280-device` | config | Bus configuration for a BMP280 |
24
- | `periph-bmp280` | input | Reads temperature, pressure, and altitude from a BMP280 barometric pressure sensor. |
24
+ | `bmp280` | input | Reads temperature, pressure, and altitude from a BMP280 barometric pressure sensor. |
25
25
  | `bmp384-device` | config | Bus configuration for a BMP384 |
26
- | `periph-bmp384` | input | Reads temperature, pressure, and altitude from a BMP384 barometric pressure sensor. |
26
+ | `bmp384` | input | Reads temperature, pressure, and altitude from a BMP384 barometric pressure sensor. |
27
27
  | `bmp581-device` | config | Bus configuration for a BMP581 |
28
- | `periph-bmp581` | input | Reads pressure, temperature, and altitude from a BMP581 barometric pressure sensor. |
28
+ | `bmp581` | input | Reads pressure, temperature, and altitude from a BMP581 barometric pressure sensor. |
29
29
  | `lps22df-device` | config | Bus configuration for a LPS22DF |
30
- | `periph-lps22df` | input | Reads pressure, temperature, and altitude from an LPS22DF absolute pressure sensor. |
30
+ | `lps22df` | input | Reads pressure, temperature, and altitude from an LPS22DF absolute pressure sensor. |
31
+ | `lps22hb-device` | config | Bus configuration for a LPS22HB |
32
+ | `lps22hb` | input | Reads pressure and temperature from an LPS22HB MEMS nano absolute pressure sensor. |
31
33
  | `lps28dfw-device` | config | Bus configuration for a LPS28DFW |
32
- | `periph-lps28dfw` | input | Reads pressure, temperature, and altitude from an LPS28DFW dual full-scale digital barometer. |
34
+ | `lps28dfw` | input | Reads pressure, temperature, and altitude from an LPS28DFW dual full-scale digital barometer. |
33
35
  | `lps33hw-device` | config | Bus configuration for a LPS33HW |
34
- | `periph-lps33hw` | input | Reads pressure and temperature from an LPS33HW water-resistant MEMS absolute pressure sensor. |
36
+ | `lps33hw` | input | Reads pressure and temperature from an LPS33HW water-resistant MEMS absolute pressure sensor. |
37
+ | `mpl115a2-device` | config | Bus configuration for a MPL115A2 |
38
+ | `mpl115a2` | input | Reads the barometric pressure (50–115 kPa) and an approximate temperature from an NXP MPL115A2 over I²C (address 0x60). |
35
39
 
36
40
  ## Links
37
41
 
@@ -8,7 +8,7 @@
8
8
  },
9
9
  {
10
10
  "id": "bmp085-read-1",
11
- "type": "periph-bmp085",
11
+ "type": "bmp085",
12
12
  "name": "BMP085",
13
13
  "device": "bmp085-device-1",
14
14
  "seaLevelPa": "101325",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  {
10
10
  "id": "bmp180-read-1",
11
- "type": "periph-bmp180",
11
+ "type": "bmp180",
12
12
  "name": "BMP180",
13
13
  "device": "bmp180-device-1",
14
14
  "seaLevelHpa": "1013.25",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  {
15
15
  "id": "bmp280-read-1",
16
- "type": "periph-bmp280",
16
+ "type": "bmp280",
17
17
  "name": "BMP280 Weather",
18
18
  "device": "bmp280-device-1",
19
19
  "seaLevelHpa": "1013.25",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  {
39
39
  "id": "bmp384_read",
40
- "type": "periph-bmp384",
40
+ "type": "bmp384",
41
41
  "z": "bmp384_demo_tab",
42
42
  "name": "BMP384",
43
43
  "device": "bmp384_device",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  {
14
14
  "id": "bmp581-read-1",
15
- "type": "periph-bmp581",
15
+ "type": "bmp581",
16
16
  "name": "BMP581 Pressure/Temperature/Altitude",
17
17
  "device": "bmp581-device-1",
18
18
  "seaLevelPa": "101325",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  {
15
15
  "id": "lps22df-read-1",
16
- "type": "periph-lps22df",
16
+ "type": "lps22df",
17
17
  "name": "LPS22DF Altimeter",
18
18
  "device": "lps22df-device-1",
19
19
  "seaLevelPa": "101325",
@@ -0,0 +1,141 @@
1
+ [
2
+ {
3
+ "id": "lps22hb-device-1",
4
+ "type": "lps22hb-device",
5
+ "name": "LPS22HB @ i2c-1",
6
+ "bus": "1",
7
+ "addr": "0x5C",
8
+ "odr": "2",
9
+ "bdu": "1",
10
+ "enLpfp": "1",
11
+ "lpfpCfg": "1",
12
+ "lcEn": "0",
13
+ "sim": "0"
14
+ },
15
+ {
16
+ "id": "lps22hb-read-1",
17
+ "type": "lps22hb",
18
+ "name": "LPS22HB Altimeter",
19
+ "device": "lps22hb-device-1",
20
+ "wires": [["function-alt-1", "debug-1", "chart-pres-1", "chart-alt-1", "chart-temp-1"]]
21
+ },
22
+ {
23
+ "id": "inject-timer-1",
24
+ "type": "inject",
25
+ "name": "Every 1 second",
26
+ "topic": "",
27
+ "payload": "",
28
+ "payloadType": "date",
29
+ "repeat": "1",
30
+ "crontab": "",
31
+ "onceDelay": "0.1",
32
+ "wires": [["lps22hb-read-1"]]
33
+ },
34
+ {
35
+ "id": "function-alt-1",
36
+ "type": "function",
37
+ "name": "Compute altitude",
38
+ "func": "if (msg.payload && typeof msg.payload.pressure_Pa === 'number') {\n const p = msg.payload.pressure_Pa;\n msg.payload.altitude_m = 44330 * (1 - Math.pow(p / 101325, 1 / 5.255));\n}\nreturn msg;",
39
+ "outputs": 1,
40
+ "noerr": 0,
41
+ "x": 480,
42
+ "y": 200,
43
+ "wires": [["chart-alt-1"]]
44
+ },
45
+ {
46
+ "id": "inject-autozero-1",
47
+ "type": "inject",
48
+ "name": "AUTOZERO every 10 s",
49
+ "topic": "",
50
+ "payload": "",
51
+ "payloadType": "date",
52
+ "repeat": "10",
53
+ "crontab": "",
54
+ "onceDelay": "1",
55
+ "wires": [["autozero-function-1"]]
56
+ },
57
+ {
58
+ "id": "autozero-function-1",
59
+ "type": "function",
60
+ "name": "Refresh AUTOZERO reference",
61
+ "func": "var device = RED.nodes.getNode('lps22hb-device-1');\nif (device && device.driver) {\n device.driver.setAutozero();\n node.status({text: 'autozero @ ' + new Date().toISOString().substr(11, 8)});\n}\nreturn msg;",
62
+ "outputs": 1,
63
+ "noerr": 0,
64
+ "x": 480,
65
+ "y": 280,
66
+ "wires": [[]]
67
+ },
68
+ {
69
+ "id": "debug-1",
70
+ "type": "debug",
71
+ "name": "Debug output",
72
+ "active": true,
73
+ "tosidebar": true,
74
+ "console": false,
75
+ "tostatus": false,
76
+ "complete": "payload",
77
+ "targetType": "msg",
78
+ "x": 700,
79
+ "y": 200,
80
+ "wires": []
81
+ },
82
+ {
83
+ "id": "chart-pres-1",
84
+ "type": "ui_chart",
85
+ "name": "Pressure",
86
+ "group": "lps22hb-group-1",
87
+ "order": 1,
88
+ "width": 6,
89
+ "height": 4,
90
+ "label": "Pressure (Pa)",
91
+ "chartType": "line",
92
+ "x": 700,
93
+ "y": 260,
94
+ "wires": []
95
+ },
96
+ {
97
+ "id": "chart-alt-1",
98
+ "type": "ui_chart",
99
+ "name": "Altitude",
100
+ "group": "lps22hb-group-1",
101
+ "order": 2,
102
+ "width": 6,
103
+ "height": 4,
104
+ "label": "Altitude (m)",
105
+ "chartType": "line",
106
+ "x": 700,
107
+ "y": 320,
108
+ "wires": []
109
+ },
110
+ {
111
+ "id": "chart-temp-1",
112
+ "type": "ui_chart",
113
+ "name": "Temperature",
114
+ "group": "lps22hb-group-1",
115
+ "order": 3,
116
+ "width": 6,
117
+ "height": 4,
118
+ "label": "Temperature (°C)",
119
+ "chartType": "line",
120
+ "x": 700,
121
+ "y": 380,
122
+ "wires": []
123
+ },
124
+ {
125
+ "id": "lps22hb-group-1",
126
+ "type": "ui_group",
127
+ "name": "LPS22HB Altimeter",
128
+ "tab": "lps22hb-tab-1",
129
+ "order": 1,
130
+ "disp": true,
131
+ "width": 12
132
+ },
133
+ {
134
+ "id": "lps22hb-tab-1",
135
+ "type": "ui_tab",
136
+ "name": "LPS22HB Demo",
137
+ "icon": "dashboard",
138
+ "order": 1,
139
+ "info": "This flow demonstrates the LPS22HB MEMS nano pressure sensor as an altimeter.\n\nThe device config node sets **10 Hz ODR with the ODR/20 low-pass filter enabled** — a fresh pressure sample every 100 ms with the on-chip LPF (~0.5 Hz cutoff) suppressing door-slam and HVAC noise. An inject node fires every second; each tick reads pressure (Pa) and temperature (°C). A function node converts the pressure to relative altitude using the barometric formula `44330 * (1 - (p / 101325)^(1/5.255))`.\n\nBecause atmospheric pressure drifts with the weather (~1 hPa per ~8 m of equivalent altitude), the AUTOZERO reference is refreshed every 10 s via a second inject + function node pair. This makes the altitude chart a true *relative* measurement — climb one floor (~3 m) and watch the trace shift, then return.\n\nAdjust the I²C bus, address (0x5C for SA0=GND, 0x5D for SA0=VDD), ODR, and LPF bandwidth in the device config node. Drop ODR to 1 Hz and disable the LPF for battery-powered weather monitoring instead of altimetry."
140
+ }
141
+ ]
@@ -13,7 +13,7 @@
13
13
  },
14
14
  {
15
15
  "id": "lps28dfw-read-1",
16
- "type": "periph-lps28dfw",
16
+ "type": "lps28dfw",
17
17
  "name": "LPS28DFW Weather",
18
18
  "device": "lps28dfw-device-1",
19
19
  "seaLevelHpa": "1013.25",
@@ -65,6 +65,6 @@
65
65
  "type": "tab",
66
66
  "label": "LPS28DFW weather",
67
67
  "disabled": false,
68
- "info": "An inject node fires every 5 seconds, triggering the periph-lps28dfw node which reads pressure and temperature from the LPS28DFW dual full-scale digital barometer. The node also computes an estimated altitude from the barometric formula using a configurable sea-level reference (default 1013.25 hPa). The debug tab displays pressure (hPa), temperature (°C), and altitude (m). Adjust the lps28dfw-device config node to switch between Mode 1 (0–1260 hPa) and Mode 2 (0–4060 hPa) full-scale, change the averaging depth (4 to 512 samples), set the output data rate, and enable/disable the IIR low-pass filter."
68
+ "info": "An inject node fires every 5 seconds, triggering the lps28dfw node which reads pressure and temperature from the LPS28DFW dual full-scale digital barometer. The node also computes an estimated altitude from the barometric formula using a configurable sea-level reference (default 1013.25 hPa). The debug tab displays pressure (hPa), temperature (°C), and altitude (m). Adjust the lps28dfw-device config node to switch between Mode 1 (0–1260 hPa) and Mode 2 (0–4060 hPa) full-scale, change the averaging depth (4 to 512 samples), set the output data rate, and enable/disable the IIR low-pass filter."
69
69
  }
70
70
  ]
@@ -14,7 +14,7 @@
14
14
  },
15
15
  {
16
16
  "id": "lps33hw-read-1",
17
- "type": "periph-lps33hw",
17
+ "type": "lps33hw",
18
18
  "name": "LPS33HW Altimeter",
19
19
  "device": "lps33hw-device-1",
20
20
  "wires": [["function-alt-1", "debug-1", "chart-pres-1", "chart-alt-1", "chart-temp-1"]]
@@ -0,0 +1,66 @@
1
+ [
2
+ {
3
+ "id": "mpl115a2-tab",
4
+ "type": "tab",
5
+ "label": "MPL115A2 demo",
6
+ "disabled": false,
7
+ "info": "Barometer: an inject node triggers a conversion every 5 s; the mpl115a2 node outputs { pressure_pa, temperature_c }; a function node converts the pressure to hPa for the debug sidebar."
8
+ },
9
+ {
10
+ "id": "mpl115a2-device-1",
11
+ "type": "mpl115a2-device",
12
+ "name": "MPL115A2 @ i2c-1",
13
+ "bus": "1"
14
+ },
15
+ {
16
+ "id": "mpl115a2-read-1",
17
+ "type": "mpl115a2",
18
+ "z": "mpl115a2-tab",
19
+ "name": "MPL115A2",
20
+ "device": "mpl115a2-device-1",
21
+ "x": 330,
22
+ "y": 120,
23
+ "wires": [["mpl115a2-hpa-1"]]
24
+ },
25
+ {
26
+ "id": "mpl115a2-inject-1",
27
+ "type": "inject",
28
+ "z": "mpl115a2-tab",
29
+ "name": "Every 5 seconds",
30
+ "topic": "",
31
+ "payload": "",
32
+ "payloadType": "date",
33
+ "repeat": "5",
34
+ "crontab": "",
35
+ "once": true,
36
+ "onceDelay": "0.1",
37
+ "x": 130,
38
+ "y": 120,
39
+ "wires": [["mpl115a2-read-1"]]
40
+ },
41
+ {
42
+ "id": "mpl115a2-hpa-1",
43
+ "type": "function",
44
+ "z": "mpl115a2-tab",
45
+ "name": "Pa to hPa",
46
+ "func": "msg.payload.pressure_hpa = msg.payload.pressure_pa / 100;\nnode.status({text: msg.payload.pressure_hpa.toFixed(1) + ' hPa'});\nreturn msg;",
47
+ "outputs": 1,
48
+ "noerr": 0,
49
+ "x": 520,
50
+ "y": 120,
51
+ "wires": [["mpl115a2-debug-1"]]
52
+ },
53
+ {
54
+ "id": "mpl115a2-debug-1",
55
+ "type": "debug",
56
+ "z": "mpl115a2-tab",
57
+ "name": "Debug output",
58
+ "active": true,
59
+ "console": "false",
60
+ "complete": "payload",
61
+ "targetType": "msg",
62
+ "x": 710,
63
+ "y": 120,
64
+ "wires": []
65
+ }
66
+ ]
@@ -35,7 +35,7 @@
35
35
 
36
36
  <!-- Read node: trigger → measurements -->
37
37
  <script type="text/javascript">
38
- RED.nodes.registerType('periph-bmp085', {
38
+ RED.nodes.registerType('bmp085', {
39
39
  category: 'Peripheral',
40
40
  color: '#C084FC',
41
41
  defaults: {
@@ -51,7 +51,7 @@
51
51
  });
52
52
  </script>
53
53
 
54
- <script type="text/html" data-template-name="periph-bmp085">
54
+ <script type="text/html" data-template-name="bmp085">
55
55
  <div class="form-row">
56
56
  <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
57
57
  <input type="text" id="node-input-device">
@@ -66,7 +66,7 @@
66
66
  </div>
67
67
  </script>
68
68
 
69
- <script type="text/html" data-help-name="periph-bmp085">
69
+ <script type="text/html" data-help-name="bmp085">
70
70
  <p>Reads temperature and pressure from a BMP085 barometric pressure sensor over I²C.</p>
71
71
  <p>Any input message triggers a measurement. The device is configured via a <b>bmp085-device</b> config node.</p>
72
72
 
@@ -45,5 +45,5 @@ module.exports = function(RED) {
45
45
  }
46
46
  });
47
47
  }
48
- RED.nodes.registerType('periph-bmp085', BMP085ReadNode);
48
+ RED.nodes.registerType('bmp085', BMP085ReadNode);
49
49
  };
@@ -35,7 +35,7 @@
35
35
 
36
36
  <!-- Read node: trigger → measurements -->
37
37
  <script type="text/javascript">
38
- RED.nodes.registerType('periph-bmp180', {
38
+ RED.nodes.registerType('bmp180', {
39
39
  category: 'Peripheral',
40
40
  color: '#C084FC',
41
41
  defaults: {
@@ -51,7 +51,7 @@
51
51
  });
52
52
  </script>
53
53
 
54
- <script type="text/html" data-template-name="periph-bmp180">
54
+ <script type="text/html" data-template-name="bmp180">
55
55
  <div class="form-row">
56
56
  <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
57
57
  <input type="text" id="node-input-device">
@@ -66,7 +66,7 @@
66
66
  </div>
67
67
  </script>
68
68
 
69
- <script type="text/html" data-help-name="periph-bmp180">
69
+ <script type="text/html" data-help-name="bmp180">
70
70
  <p>Reads temperature and pressure from a BMP180 barometric pressure sensor over I²C.</p>
71
71
  <p>Any input message triggers a measurement. The device is configured via a <b>bmp180-device</b> config node.</p>
72
72
 
@@ -45,5 +45,5 @@ module.exports = function(RED) {
45
45
  }
46
46
  });
47
47
  }
48
- RED.nodes.registerType('periph-bmp180', BMP180ReadNode);
48
+ RED.nodes.registerType('bmp180', BMP180ReadNode);
49
49
  };
@@ -90,7 +90,7 @@
90
90
 
91
91
  <!-- Read node: trigger → measurements -->
92
92
  <script type="text/javascript">
93
- RED.nodes.registerType('periph-bmp280', {
93
+ RED.nodes.registerType('bmp280', {
94
94
  category: 'Peripheral',
95
95
  color: '#C084FC',
96
96
  defaults: {
@@ -106,7 +106,7 @@
106
106
  });
107
107
  </script>
108
108
 
109
- <script type="text/html" data-template-name="periph-bmp280">
109
+ <script type="text/html" data-template-name="bmp280">
110
110
  <div class="form-row">
111
111
  <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
112
112
  <input type="text" id="node-input-device">
@@ -121,7 +121,7 @@
121
121
  </div>
122
122
  </script>
123
123
 
124
- <script type="text/html" data-help-name="periph-bmp280">
124
+ <script type="text/html" data-help-name="bmp280">
125
125
  <p>Reads temperature, pressure, and altitude from a BMP280 barometric pressure sensor.</p>
126
126
  <p>Any input message triggers a measurement. The device is configured via a <b>bmp280-device</b> config node.</p>
127
127
 
@@ -53,5 +53,5 @@ module.exports = function(RED) {
53
53
  }
54
54
  });
55
55
  }
56
- RED.nodes.registerType('periph-bmp280', BMP280ReadNode);
56
+ RED.nodes.registerType('bmp280', BMP280ReadNode);
57
57
  };
@@ -90,7 +90,7 @@
90
90
 
91
91
  <!-- Read node: trigger → measurements -->
92
92
  <script type="text/javascript">
93
- RED.nodes.registerType('periph-bmp384', {
93
+ RED.nodes.registerType('bmp384', {
94
94
  category: 'Peripheral',
95
95
  color: '#C084FC',
96
96
  defaults: {
@@ -106,7 +106,7 @@
106
106
  });
107
107
  </script>
108
108
 
109
- <script type="text/html" data-template-name="periph-bmp384">
109
+ <script type="text/html" data-template-name="bmp384">
110
110
  <div class="form-row">
111
111
  <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
112
112
  <input type="text" id="node-input-device">
@@ -121,7 +121,7 @@
121
121
  </div>
122
122
  </script>
123
123
 
124
- <script type="text/html" data-help-name="periph-bmp384">
124
+ <script type="text/html" data-help-name="bmp384">
125
125
  <p>Reads temperature, pressure, and altitude from a BMP384 barometric pressure sensor.</p>
126
126
  <p>Any input message triggers a measurement. The device is configured via a <b>bmp384-device</b> config node.</p>
127
127
 
@@ -52,5 +52,5 @@ module.exports = function(RED) {
52
52
  }
53
53
  });
54
54
  }
55
- RED.nodes.registerType('periph-bmp384', BMP384ReadNode);
55
+ RED.nodes.registerType('bmp384', BMP384ReadNode);
56
56
  };
@@ -83,7 +83,7 @@
83
83
 
84
84
  <!-- Read node: trigger → measurements -->
85
85
  <script type="text/javascript">
86
- RED.nodes.registerType('periph-bmp581', {
86
+ RED.nodes.registerType('bmp581', {
87
87
  category: 'Peripheral',
88
88
  color: '#C084FC',
89
89
  defaults: {
@@ -99,7 +99,7 @@
99
99
  });
100
100
  </script>
101
101
 
102
- <script type="text/html" data-template-name="periph-bmp581">
102
+ <script type="text/html" data-template-name="bmp581">
103
103
  <div class="form-row">
104
104
  <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
105
105
  <input type="text" id="node-input-device">
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
  </script>
116
116
 
117
- <script type="text/html" data-help-name="periph-bmp581">
117
+ <script type="text/html" data-help-name="bmp581">
118
118
  <p>Reads pressure, temperature, and altitude from a BMP581 barometric pressure sensor.</p>
119
119
  <p>Any input message triggers a measurement. The device is configured via a <b>bmp581-device</b> config node.</p>
120
120
 
@@ -52,5 +52,5 @@ module.exports = function(RED) {
52
52
  }
53
53
  });
54
54
  }
55
- RED.nodes.registerType('periph-bmp581', BMP581ReadNode);
55
+ RED.nodes.registerType('bmp581', BMP581ReadNode);
56
56
  };
@@ -79,7 +79,7 @@
79
79
 
80
80
  <!--Read node: trigger -> measurements -->
81
81
  <script type="text/javascript">
82
- RED.nodes.registerType('periph-lps22df', {
82
+ RED.nodes.registerType('lps22df', {
83
83
  category: 'Peripheral',
84
84
  color: '#C084FC',
85
85
  defaults: {
@@ -95,7 +95,7 @@
95
95
  });
96
96
  </script>
97
97
 
98
- <script type="text/html" data-template-name="periph-lps22df">
98
+ <script type="text/html" data-template-name="lps22df">
99
99
  <div class="form-row">
100
100
  <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
101
101
  <input type="text" id="node-input-device">
@@ -110,7 +110,7 @@
110
110
  </div>
111
111
  </script>
112
112
 
113
- <script type="text/html" data-help-name="periph-lps22df">
113
+ <script type="text/html" data-help-name="lps22df">
114
114
  <p>Reads pressure, temperature, and altitude from an LPS22DF absolute pressure sensor.</p>
115
115
  <p>Any input message triggers a measurement. The device is configured via an <b>lps22df-device</b> config node.</p>
116
116
 
@@ -53,5 +53,5 @@ module.exports = function(RED) {
53
53
  }
54
54
  });
55
55
  }
56
- RED.nodes.registerType('periph-lps22df', LPS22DFReadNode);
56
+ RED.nodes.registerType('lps22df', LPS22DFReadNode);
57
57
  };
@@ -0,0 +1,137 @@
1
+ <!-- Config node: one instance per physical device -->
2
+ <script type="text/javascript">
3
+ RED.nodes.registerType('lps22hb-device', {
4
+ category: 'config',
5
+ defaults: {
6
+ name: { value: '' },
7
+ bus: { value: '1', required: true, validate: RED.validators.number() },
8
+ addr: { value: '0x5C', required: true },
9
+ odr: { value: '1', required: true, validate: RED.validators.number() },
10
+ bdu: { value: '1', required: true, validate: RED.validators.number() },
11
+ enLpfp: { value: '0', required: true, validate: RED.validators.number() },
12
+ lpfpCfg: { value: '0', required: true, validate: RED.validators.number() },
13
+ lcEn: { value: '0', required: true, validate: RED.validators.number() },
14
+ sim: { value: '0', required: true, validate: RED.validators.number() }
15
+ },
16
+ label: function() {
17
+ return this.name || ('LPS22HB @ ' + this.addr + ' (bus ' + this.bus + ')');
18
+ }
19
+ });
20
+ </script>
21
+
22
+ <script type="text/html" data-template-name="lps22hb-device">
23
+ <div class="form-row">
24
+ <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
25
+ <input type="text" id="node-config-input-name" placeholder="LPS22HB">
26
+ </div>
27
+ <div class="form-row">
28
+ <label for="node-config-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
29
+ <input type="number" id="node-config-input-bus" min="0" style="width:80px"> &nbsp;(Linux /dev/i2c-N)
30
+ </div>
31
+ <div class="form-row">
32
+ <label for="node-config-input-addr"><i class="fa fa-microchip"></i> I²C address</label>
33
+ <select id="node-config-input-addr" style="width:140px">
34
+ <option value="0x5C" selected>0x5C (SA0=GND)</option>
35
+ <option value="0x5D">0x5D (SA0=VDD)</option>
36
+ </select>
37
+ </div>
38
+ <div class="form-row">
39
+ <label for="node-config-input-odr">Output data rate</label>
40
+ <select id="node-config-input-odr" style="width:180px">
41
+ <option value="0">Power-down</option>
42
+ <option value="1" selected>1 Hz</option>
43
+ <option value="2">10 Hz</option>
44
+ <option value="3">25 Hz</option>
45
+ <option value="4">50 Hz</option>
46
+ <option value="5">75 Hz</option>
47
+ </select>
48
+ </div>
49
+ <div class="form-row">
50
+ <label for="node-config-input-bdu">Block data update</label>
51
+ <select id="node-config-input-bdu" style="width:120px">
52
+ <option value="0">Disable</option>
53
+ <option value="1" selected>Enable</option>
54
+ </select>
55
+ </div>
56
+ <div class="form-row">
57
+ <label for="node-config-input-enLpfp">Low-pass filter</label>
58
+ <select id="node-config-input-enLpfp" style="width:180px">
59
+ <option value="0" selected>Disabled</option>
60
+ <option value="1">Enabled</option>
61
+ </select>
62
+ </div>
63
+ <div class="form-row">
64
+ <label for="node-config-input-lpfpCfg">LPF bandwidth</label>
65
+ <select id="node-config-input-lpfpCfg" style="width:180px">
66
+ <option value="0" selected>ODR/9</option>
67
+ <option value="1">ODR/20</option>
68
+ </select>
69
+ </div>
70
+ <div class="form-row">
71
+ <label for="node-config-input-lcEn">Low-current mode</label>
72
+ <select id="node-config-input-lcEn" style="width:120px">
73
+ <option value="0" selected>Disabled</option>
74
+ <option value="1">Enabled</option>
75
+ </select>
76
+ </div>
77
+ <div class="form-row">
78
+ <label for="node-config-input-sim">SPI mode (3-wire)</label>
79
+ <select id="node-config-input-sim" style="width:120px">
80
+ <option value="0" selected>4-wire</option>
81
+ <option value="1">3-wire</option>
82
+ </select>
83
+ </div>
84
+ </script>
85
+
86
+ <!-- Read node: trigger → measurements -->
87
+ <script type="text/javascript">
88
+ RED.nodes.registerType('lps22hb', {
89
+ category: 'Peripheral',
90
+ color: '#C084FC',
91
+ defaults: {
92
+ name: { value: '' },
93
+ device: { value: '', type: 'lps22hb-device', required: true }
94
+ },
95
+ inputs: 1,
96
+ outputs: 1,
97
+ icon: 'font-awesome/fa-tachometer',
98
+ label: function() { return this.name || 'LPS22HB'; },
99
+ paletteLabel: 'LPS22HB'
100
+ });
101
+ </script>
102
+
103
+ <script type="text/html" data-template-name="lps22hb">
104
+ <div class="form-row">
105
+ <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
106
+ <input type="text" id="node-input-device">
107
+ </div>
108
+ <div class="form-row">
109
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
110
+ <input type="text" id="node-input-name" placeholder="LPS22HB">
111
+ </div>
112
+ </script>
113
+
114
+ <script type="text/html" data-help-name="lps22hb">
115
+ <p>Reads pressure and temperature from an LPS22HB MEMS nano absolute pressure sensor.</p>
116
+ <p>Any input message triggers a measurement. The device is configured via a <b>lps22hb-device</b> config node.</p>
117
+
118
+ <h3>Inputs</h3>
119
+ <dl class="message-properties">
120
+ <dt>payload <span class="property-type">any</span></dt>
121
+ <dd>Any incoming message triggers a measurement.</dd>
122
+ </dl>
123
+
124
+ <h3>Outputs</h3>
125
+ <dl class="message-properties">
126
+ <dt>payload.pressure_Pa <span class="property-type">number</span></dt>
127
+ <dd>Absolute pressure in pascals.</dd>
128
+ <dt>payload.temperature_C <span class="property-type">number</span></dt>
129
+ <dd>Temperature in degrees Celsius.</dd>
130
+ </dl>
131
+
132
+ <h3>Configuration</h3>
133
+ <p>Set the I²C bus number, I²C address (<code>0x5C</code> for SA0=GND or <code>0x5D</code> for SA0=VDD),
134
+ output data rate (1–75 Hz), block-data-update, low-pass filter enable and bandwidth (ODR/9 or ODR/20),
135
+ low-current mode, and SPI 3-wire mode in the device config node.
136
+ The 10 Hz ODR with ODR/20 LPF is a good starting point for altimeter / floor-detection applications.</p>
137
+ </script>
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ module.exports = function(RED) {
4
+ const { I2CConnection } = require('periph/src/connection/i2c');
5
+ const { LPS22HBFull } = require('periph/src/chips/pressure/lps22hb');
6
+
7
+ function LPS22HBDeviceNode(config) {
8
+ RED.nodes.createNode(this, config);
9
+ const node = this;
10
+ try {
11
+ const addr = parseInt(config.addr) || 0x5C;
12
+ const connection = new I2CConnection(parseInt(config.bus), addr);
13
+ node.driver = new LPS22HBFull(connection);
14
+ node.driver.configure(
15
+ parseInt(config.odr) || 1,
16
+ parseInt(config.bdu) ? 1 : 0,
17
+ parseInt(config.enLpfp) ? 1 : 0,
18
+ parseInt(config.lpfpCfg) || 0,
19
+ parseInt(config.lcEn) ? 1 : 0,
20
+ parseInt(config.sim) ? 1 : 0
21
+ );
22
+ node.connection = connection;
23
+ } catch (e) {
24
+ node.error('LPS22HB init failed: ' + e.message);
25
+ }
26
+ node.on('close', function() {
27
+ if (node.connection) node.connection.close();
28
+ });
29
+ }
30
+ RED.nodes.registerType('lps22hb-device', LPS22HBDeviceNode);
31
+
32
+ function LPS22HBReadNode(config) {
33
+ RED.nodes.createNode(this, config);
34
+ const node = this;
35
+ node.device = RED.nodes.getNode(config.device);
36
+
37
+ node.on('input', async function(msg, send, done) {
38
+ if (!node.device || !node.device.driver) {
39
+ node.error('No LPS22HB device configured', msg);
40
+ done();
41
+ return;
42
+ }
43
+ try {
44
+ const d = node.device.driver;
45
+ msg.payload = {
46
+ pressure_Pa: await d.pressure(),
47
+ temperature_C: await d.temperature()
48
+ };
49
+ send(msg);
50
+ done();
51
+ } catch (e) {
52
+ done(e);
53
+ }
54
+ });
55
+ }
56
+ RED.nodes.registerType('lps22hb', LPS22HBReadNode);
57
+ };
@@ -85,7 +85,7 @@
85
85
 
86
86
  <!-- Read node: trigger → measurements -->
87
87
  <script type="text/javascript">
88
- RED.nodes.registerType('periph-lps28dfw', {
88
+ RED.nodes.registerType('lps28dfw', {
89
89
  category: 'Peripheral',
90
90
  color: '#C084FC',
91
91
  defaults: {
@@ -101,7 +101,7 @@
101
101
  });
102
102
  </script>
103
103
 
104
- <script type="text/html" data-template-name="periph-lps28dfw">
104
+ <script type="text/html" data-template-name="lps28dfw">
105
105
  <div class="form-row">
106
106
  <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
107
107
  <input type="text" id="node-input-device">
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
  </script>
118
118
 
119
- <script type="text/html" data-help-name="periph-lps28dfw">
119
+ <script type="text/html" data-help-name="lps28dfw">
120
120
  <p>Reads pressure, temperature, and altitude from an LPS28DFW dual full-scale digital barometer.</p>
121
121
  <p>Any input message triggers a measurement. The device is configured via an <b>lps28dfw-device</b> config node.</p>
122
122
 
@@ -53,5 +53,5 @@ module.exports = function(RED) {
53
53
  }
54
54
  });
55
55
  }
56
- RED.nodes.registerType('periph-lps28dfw', LPS28DFWReadNode);
56
+ RED.nodes.registerType('lps28dfw', LPS28DFWReadNode);
57
57
  };
@@ -85,7 +85,7 @@
85
85
 
86
86
  <!-- Read node: trigger → measurements -->
87
87
  <script type="text/javascript">
88
- RED.nodes.registerType('periph-lps33hw', {
88
+ RED.nodes.registerType('lps33hw', {
89
89
  category: 'Peripheral',
90
90
  color: '#C084FC',
91
91
  defaults: {
@@ -100,7 +100,7 @@
100
100
  });
101
101
  </script>
102
102
 
103
- <script type="text/html" data-template-name="periph-lps33hw">
103
+ <script type="text/html" data-template-name="lps33hw">
104
104
  <div class="form-row">
105
105
  <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
106
106
  <input type="text" id="node-input-device">
@@ -111,7 +111,7 @@
111
111
  </div>
112
112
  </script>
113
113
 
114
- <script type="text/html" data-help-name="periph-lps33hw">
114
+ <script type="text/html" data-help-name="lps33hw">
115
115
  <p>Reads pressure and temperature from an LPS33HW water-resistant MEMS absolute pressure sensor.</p>
116
116
  <p>Any input message triggers a measurement. The device is configured via a <b>lps33hw-device</b> config node.</p>
117
117
 
@@ -53,5 +53,5 @@ module.exports = function(RED) {
53
53
  }
54
54
  });
55
55
  }
56
- RED.nodes.registerType('periph-lps33hw', LPS33HWReadNode);
56
+ RED.nodes.registerType('lps33hw', LPS33HWReadNode);
57
57
  };
@@ -0,0 +1,74 @@
1
+ <!-- Config node: one instance per physical device -->
2
+ <script type="text/javascript">
3
+ RED.nodes.registerType('mpl115a2-device', {
4
+ category: 'config',
5
+ defaults: {
6
+ name: { value: '' },
7
+ bus: { value: '1', required: true, validate: RED.validators.number() }
8
+ },
9
+ label: function() {
10
+ return this.name || ('MPL115A2 @ 0x60 (bus ' + this.bus + ')');
11
+ }
12
+ });
13
+ </script>
14
+
15
+ <script type="text/html" data-template-name="mpl115a2-device">
16
+ <div class="form-row">
17
+ <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
18
+ <input type="text" id="node-config-input-name" placeholder="MPL115A2">
19
+ </div>
20
+ <div class="form-row">
21
+ <label for="node-config-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
22
+ <input type="number" id="node-config-input-bus" min="0" style="width:80px"> &nbsp;(Linux /dev/i2c-N)
23
+ </div>
24
+ </script>
25
+
26
+ <!-- Read node: trigger → measurements -->
27
+ <script type="text/javascript">
28
+ RED.nodes.registerType('mpl115a2', {
29
+ category: 'Peripheral',
30
+ color: '#C084FC',
31
+ defaults: {
32
+ name: { value: '' },
33
+ device: { value: '', type: 'mpl115a2-device', required: true }
34
+ },
35
+ inputs: 1,
36
+ outputs: 1,
37
+ icon: 'font-awesome/fa-tachometer',
38
+ label: function() { return this.name || 'MPL115A2'; },
39
+ paletteLabel: 'MPL115A2'
40
+ });
41
+ </script>
42
+
43
+ <script type="text/html" data-template-name="mpl115a2">
44
+ <div class="form-row">
45
+ <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
46
+ <input type="text" id="node-input-device">
47
+ </div>
48
+ <div class="form-row">
49
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
50
+ <input type="text" id="node-input-name" placeholder="MPL115A2">
51
+ </div>
52
+ </script>
53
+
54
+ <script type="text/html" data-help-name="mpl115a2">
55
+ <p>Reads the barometric pressure (50–115 kPa) and an approximate temperature from an NXP MPL115A2 over I²C (address 0x60).</p>
56
+ <p>Any input message triggers one conversion (about 5 ms). The device is configured via an <b>mpl115a2-device</b> config node.</p>
57
+
58
+ <h3>Inputs</h3>
59
+ <dl class="message-properties">
60
+ <dt>payload <span class="property-type">any</span></dt>
61
+ <dd>Any incoming message triggers a measurement.</dd>
62
+ </dl>
63
+
64
+ <h3>Outputs</h3>
65
+ <dl class="message-properties">
66
+ <dt>payload.pressure_pa <span class="property-type">number</span></dt>
67
+ <dd>Compensated pressure in pascals.</dd>
68
+ <dt>payload.temperature_c <span class="property-type">number</span></dt>
69
+ <dd>Approximate temperature in degrees Celsius (uncalibrated, accurate to a few degrees — use for trends only).</dd>
70
+ </dl>
71
+
72
+ <h3>Configuration</h3>
73
+ <p>Set the I²C bus number in the device config node. The per-device compensation coefficients are read once at start-up.</p>
74
+ </script>
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ module.exports = function(RED) {
4
+ const { I2CConnection } = require('periph/src/connection/i2c');
5
+ const { MPL115A2Full } = require('periph/src/chips/pressure/mpl115a2');
6
+
7
+ function MPL115A2DeviceNode(config) {
8
+ RED.nodes.createNode(this, config);
9
+ const node = this;
10
+ try {
11
+ const connection = new I2CConnection(parseInt(config.bus), 0x60);
12
+ node.driver = new MPL115A2Full(connection);
13
+ node.connection = connection;
14
+ node.driver.ready.catch(function(e) { node.error('MPL115A2 init failed: ' + e.message); });
15
+ } catch (e) {
16
+ node.error('MPL115A2 init failed: ' + e.message);
17
+ }
18
+ node.on('close', function() {
19
+ if (node.connection) node.connection.close();
20
+ });
21
+ }
22
+ RED.nodes.registerType('mpl115a2-device', MPL115A2DeviceNode);
23
+
24
+ function MPL115A2ReadNode(config) {
25
+ RED.nodes.createNode(this, config);
26
+ const node = this;
27
+ node.device = RED.nodes.getNode(config.device);
28
+
29
+ node.on('input', async function(msg, send, done) {
30
+ if (!node.device || !node.device.driver) {
31
+ node.error('No MPL115A2 device configured', msg);
32
+ done();
33
+ return;
34
+ }
35
+ try {
36
+ const r = await node.device.driver.read();
37
+ msg.payload = { pressure_pa: r.pressure_pa, temperature_c: r.temperature_c };
38
+ send(msg);
39
+ done();
40
+ } catch (e) {
41
+ done(e);
42
+ }
43
+ });
44
+ }
45
+ RED.nodes.registerType('mpl115a2', MPL115A2ReadNode);
46
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-periph-pressure",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Node-RED nodes for pressure sensor chips",
5
5
  "keywords": [
6
6
  "node-red",
@@ -19,7 +19,9 @@
19
19
  "bmp581": "nodes/bmp581/bmp581.js",
20
20
  "lps28dfw": "nodes/lps28dfw/lps28dfw.js",
21
21
  "lps33hw": "nodes/lps33hw/lps33hw.js",
22
- "lps22df": "nodes/lps22df/lps22df.js"
22
+ "lps22hb": "nodes/lps22hb/lps22hb.js",
23
+ "lps22df": "nodes/lps22df/lps22df.js",
24
+ "mpl115a2": "nodes/mpl115a2/mpl115a2.js"
23
25
  }
24
26
  },
25
27
  "dependencies": {
package/index.js DELETED
@@ -1,11 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- module.exports = function(RED) {
5
- const nodesDir = path.join(__dirname, 'nodes');
6
- if (!fs.existsSync(nodesDir)) return;
7
- fs.readdirSync(nodesDir).forEach(function(chip) {
8
- const nodeFile = path.join(nodesDir, chip, chip + '.js');
9
- if (fs.existsSync(nodeFile)) require(nodeFile)(RED);
10
- });
11
- };