node-red-contrib-periph-light 1.5.4 → 1.6.1

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
@@ -1,8 +1,8 @@
1
1
  # node-red-contrib-periph-light
2
2
 
3
- Node-RED nodes for light sensor chips: APDS-9930, APDS9250, APDS9960, BH1750, MAX44009, SI1132 — part of the [Periph](https://github.com/tuhde/Periph) library.
3
+ Node-RED nodes for light sensor chips: APDS-9930, APDS9250, APDS9960, BH1750, MAX44009, SI1132, SI1133, SI1145, TSL2561, TSL2591, VCNL4040, VCNL4200 — part of the [Periph](https://github.com/tuhde/Periph) library.
4
4
 
5
- **Supported chips (6):** APDS9930, APDS9250, APDS9960, BH1750, MAX44009, SI1132.
5
+ **Supported chips (12):** APDS9930, APDS9250, APDS9960, BH1750, MAX44009, SI1132, SI1133, SI1145, TSL2561, TSL2591, VCNL4040, VCNL4200.
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-light/examples).
8
8
 
@@ -32,6 +32,18 @@ npm install node-red-contrib-periph-light
32
32
  | `max44009` | input | Reads the ambient illuminance of a MAX44009 ultra-low-power light sensor (I²C, 0.045 lx to 188 006.4 lx) and arms its threshold interrupt. |
33
33
  | `si1132-device` | config | I²C bus and address for a SI1132 |
34
34
  | `si1132` | input | Reads the UV index and the raw ambient-light counts from a Silicon Labs Si1132 over I²C (address 0x60) with one forced measurement per message. |
35
+ | `si1133-device` | config | I²C bus and address for a SI1133 |
36
+ | `si1133` | input | Reads the raw UV and white-light counts from a Silicon Labs Si1133 over I²C (address 0x55 or 0x52) with one forced measurement per message. |
37
+ | `si1145-device` | config | I²C bus and address for a SI1145 |
38
+ | `si1145` | input | Reads proximity, UV index and ambient light from a Silicon Labs Si1145 over I²C (address 0x60) with one forced PS + ALS measurement per message. |
39
+ | `tsl2561-device` | config | I²C bus and address for a TSL2561 |
40
+ | `tsl2561` | input | Reads the illuminance and both channel counts of a TSL2561 two-channel ambient light sensor (I²C, visible + infrared and infrared photodiodes). |
41
+ | `tsl2591-device` | config | Bus configuration for a TSL2591 |
42
+ | `tsl2591` | input | Reads the illuminance and both channel counts of a TSL2591 very-high-sensitivity ambient light sensor (I²C address 0x29, visible + infrared and infrared photodiodes, dynamic range about 600 000 000 : 1). |
43
+ | `vcnl4040-device` | config | Bus configuration for a VCNL4040 |
44
+ | `vcnl4040` | input | Reads the proximity, ambient light and white channel of a Vishay VCNL4040 proximity sensor with ambient light sensor (I²C address 0x60, internal 940 nm IRED, 16-bit ALS). |
45
+ | `vcnl4200-device` | config | Bus configuration for a VCNL4200 |
46
+ | `vcnl4200` | input | Reads the proximity, ambient light and white channel of a Vishay VCNL4200 long-distance proximity and ambient light sensor (I²C address 0x51, external 940 nm IRED on the on-chip current sink, 16-bit ALS). |
35
47
 
36
48
  ## Links
37
49
 
@@ -0,0 +1,135 @@
1
+ [
2
+ {
3
+ "id": "si1133-tab",
4
+ "type": "tab",
5
+ "label": "Si1133 UV monitor",
6
+ "disabled": false,
7
+ "info": "Reads the raw UV and white-light counts from an Si1133 every 2 s, scales the UV count to a 0-100 bar and shows it on a dashboard gauge; the full reading goes to the debug sidebar. The counts are raw ADC values (no UV-index calibration), so the bar shows the trend."
8
+ },
9
+ {
10
+ "id": "si1133-inject",
11
+ "type": "inject",
12
+ "z": "si1133-tab",
13
+ "name": "2 s timer",
14
+ "props": [
15
+ {
16
+ "p": "payload"
17
+ }
18
+ ],
19
+ "repeat": "2",
20
+ "crontab": "",
21
+ "once": false,
22
+ "onceDelay": 0.1,
23
+ "topic": "",
24
+ "payloadType": "date",
25
+ "x": 160,
26
+ "y": 160,
27
+ "wires": [
28
+ [
29
+ "si1133-node"
30
+ ]
31
+ ]
32
+ },
33
+ {
34
+ "id": "si1133-device-1",
35
+ "type": "si1133-device",
36
+ "name": "Si1133",
37
+ "bus": "1",
38
+ "address": "0x55"
39
+ },
40
+ {
41
+ "id": "si1133-node",
42
+ "type": "si1133",
43
+ "z": "si1133-tab",
44
+ "name": "Si1133",
45
+ "x": 360,
46
+ "y": 160,
47
+ "wires": [
48
+ [
49
+ "si1133-scale"
50
+ ]
51
+ ],
52
+ "device": "si1133-device-1"
53
+ },
54
+ {
55
+ "id": "si1133-scale",
56
+ "type": "function",
57
+ "z": "si1133-tab",
58
+ "name": "Scale UV to bar",
59
+ "func": "// Full scale chosen for bright daylight at HW_GAIN 9; adjust for your window.\nconst FULL_SCALE = 20000;\nconst bar = Math.max(0, Math.min(100, Math.round(msg.payload.uv * 100 / FULL_SCALE)));\nmsg.payload.uv_bar = bar;\nreturn [msg, { payload: bar }];",
60
+ "outputs": 2,
61
+ "noerr": 0,
62
+ "initialize": "",
63
+ "finalize": "",
64
+ "libs": [],
65
+ "x": 560,
66
+ "y": 160,
67
+ "wires": [
68
+ [
69
+ "si1133-debug"
70
+ ],
71
+ [
72
+ "si1133-gauge"
73
+ ]
74
+ ]
75
+ },
76
+ {
77
+ "id": "si1133-debug",
78
+ "type": "debug",
79
+ "z": "si1133-tab",
80
+ "name": "Reading",
81
+ "active": true,
82
+ "tosidebar": true,
83
+ "console": false,
84
+ "tostatus": false,
85
+ "complete": "payload",
86
+ "targetType": "msg",
87
+ "statusVal": "",
88
+ "statusType": "auto",
89
+ "x": 770,
90
+ "y": 120,
91
+ "wires": []
92
+ },
93
+ {
94
+ "id": "si1133-gauge",
95
+ "type": "ui_gauge",
96
+ "z": "si1133-tab",
97
+ "name": "UV bar",
98
+ "group": "si1133-group-1",
99
+ "order": 1,
100
+ "width": 6,
101
+ "height": 4,
102
+ "gtype": "gage",
103
+ "title": "UV",
104
+ "label": "%",
105
+ "format": "{{value}}",
106
+ "min": 0,
107
+ "max": 100,
108
+ "colors": [
109
+ "#00b500",
110
+ "#e6e600",
111
+ "#ca3838"
112
+ ],
113
+ "seg1": "33",
114
+ "seg2": "66",
115
+ "x": 760,
116
+ "y": 200,
117
+ "wires": []
118
+ },
119
+ {
120
+ "id": "si1133-group-1",
121
+ "type": "ui_group",
122
+ "name": "Si1133 UV",
123
+ "tab": "si1133-ui-tab-1",
124
+ "order": 1,
125
+ "disp": true,
126
+ "width": 6
127
+ },
128
+ {
129
+ "id": "si1133-ui-tab-1",
130
+ "type": "ui_tab",
131
+ "name": "Si1133 Demo",
132
+ "icon": "dashboard",
133
+ "order": 1
134
+ }
135
+ ]
@@ -0,0 +1,85 @@
1
+ [
2
+ {
3
+ "id": "si1145-tab",
4
+ "type": "tab",
5
+ "label": "Si1145 proximity switch",
6
+ "disabled": false,
7
+ "info": "Reads proximity, UV index and ambient light from an Si1145 every 500 ms. A function node compares the proximity count with a threshold and only passes a message when an object (e.g. a hand) comes closer than the threshold; the debug node shows these events. Adjust THRESHOLD in the function node to your LED current and cover window."
8
+ },
9
+ {
10
+ "id": "si1145-inject",
11
+ "type": "inject",
12
+ "z": "si1145-tab",
13
+ "name": "500 ms timer",
14
+ "props": [
15
+ {
16
+ "p": "payload"
17
+ }
18
+ ],
19
+ "repeat": "0.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
+ "si1145-node"
30
+ ]
31
+ ]
32
+ },
33
+ {
34
+ "id": "si1145-device-1",
35
+ "type": "si1145-device",
36
+ "name": "Si1145",
37
+ "bus": "1",
38
+ "address": "0x60",
39
+ "ledLevel": "3"
40
+ },
41
+ {
42
+ "id": "si1145-node",
43
+ "type": "si1145",
44
+ "z": "si1145-tab",
45
+ "name": "Si1145",
46
+ "x": 360,
47
+ "y": 160,
48
+ "wires": [
49
+ [
50
+ "si1145-threshold"
51
+ ]
52
+ ],
53
+ "device": "si1145-device-1"
54
+ },
55
+ {
56
+ "id": "si1145-threshold",
57
+ "type": "function",
58
+ "z": "si1145-tab",
59
+ "name": "Proximity above threshold",
60
+ "func": "// Raw PS1 counts; tune for your LED current and window.\nconst THRESHOLD = 2000;\nif (msg.payload.proximity > THRESHOLD) {\n msg.payload.near = true;\n return msg;\n}\nreturn null;",
61
+ "outputs": 1,
62
+ "x": 580,
63
+ "y": 160,
64
+ "wires": [
65
+ [
66
+ "si1145-debug"
67
+ ]
68
+ ]
69
+ },
70
+ {
71
+ "id": "si1145-debug",
72
+ "type": "debug",
73
+ "z": "si1145-tab",
74
+ "name": "Object near",
75
+ "active": true,
76
+ "tosidebar": true,
77
+ "console": false,
78
+ "tostatus": false,
79
+ "complete": "payload",
80
+ "targetType": "msg",
81
+ "x": 800,
82
+ "y": 160,
83
+ "wires": []
84
+ }
85
+ ]
@@ -0,0 +1,174 @@
1
+ [
2
+ {
3
+ "id": "tab-tsl2561-demo",
4
+ "type": "tab",
5
+ "label": "TSL2561 Light Meter Demo",
6
+ "disabled": false,
7
+ "info": "Light meter on a TSL2561 two-channel ambient light sensor. An inject node fires every 2 s into tsl2561 (auto-range on the config node); a function node splits the reading: output 1 carries the lux for a gauge, output 2 the lux for a chart, and a debug node shows the full {lux, ch0, ch1} payload. The gauge and chart need node-red-dashboard."
8
+ },
9
+ {
10
+ "id": "inj-read",
11
+ "type": "inject",
12
+ "name": "Read every 2 s",
13
+ "topic": "",
14
+ "payload": "",
15
+ "payloadType": "date",
16
+ "repeat": "2",
17
+ "crontab": "",
18
+ "once": true,
19
+ "onceDelay": 1,
20
+ "z": "tab-tsl2561-demo",
21
+ "x": 150,
22
+ "y": 140,
23
+ "wires": [
24
+ [
25
+ "tsl2561-node"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "tsl2561-device-1",
31
+ "type": "tsl2561-device",
32
+ "name": "TSL2561",
33
+ "bus": "1",
34
+ "address": "0x39",
35
+ "gain": "auto",
36
+ "integration": "402",
37
+ "package": "T"
38
+ },
39
+ {
40
+ "id": "tsl2561-node",
41
+ "type": "tsl2561",
42
+ "name": "TSL2561",
43
+ "z": "tab-tsl2561-demo",
44
+ "x": 360,
45
+ "y": 140,
46
+ "wires": [
47
+ [
48
+ "fn-split",
49
+ "dbg-tsl2561"
50
+ ]
51
+ ],
52
+ "device": "tsl2561-device-1"
53
+ },
54
+ {
55
+ "id": "fn-split",
56
+ "type": "function",
57
+ "name": "split lux",
58
+ "func": "// Output 1: lux for the gauge, output 2: lux for the chart.\nconst lux = Math.round(msg.payload.lux * 10) / 10;\nreturn [{ payload: lux }, { payload: lux, topic: 'lux' }];",
59
+ "outputs": 2,
60
+ "noerr": 0,
61
+ "z": "tab-tsl2561-demo",
62
+ "x": 560,
63
+ "y": 120,
64
+ "wires": [
65
+ [
66
+ "gauge-lux"
67
+ ],
68
+ [
69
+ "chart-lux"
70
+ ]
71
+ ]
72
+ },
73
+ {
74
+ "id": "gauge-lux",
75
+ "type": "ui_gauge",
76
+ "name": "Illuminance",
77
+ "group": "tsl2561-group-1",
78
+ "order": 1,
79
+ "width": 6,
80
+ "height": 4,
81
+ "gtype": "gage",
82
+ "title": "Illuminance",
83
+ "label": "lx",
84
+ "format": "{{value}}",
85
+ "min": "0",
86
+ "max": "2000",
87
+ "colors": [
88
+ "#1e3a8a",
89
+ "#e6e600",
90
+ "#ffffff"
91
+ ],
92
+ "seg1": "300",
93
+ "seg2": "1000",
94
+ "className": "",
95
+ "z": "tab-tsl2561-demo",
96
+ "x": 780,
97
+ "y": 100,
98
+ "wires": []
99
+ },
100
+ {
101
+ "id": "chart-lux",
102
+ "type": "ui_chart",
103
+ "name": "Lux history",
104
+ "group": "tsl2561-group-1",
105
+ "order": 2,
106
+ "width": 6,
107
+ "height": 4,
108
+ "label": "Illuminance (lx)",
109
+ "chartType": "line",
110
+ "legend": "false",
111
+ "xformat": "HH:mm:ss",
112
+ "interpolate": "linear",
113
+ "nodata": "",
114
+ "dot": false,
115
+ "ymin": "0",
116
+ "ymax": "",
117
+ "removeOlder": 10,
118
+ "removeOlderPoints": "",
119
+ "removeOlderUnit": "60",
120
+ "cutout": 0,
121
+ "useOneColor": false,
122
+ "colors": [
123
+ "#C084FC",
124
+ "#aec7e8",
125
+ "#ff7f0e",
126
+ "#2ca02c",
127
+ "#98df8a",
128
+ "#d62728",
129
+ "#ff9896",
130
+ "#9467bd",
131
+ "#c5b0d5"
132
+ ],
133
+ "outputs": 1,
134
+ "useDifferentColor": false,
135
+ "className": "",
136
+ "z": "tab-tsl2561-demo",
137
+ "x": 780,
138
+ "y": 160,
139
+ "wires": [
140
+ []
141
+ ]
142
+ },
143
+ {
144
+ "id": "dbg-tsl2561",
145
+ "type": "debug",
146
+ "name": "lux / ch0 / ch1",
147
+ "active": true,
148
+ "tosidebar": true,
149
+ "console": false,
150
+ "tostatus": false,
151
+ "complete": "payload",
152
+ "targetType": "msg",
153
+ "z": "tab-tsl2561-demo",
154
+ "x": 580,
155
+ "y": 200,
156
+ "wires": []
157
+ },
158
+ {
159
+ "id": "tsl2561-group-1",
160
+ "type": "ui_group",
161
+ "name": "TSL2561 Light Meter",
162
+ "tab": "tsl2561-ui-tab-1",
163
+ "order": 1,
164
+ "disp": true,
165
+ "width": 6
166
+ },
167
+ {
168
+ "id": "tsl2561-ui-tab-1",
169
+ "type": "ui_tab",
170
+ "name": "TSL2561 Demo",
171
+ "icon": "dashboard",
172
+ "order": 1
173
+ }
174
+ ]
@@ -0,0 +1,126 @@
1
+ [
2
+ {
3
+ "id": "tab-tsl2591-demo",
4
+ "type": "tab",
5
+ "label": "TSL2591 Light Meter Demo",
6
+ "disabled": false,
7
+ "info": "Wide-range light meter on a TSL2591 very-high-sensitivity ambient light sensor (I²C 0x29). An inject node fires every 2 s into tsl2591; the config node uses auto-gain, so the reading stays valid from darkness to direct sunlight. A function node formats the lux as text (e.g. \"120.5 lx\") for the status line and passes the numeric value to a gauge; a debug node shows the full {lux, ch0, ch1} payload. Cover and uncover the sensor to watch the gain change and the lux follow. Pick a fixed gain or a longer integration time on the config node to compare; the gauge needs node-red-dashboard."
8
+ },
9
+ {
10
+ "id": "inj-read",
11
+ "type": "inject",
12
+ "name": "Read every 2 s",
13
+ "topic": "",
14
+ "payload": "",
15
+ "payloadType": "date",
16
+ "repeat": "2",
17
+ "crontab": "",
18
+ "once": true,
19
+ "onceDelay": 1,
20
+ "z": "tab-tsl2591-demo",
21
+ "x": 150,
22
+ "y": 140,
23
+ "wires": [
24
+ [
25
+ "tsl2591-node"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "tsl2591-device-1",
31
+ "type": "tsl2591-device",
32
+ "name": "TSL2591",
33
+ "bus": "1",
34
+ "gain": "auto",
35
+ "integration": "0"
36
+ },
37
+ {
38
+ "id": "tsl2591-node",
39
+ "type": "tsl2591",
40
+ "name": "TSL2591",
41
+ "z": "tab-tsl2591-demo",
42
+ "x": 360,
43
+ "y": 140,
44
+ "wires": [
45
+ [
46
+ "fn-format",
47
+ "dbg-tsl2591"
48
+ ]
49
+ ],
50
+ "device": "tsl2591-device-1"
51
+ },
52
+ {
53
+ "id": "fn-format",
54
+ "type": "function",
55
+ "name": "format lux",
56
+ "func": "// Show \"120.5 lx\" as status and send the number to the gauge.\nconst lux = Math.round(msg.payload.lux * 10) / 10;\nnode.status({ text: lux.toFixed(1) + ' lx' });\nreturn { payload: lux, topic: 'lux' };",
57
+ "outputs": 1,
58
+ "noerr": 0,
59
+ "z": "tab-tsl2591-demo",
60
+ "x": 560,
61
+ "y": 120,
62
+ "wires": [
63
+ [
64
+ "gauge-lux"
65
+ ]
66
+ ]
67
+ },
68
+ {
69
+ "id": "gauge-lux",
70
+ "type": "ui_gauge",
71
+ "name": "Illuminance",
72
+ "group": "tsl2591-group-1",
73
+ "order": 1,
74
+ "width": 6,
75
+ "height": 4,
76
+ "gtype": "gage",
77
+ "title": "Illuminance",
78
+ "label": "lx",
79
+ "format": "{{value}}",
80
+ "min": "0",
81
+ "max": "2000",
82
+ "colors": [
83
+ "#1e3a8a",
84
+ "#e6e600",
85
+ "#ffffff"
86
+ ],
87
+ "seg1": "300",
88
+ "seg2": "1000",
89
+ "className": "",
90
+ "z": "tab-tsl2591-demo",
91
+ "x": 780,
92
+ "y": 120,
93
+ "wires": []
94
+ },
95
+ {
96
+ "id": "dbg-tsl2591",
97
+ "type": "debug",
98
+ "name": "lux / ch0 / ch1",
99
+ "active": true,
100
+ "tosidebar": true,
101
+ "console": false,
102
+ "tostatus": false,
103
+ "complete": "payload",
104
+ "targetType": "msg",
105
+ "z": "tab-tsl2591-demo",
106
+ "x": 580,
107
+ "y": 200,
108
+ "wires": []
109
+ },
110
+ {
111
+ "id": "tsl2591-group-1",
112
+ "type": "ui_group",
113
+ "name": "TSL2591 Light Meter",
114
+ "tab": "tsl2591-ui-tab-1",
115
+ "order": 1,
116
+ "disp": true,
117
+ "width": 6
118
+ },
119
+ {
120
+ "id": "tsl2591-ui-tab-1",
121
+ "type": "ui_tab",
122
+ "name": "TSL2591 Demo",
123
+ "icon": "dashboard",
124
+ "order": 1
125
+ }
126
+ ]