node-red-contrib-periph-adc-dac 1.3.1 → 1.3.3

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
@@ -16,10 +16,18 @@ npm install node-red-contrib-periph-adc-dac
16
16
 
17
17
  | Node | Kind | Description |
18
18
  |------|------|-------------|
19
+ | `periph-ad5243` | input | Sets and reads the two 256-position wipers of an AD5243 dual I²C digital potentiometer. Wiper values are volatile: both channels power up at midscale (128). |
20
+ | `ad5248-device` | config | I²C bus and address for an AD5248 |
21
+ | `periph-ad5248` | input | Sets or reads the two 256-position wipers of an AD5248 dual digital rheostat over I²C. The device is configured via an ad5248-device config node. |
19
22
  | `ad7705-device` | config | Bus configuration for an AD7705 |
20
23
  | `periph-ad7705` | input | Reads voltage from a 2-channel, 16-bit sigma-delta AD7705 ADC over SPI. The driver uses the chip's two-phase register-access protocol and polls DRDY over SPI, so only SCLK/DIN/DOUT/CS are needed (no dedicated DRDY GPIO). |
21
24
  | `ad7706-device` | config | Bus configuration for an AD7706 |
22
25
  | `periph-ad7706` | input | Reads voltage from a 3-channel, 16-bit sigma-delta AD7706 ADC over SPI. The driver uses the chip's two-phase register-access protocol and polls DRDY over SPI, so only SCLK/DIN/DOUT/CS are needed (no dedicated DRDY GPIO). All three channels share a single COMMON reference pin. |
26
+ | `periph-ads1013` | input | Reads the voltage AIN0 − AIN1 from an ADS1013 12-bit ADC over I²C using a single-shot conversion. |
27
+ | `periph-ads1014` | input | Reads the voltage AIN0 − AIN1 from an ADS1014 12-bit ADC over I²C using a single-shot conversion. |
28
+ | `periph-ads1113` | input | Reads the ADS1113 16-bit ΔΣ ADC (one differential input (AIN0 − AIN1), fixed ±2.048 V) over I²C. Default address is 0x48 ; 0x48 – 0x4B are valid depending on the ADDR strap. |
29
+ | `periph-ads1114` | input | Reads the ADS1114 16-bit ΔΣ ADC (one differential input (AIN0 − AIN1) with programmable gain) over I²C. Default address is 0x48 ; 0x48 – 0x4B are valid depending on the ADDR strap. |
30
+ | `periph-ads1115` | input | Reads the ADS1115 16-bit ΔΣ ADC (four single-ended or two differential inputs with programmable gain) over I²C. Default address is 0x48 ; 0x48 – 0x4B are valid depending on the ADDR strap. |
23
31
  | `periph-hx710a` | input | Reads weight from an HX710A 24-bit ADC connected to a load cell via two GPIO pins. Also exposes the chip's on-chip temperature sensor as a raw ADC code. |
24
32
  | `periph-hx710b` | input | Reads weight from an HX710B 24-bit ADC connected to a load cell via two GPIO pins. Also exposes the chip's DVDD-AVDD supply-voltage-difference channel as a raw ADC code for battery-monitoring applications. |
25
33
  | `periph-hx711` | input | Reads weight from an HX711 24-bit ADC connected to a load cell via two GPIO pins. |
@@ -0,0 +1,116 @@
1
+ [
2
+ {
3
+ "id": "tab-ad5243-demo",
4
+ "type": "tab",
5
+ "label": "AD5243 Wiper Sweep Demo",
6
+ "disabled": false,
7
+ "info": "Two scenarios on one AD5243 dual digital potentiometer. An Inject node ticks every 500 ms into a Function node that sweeps channel 0 through 16 evenly spaced wiper codes (0, 16, ... 240), producing the staircase; the periph-ad5243 node returns {channel, code, resistance} which a Debug node shows. A second Inject node sets channel 1 to a 2.2 kOhm W-B resistance once and a third reads back both channels."
8
+ },
9
+ {
10
+ "id": "inj-sweep",
11
+ "type": "inject",
12
+ "name": "Sweep tick (500 ms)",
13
+ "topic": "",
14
+ "payload": "",
15
+ "payloadType": "date",
16
+ "repeat": "0.5",
17
+ "crontab": "",
18
+ "once": true,
19
+ "onceDelay": 0.5,
20
+ "z": "tab-ad5243-demo",
21
+ "x": 150,
22
+ "y": 100,
23
+ "wires": [
24
+ [
25
+ "fn-sweep"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "fn-sweep",
31
+ "type": "function",
32
+ "name": "sweep channel 0",
33
+ "func": "// 16 steps of 16 codes: 0, 16, ... 240, then wrap.\nlet i = context.get('step') || 0;\ncontext.set('step', (i + 1) % 16);\nmsg.payload = { channel: 0, code: i * 16 };\nreturn msg;",
34
+ "outputs": 1,
35
+ "noerr": 0,
36
+ "z": "tab-ad5243-demo",
37
+ "x": 350,
38
+ "y": 100,
39
+ "wires": [
40
+ [
41
+ "ad5243-node"
42
+ ]
43
+ ]
44
+ },
45
+ {
46
+ "id": "inj-rheo",
47
+ "type": "inject",
48
+ "name": "Channel 1 = 2.2 kOhm",
49
+ "topic": "",
50
+ "payload": "{\"channel\":1,\"ohms\":2200}",
51
+ "payloadType": "json",
52
+ "repeat": "",
53
+ "crontab": "",
54
+ "once": false,
55
+ "onceDelay": 0.1,
56
+ "z": "tab-ad5243-demo",
57
+ "x": 160,
58
+ "y": 180,
59
+ "wires": [
60
+ [
61
+ "ad5243-node"
62
+ ]
63
+ ]
64
+ },
65
+ {
66
+ "id": "inj-read",
67
+ "type": "inject",
68
+ "name": "Read both channels",
69
+ "topic": "",
70
+ "payload": "",
71
+ "payloadType": "date",
72
+ "repeat": "",
73
+ "crontab": "",
74
+ "once": false,
75
+ "onceDelay": 0.1,
76
+ "z": "tab-ad5243-demo",
77
+ "x": 160,
78
+ "y": 240,
79
+ "wires": [
80
+ [
81
+ "ad5243-node"
82
+ ]
83
+ ]
84
+ },
85
+ {
86
+ "id": "ad5243-node",
87
+ "type": "periph-ad5243",
88
+ "name": "AD5243",
89
+ "bus": "1",
90
+ "rab": "10000",
91
+ "rwiper": "160",
92
+ "z": "tab-ad5243-demo",
93
+ "x": 560,
94
+ "y": 140,
95
+ "wires": [
96
+ [
97
+ "dbg-ad5243"
98
+ ]
99
+ ]
100
+ },
101
+ {
102
+ "id": "dbg-ad5243",
103
+ "type": "debug",
104
+ "name": "wiper / resistance",
105
+ "active": true,
106
+ "tosidebar": true,
107
+ "console": false,
108
+ "tostatus": false,
109
+ "complete": "payload",
110
+ "targetType": "msg",
111
+ "z": "tab-ad5243-demo",
112
+ "x": 780,
113
+ "y": 140,
114
+ "wires": []
115
+ }
116
+ ]
@@ -0,0 +1,125 @@
1
+ [
2
+ {
3
+ "id": "tab-ad5248-demo",
4
+ "type": "tab",
5
+ "label": "AD5248 Digital Rheostat Demo",
6
+ "disabled": false,
7
+ "info": "Sets channel 0 of the AD5248 to a fixed midscale code with one inject node and sweeps the wiper in 16-step increments (0, 16, ... 240) every 500 ms with a second, repeating inject node, showing the resistance staircase. Both paths print the resulting code and W-B resistance in ohms to the debug panel."
8
+ },
9
+ {
10
+ "id": "cfg-ad5248",
11
+ "type": "ad5248-device",
12
+ "name": "AD5248",
13
+ "bus": "1",
14
+ "address": "2C",
15
+ "rab": "10000",
16
+ "rwiper": "160"
17
+ },
18
+ {
19
+ "id": "inj-set",
20
+ "type": "inject",
21
+ "name": "set code 128",
22
+ "topic": "",
23
+ "payload": "128",
24
+ "payloadType": "num",
25
+ "repeat": "",
26
+ "crontab": "",
27
+ "once": false,
28
+ "onceDelay": 0.1,
29
+ "z": "tab-ad5248-demo",
30
+ "x": 130,
31
+ "y": 100,
32
+ "wires": [
33
+ [
34
+ "fn-set"
35
+ ]
36
+ ]
37
+ },
38
+ {
39
+ "id": "fn-set",
40
+ "type": "function",
41
+ "name": "channel 0 code",
42
+ "func": "msg.payload = { channel: 0, code: msg.payload };\nreturn msg;",
43
+ "outputs": 1,
44
+ "noerr": 0,
45
+ "initialize": "",
46
+ "finalize": "",
47
+ "libs": [],
48
+ "z": "tab-ad5248-demo",
49
+ "x": 330,
50
+ "y": 100,
51
+ "wires": [
52
+ [
53
+ "ad5248"
54
+ ]
55
+ ]
56
+ },
57
+ {
58
+ "id": "inj-sweep",
59
+ "type": "inject",
60
+ "name": "sweep every 500 ms",
61
+ "topic": "",
62
+ "payload": "",
63
+ "payloadType": "date",
64
+ "repeat": "0.5",
65
+ "crontab": "",
66
+ "once": false,
67
+ "onceDelay": 0.1,
68
+ "z": "tab-ad5248-demo",
69
+ "x": 150,
70
+ "y": 180,
71
+ "wires": [
72
+ [
73
+ "fn-sweep"
74
+ ]
75
+ ]
76
+ },
77
+ {
78
+ "id": "fn-sweep",
79
+ "type": "function",
80
+ "name": "next staircase step",
81
+ "func": "let n = context.get('n') || 0;\nmsg.payload = { channel: 0, code: (n * 16) % 256 };\ncontext.set('n', n + 1);\nreturn msg;",
82
+ "outputs": 1,
83
+ "noerr": 0,
84
+ "initialize": "",
85
+ "finalize": "",
86
+ "libs": [],
87
+ "z": "tab-ad5248-demo",
88
+ "x": 360,
89
+ "y": 180,
90
+ "wires": [
91
+ [
92
+ "ad5248"
93
+ ]
94
+ ]
95
+ },
96
+ {
97
+ "id": "ad5248",
98
+ "type": "periph-ad5248",
99
+ "name": "AD5248",
100
+ "device": "cfg-ad5248",
101
+ "z": "tab-ad5248-demo",
102
+ "x": 580,
103
+ "y": 140,
104
+ "wires": [
105
+ [
106
+ "dbg"
107
+ ]
108
+ ]
109
+ },
110
+ {
111
+ "id": "dbg",
112
+ "type": "debug",
113
+ "name": "code and resistance",
114
+ "active": true,
115
+ "tosidebar": true,
116
+ "console": false,
117
+ "tostatus": false,
118
+ "complete": "payload",
119
+ "targetType": "msg",
120
+ "z": "tab-ad5248-demo",
121
+ "x": 800,
122
+ "y": 140,
123
+ "wires": []
124
+ }
125
+ ]
@@ -0,0 +1,76 @@
1
+ [
2
+ {
3
+ "id": "tab-ads1013-demo",
4
+ "type": "tab",
5
+ "label": "ADS1013 Battery Voltage Demo",
6
+ "disabled": false,
7
+ "info": "An Inject node fires every second, triggering the periph-ads1013 node to run a single-shot conversion at 128 SPS. The cell voltage is wired through a 2:1 resistor divider to AIN0 (AIN1 to GND); a Function node multiplies the divider voltage by 2 to obtain the battery voltage and the Debug sidebar shows it in volts."
8
+ },
9
+ {
10
+ "id": "inj-read",
11
+ "type": "inject",
12
+ "name": "Read (1 s)",
13
+ "topic": "",
14
+ "payload": "",
15
+ "payloadType": "date",
16
+ "repeat": "1",
17
+ "crontab": "",
18
+ "once": true,
19
+ "onceDelay": 1,
20
+ "z": "tab-ads1013-demo",
21
+ "x": 160,
22
+ "y": 100,
23
+ "wires": [
24
+ [
25
+ "ads1013-node"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "ads1013-node",
31
+ "type": "periph-ads1013",
32
+ "bus": "1",
33
+ "address": "0x48",
34
+ "z": "tab-ads1013-demo",
35
+ "x": 380,
36
+ "y": 100,
37
+ "wires": [
38
+ [
39
+ "fn-scale"
40
+ ]
41
+ ],
42
+ "name": "Battery ADS1013",
43
+ "dataRate": "0"
44
+ },
45
+ {
46
+ "id": "fn-scale",
47
+ "type": "function",
48
+ "name": "scale divider to battery voltage",
49
+ "func": "const v = msg.payload.voltage * 2; // 2:1 divider\nmsg.payload = `battery ${v.toFixed(3)} V (raw ${msg.payload.raw})`;\nreturn msg;",
50
+ "outputs": 1,
51
+ "noerr": 0,
52
+ "z": "tab-ads1013-demo",
53
+ "x": 620,
54
+ "y": 100,
55
+ "wires": [
56
+ [
57
+ "debug-out"
58
+ ]
59
+ ]
60
+ },
61
+ {
62
+ "id": "debug-out",
63
+ "type": "debug",
64
+ "name": "Battery voltage",
65
+ "active": true,
66
+ "tosidebar": true,
67
+ "console": false,
68
+ "tostatus": false,
69
+ "complete": "payload",
70
+ "targetType": "msg",
71
+ "z": "tab-ads1013-demo",
72
+ "x": 860,
73
+ "y": 100,
74
+ "wires": []
75
+ }
76
+ ]
@@ -0,0 +1,77 @@
1
+ [
2
+ {
3
+ "id": "tab-ads1014-demo",
4
+ "type": "tab",
5
+ "label": "ADS1014 Shunt Current Demo",
6
+ "disabled": false,
7
+ "info": "An Inject node fires every second, triggering the periph-ads1014 node (gain ±0.256 V, 250 SPS) to read the voltage across a 0.1 ohm shunt. A Function node converts the shunt voltage to a load current (V / 0.1 ohm) and flags an over-current condition above 1 A in the Debug sidebar."
8
+ },
9
+ {
10
+ "id": "inj-read",
11
+ "type": "inject",
12
+ "name": "Read (1 s)",
13
+ "topic": "",
14
+ "payload": "",
15
+ "payloadType": "date",
16
+ "repeat": "1",
17
+ "crontab": "",
18
+ "once": true,
19
+ "onceDelay": 1,
20
+ "z": "tab-ads1014-demo",
21
+ "x": 160,
22
+ "y": 100,
23
+ "wires": [
24
+ [
25
+ "ads1014-node"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "ads1014-node",
31
+ "type": "periph-ads1014",
32
+ "bus": "1",
33
+ "address": "0x48",
34
+ "z": "tab-ads1014-demo",
35
+ "x": 380,
36
+ "y": 100,
37
+ "wires": [
38
+ [
39
+ "fn-scale"
40
+ ]
41
+ ],
42
+ "name": "Shunt ADS1014",
43
+ "gain": "5",
44
+ "dataRate": "1"
45
+ },
46
+ {
47
+ "id": "fn-scale",
48
+ "type": "function",
49
+ "name": "shunt voltage to current",
50
+ "func": "const amps = msg.payload.voltage / 0.1; // 0.1 ohm shunt\nmsg.payload = `${amps.toFixed(2)} A` + (amps > 1.0 ? ' OVER-CURRENT' : '');\nreturn msg;",
51
+ "outputs": 1,
52
+ "noerr": 0,
53
+ "z": "tab-ads1014-demo",
54
+ "x": 620,
55
+ "y": 100,
56
+ "wires": [
57
+ [
58
+ "debug-out"
59
+ ]
60
+ ]
61
+ },
62
+ {
63
+ "id": "debug-out",
64
+ "type": "debug",
65
+ "name": "Load current",
66
+ "active": true,
67
+ "tosidebar": true,
68
+ "console": false,
69
+ "tostatus": false,
70
+ "complete": "payload",
71
+ "targetType": "msg",
72
+ "z": "tab-ads1014-demo",
73
+ "x": 860,
74
+ "y": 100,
75
+ "wires": []
76
+ }
77
+ ]
@@ -0,0 +1,60 @@
1
+ [
2
+ {
3
+ "id": "tab-ads1113-demo",
4
+ "type": "tab",
5
+ "label": "ADS1113 Demo",
6
+ "disabled": false,
7
+ "info": "Reads the ADS1113 once per second and shows the voltage in the debug panel."
8
+ },
9
+ {
10
+ "id": "inj-read",
11
+ "type": "inject",
12
+ "name": "Read every 1 s",
13
+ "topic": "",
14
+ "payload": "",
15
+ "payloadType": "date",
16
+ "repeat": "1",
17
+ "crontab": "",
18
+ "once": false,
19
+ "onceDelay": 0.1,
20
+ "z": "tab-ads1113-demo",
21
+ "x": 150,
22
+ "y": 100,
23
+ "wires": [
24
+ [
25
+ "ads1113"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "ads1113",
31
+ "type": "periph-ads1113",
32
+ "name": "ADS1113",
33
+ "bus": "1",
34
+ "address": "48",
35
+ "dataRate": "4",
36
+ "z": "tab-ads1113-demo",
37
+ "x": 380,
38
+ "y": 100,
39
+ "wires": [
40
+ [
41
+ "dbg"
42
+ ]
43
+ ]
44
+ },
45
+ {
46
+ "id": "dbg",
47
+ "type": "debug",
48
+ "name": "voltage",
49
+ "active": true,
50
+ "tosidebar": true,
51
+ "console": false,
52
+ "tostatus": false,
53
+ "complete": "payload",
54
+ "targetType": "msg",
55
+ "z": "tab-ads1113-demo",
56
+ "x": 850,
57
+ "y": 100,
58
+ "wires": []
59
+ }
60
+ ]
@@ -0,0 +1,61 @@
1
+ [
2
+ {
3
+ "id": "tab-ads1114-demo",
4
+ "type": "tab",
5
+ "label": "ADS1114 Demo",
6
+ "disabled": false,
7
+ "info": "Reads the ADS1114 once per second and shows the voltage in the debug panel."
8
+ },
9
+ {
10
+ "id": "inj-read",
11
+ "type": "inject",
12
+ "name": "Read every 1 s",
13
+ "topic": "",
14
+ "payload": "",
15
+ "payloadType": "date",
16
+ "repeat": "1",
17
+ "crontab": "",
18
+ "once": false,
19
+ "onceDelay": 0.1,
20
+ "z": "tab-ads1114-demo",
21
+ "x": 150,
22
+ "y": 100,
23
+ "wires": [
24
+ [
25
+ "ads1114"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "ads1114",
31
+ "type": "periph-ads1114",
32
+ "name": "ADS1114",
33
+ "bus": "1",
34
+ "address": "48",
35
+ "dataRate": "4",
36
+ "z": "tab-ads1114-demo",
37
+ "x": 380,
38
+ "y": 100,
39
+ "wires": [
40
+ [
41
+ "dbg"
42
+ ]
43
+ ],
44
+ "gain": "2"
45
+ },
46
+ {
47
+ "id": "dbg",
48
+ "type": "debug",
49
+ "name": "voltage",
50
+ "active": true,
51
+ "tosidebar": true,
52
+ "console": false,
53
+ "tostatus": false,
54
+ "complete": "payload",
55
+ "targetType": "msg",
56
+ "z": "tab-ads1114-demo",
57
+ "x": 850,
58
+ "y": 100,
59
+ "wires": []
60
+ }
61
+ ]
@@ -0,0 +1,119 @@
1
+ [
2
+ {
3
+ "id": "tab-ads1115-demo",
4
+ "type": "tab",
5
+ "label": "ADS1115 Demo",
6
+ "disabled": false,
7
+ "info": "Reads AIN0 of the ADS1115 once per second at ±4.096 V; a second inject node sends msg.differential = \"2-3\" to show a differential (bridge sensor) read. A function node converts the AIN0 reading of a 1:2 divider back to the battery voltage."
8
+ },
9
+ {
10
+ "id": "inj-read",
11
+ "type": "inject",
12
+ "name": "Read every 1 s",
13
+ "topic": "",
14
+ "payload": "",
15
+ "payloadType": "date",
16
+ "repeat": "1",
17
+ "crontab": "",
18
+ "once": false,
19
+ "onceDelay": 0.1,
20
+ "z": "tab-ads1115-demo",
21
+ "x": 150,
22
+ "y": 100,
23
+ "wires": [
24
+ [
25
+ "ads1115"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "ads1115",
31
+ "type": "periph-ads1115",
32
+ "name": "ADS1115",
33
+ "bus": "1",
34
+ "address": "48",
35
+ "dataRate": "4",
36
+ "z": "tab-ads1115-demo",
37
+ "x": 380,
38
+ "y": 100,
39
+ "wires": [
40
+ [
41
+ "fn-scale"
42
+ ]
43
+ ],
44
+ "gain": "1",
45
+ "channel": "0"
46
+ },
47
+ {
48
+ "id": "fn-scale",
49
+ "type": "function",
50
+ "name": "divider to battery volts",
51
+ "func": "msg.payload.battery = msg.payload.voltage * 2;\nreturn msg;",
52
+ "outputs": 1,
53
+ "z": "tab-ads1115-demo",
54
+ "x": 620,
55
+ "y": 100,
56
+ "wires": [
57
+ [
58
+ "dbg"
59
+ ]
60
+ ]
61
+ },
62
+ {
63
+ "id": "inj-diff",
64
+ "type": "inject",
65
+ "name": "differential 2-3",
66
+ "topic": "",
67
+ "payload": "",
68
+ "payloadType": "date",
69
+ "repeat": "",
70
+ "crontab": "",
71
+ "once": false,
72
+ "onceDelay": 0.1,
73
+ "z": "tab-ads1115-demo",
74
+ "x": 150,
75
+ "y": 180,
76
+ "wires": [
77
+ [
78
+ "set-diff"
79
+ ]
80
+ ]
81
+ },
82
+ {
83
+ "id": "set-diff",
84
+ "type": "change",
85
+ "name": "msg.differential = 2-3",
86
+ "rules": [
87
+ {
88
+ "t": "set",
89
+ "p": "differential",
90
+ "pt": "msg",
91
+ "to": "2-3",
92
+ "tot": "str"
93
+ }
94
+ ],
95
+ "z": "tab-ads1115-demo",
96
+ "x": 380,
97
+ "y": 180,
98
+ "wires": [
99
+ [
100
+ "ads1115"
101
+ ]
102
+ ]
103
+ },
104
+ {
105
+ "id": "dbg",
106
+ "type": "debug",
107
+ "name": "voltage",
108
+ "active": true,
109
+ "tosidebar": true,
110
+ "console": false,
111
+ "tostatus": false,
112
+ "complete": "payload",
113
+ "targetType": "msg",
114
+ "z": "tab-ads1115-demo",
115
+ "x": 850,
116
+ "y": 100,
117
+ "wires": []
118
+ }
119
+ ]