node-red-contrib-periph-motor 1.3.3 → 1.5.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 CHANGED
@@ -18,6 +18,10 @@ npm install node-red-contrib-periph-motor
18
18
  |------|------|-------------|
19
19
  | `periph-drv2605` | input | Plays haptic effects on an ERM or LRA vibration motor through a DRV2605 haptic driver over I²C (fixed address 0x5A). The EN pin must be high. |
20
20
  | `periph-drv8830` | input | Drives a brushed DC motor through a DRV8830 low-voltage H-bridge over I²C, and reports its fault status. The chip regulates the commanded voltage across the motor, so speed stays constant as the supply sags. |
21
+ | `periph-tmc2130` | input | Drives a two-phase bipolar stepper motor through a Trinamic TMC2130 over SPI (Mode 3). The chip has no internal step generator, so the node pulses the STEP and DIR GPIOs; moves are blocking. |
22
+ | `periph-tmc2208` | input | Drives a two-phase bipolar stepper motor through a Trinamic TMC2202 / TMC2208 / TMC2224 over its single-wire UART. The chip's internal step generator moves the motor, so no STEP pulses are needed. |
23
+ | `periph-tmc2209` | input | Drives a two-phase bipolar stepper motor through a Trinamic TMC2209 over its single-wire UART. The chip's internal step generator moves the motor, so no STEP pulses are needed. |
24
+ | `periph-tmc5160` | input | Drives a two-phase bipolar stepper motor through a Trinamic TMC5160 over SPI (Mode 3) or single-wire UART. The chip's internal SixPoint ramp generator moves the motor; positions are in full steps, speeds in full steps/s and accelerations in full steps/s². |
21
25
 
22
26
  ## Links
23
27
 
@@ -0,0 +1,114 @@
1
+ [
2
+ {
3
+ "id": "tab-tmc2130-demo",
4
+ "type": "tab",
5
+ "label": "TMC2130 Stepper Demo",
6
+ "disabled": false,
7
+ "info": "A small linear-axis controller. One Inject node sends {enable: true, current: 0.8, microsteps: 16} once at start. A second Inject node ticks every 5 s into a Function node that alternates {move: 400, speed: 200} and {move: -400, speed: 200}, so the TMC2130 moves forward and backward with software-timed STEP/DIR pulses. A third Inject node polls the driver status every 2 s (any other message); a Function node checks msg.payload.fault and raises a Node-RED warning when it is non-zero and a notice when sg_result drops below 100, while a Debug node shows every reply."
8
+ },
9
+ {
10
+ "id": "inj-setup",
11
+ "type": "inject",
12
+ "name": "Enable 0.8 A, 16 microsteps",
13
+ "topic": "",
14
+ "payload": "{\"enable\":true,\"current\":0.8,\"microsteps\":16}",
15
+ "payloadType": "json",
16
+ "repeat": "",
17
+ "crontab": "",
18
+ "once": true,
19
+ "onceDelay": 1,
20
+ "z": "tab-tmc2130-demo",
21
+ "x": 190,
22
+ "y": 80,
23
+ "wires": [["tmc2130-node"]]
24
+ },
25
+ {
26
+ "id": "inj-cycle",
27
+ "type": "inject",
28
+ "name": "Cycle tick (5 s)",
29
+ "topic": "",
30
+ "payload": "",
31
+ "payloadType": "date",
32
+ "repeat": "5",
33
+ "crontab": "",
34
+ "once": true,
35
+ "onceDelay": 3,
36
+ "z": "tab-tmc2130-demo",
37
+ "x": 140,
38
+ "y": 160,
39
+ "wires": [["fn-cycle"]]
40
+ },
41
+ {
42
+ "id": "fn-cycle",
43
+ "type": "function",
44
+ "name": "move 400 / -400",
45
+ "func": "const seq = [{ move: 400, speed: 200 }, { move: -400, speed: 200 }];\nconst i = context.get('step') || 0;\ncontext.set('step', (i + 1) % seq.length);\nmsg.payload = seq[i];\nreturn msg;",
46
+ "outputs": 1,
47
+ "noerr": 0,
48
+ "z": "tab-tmc2130-demo",
49
+ "x": 330,
50
+ "y": 160,
51
+ "wires": [["tmc2130-node"]]
52
+ },
53
+ {
54
+ "id": "inj-poll",
55
+ "type": "inject",
56
+ "name": "Poll status (2 s)",
57
+ "topic": "",
58
+ "payload": "",
59
+ "payloadType": "date",
60
+ "repeat": "2",
61
+ "crontab": "",
62
+ "once": true,
63
+ "onceDelay": 2,
64
+ "z": "tab-tmc2130-demo",
65
+ "x": 140,
66
+ "y": 240,
67
+ "wires": [["tmc2130-node"]]
68
+ },
69
+ {
70
+ "id": "tmc2130-node",
71
+ "type": "periph-tmc2130",
72
+ "name": "TMC2130",
73
+ "bus": "0",
74
+ "device": "0",
75
+ "speedHz": "1000000",
76
+ "stepGpio": "0:27",
77
+ "dirGpio": "0:22",
78
+ "enGpio": "0:17",
79
+ "rsense": "0.11",
80
+ "current": "0.5",
81
+ "microsteps": "16",
82
+ "speed": "200",
83
+ "z": "tab-tmc2130-demo",
84
+ "x": 560,
85
+ "y": 160,
86
+ "wires": [["fn-fault", "dbg-out"]]
87
+ },
88
+ {
89
+ "id": "fn-fault",
90
+ "type": "function",
91
+ "name": "fault / stall check",
92
+ "func": "if (msg.payload.fault) {\n node.warn('TMC2130 fault bitmask: ' + msg.payload.fault);\n return msg;\n}\nif (msg.payload.tstep !== undefined && msg.payload.sg_result < 100) {\n node.warn('TMC2130 SG_RESULT low: ' + msg.payload.sg_result);\n return msg;\n}\nreturn null;",
93
+ "outputs": 1,
94
+ "noerr": 0,
95
+ "z": "tab-tmc2130-demo",
96
+ "x": 780,
97
+ "y": 120,
98
+ "wires": [[]]
99
+ },
100
+ {
101
+ "id": "dbg-out",
102
+ "type": "debug",
103
+ "name": "TMC2130 reply",
104
+ "active": true,
105
+ "tosidebar": true,
106
+ "console": false,
107
+ "tostatus": false,
108
+ "complete": "payload",
109
+ "z": "tab-tmc2130-demo",
110
+ "x": 780,
111
+ "y": 200,
112
+ "wires": []
113
+ }
114
+ ]
@@ -0,0 +1,151 @@
1
+ [
2
+ {
3
+ "id": "tab-tmc2208-demo",
4
+ "type": "tab",
5
+ "label": "TMC2208 Stepper Demo",
6
+ "disabled": false,
7
+ "info": "A silent desk-fan / camera-slider controller. One Inject node sends {enable: true, current: 0.8, microsteps: 16} once at start. A second Inject node ticks every 5 s into a Function node that cycles the commands {speed: 200}, {speed: -200}, {stop: true}, so the TMC2208's internal step generator turns the motor forward, backward and stops, without any STEP pulses. A third Inject node polls the driver status every 2 s (any other message); a Function node checks msg.payload.fault and raises a Node-RED warning when it is non-zero, while a Debug node shows every reply."
8
+ },
9
+ {
10
+ "id": "inj-setup",
11
+ "type": "inject",
12
+ "name": "Enable 0.8 A, 16 microsteps",
13
+ "topic": "",
14
+ "payload": "{\"enable\":true,\"current\":0.8,\"microsteps\":16}",
15
+ "payloadType": "json",
16
+ "repeat": "",
17
+ "crontab": "",
18
+ "once": true,
19
+ "onceDelay": 1,
20
+ "z": "tab-tmc2208-demo",
21
+ "x": 190,
22
+ "y": 80,
23
+ "wires": [
24
+ [
25
+ "tmc2208-node"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "inj-cycle",
31
+ "type": "inject",
32
+ "name": "Cycle tick (5 s)",
33
+ "topic": "",
34
+ "payload": "",
35
+ "payloadType": "date",
36
+ "repeat": "5",
37
+ "crontab": "",
38
+ "once": true,
39
+ "onceDelay": 3,
40
+ "z": "tab-tmc2208-demo",
41
+ "x": 140,
42
+ "y": 160,
43
+ "wires": [
44
+ [
45
+ "fn-cycle"
46
+ ]
47
+ ]
48
+ },
49
+ {
50
+ "id": "fn-cycle",
51
+ "type": "function",
52
+ "name": "speed 200 / -200 / stop",
53
+ "func": "const seq = [{ speed: 200 }, { speed: -200 }, { stop: true }];\nconst i = context.get('step') || 0;\ncontext.set('step', (i + 1) % seq.length);\nmsg.payload = seq[i];\nreturn msg;",
54
+ "outputs": 1,
55
+ "noerr": 0,
56
+ "z": "tab-tmc2208-demo",
57
+ "x": 350,
58
+ "y": 160,
59
+ "wires": [
60
+ [
61
+ "tmc2208-node"
62
+ ]
63
+ ]
64
+ },
65
+ {
66
+ "id": "inj-poll",
67
+ "type": "inject",
68
+ "name": "Poll status (2 s)",
69
+ "topic": "",
70
+ "payload": "",
71
+ "payloadType": "date",
72
+ "repeat": "2",
73
+ "crontab": "",
74
+ "once": true,
75
+ "onceDelay": 2,
76
+ "z": "tab-tmc2208-demo",
77
+ "x": 140,
78
+ "y": 240,
79
+ "wires": [
80
+ [
81
+ "tmc2208-node"
82
+ ]
83
+ ]
84
+ },
85
+ {
86
+ "id": "tmc2208-node",
87
+ "type": "periph-tmc2208",
88
+ "z": "tab-tmc2208-demo",
89
+ "name": "TMC2208",
90
+ "port": "/dev/ttyS0",
91
+ "baudrate": "115200",
92
+ "rsense": "0.11",
93
+ "current": "0.5",
94
+ "microsteps": "16",
95
+ "enGpio": "",
96
+ "x": 570,
97
+ "y": 160,
98
+ "wires": [
99
+ [
100
+ "fn-fault",
101
+ "dbg-status"
102
+ ]
103
+ ]
104
+ },
105
+ {
106
+ "id": "fn-fault",
107
+ "type": "function",
108
+ "name": "warn on fault",
109
+ "func": "if (msg.payload.fault) {\n node.warn('TMC2208 fault bitmask: ' + msg.payload.fault);\n return msg;\n}\nreturn null;",
110
+ "outputs": 1,
111
+ "noerr": 0,
112
+ "z": "tab-tmc2208-demo",
113
+ "x": 790,
114
+ "y": 120,
115
+ "wires": [
116
+ [
117
+ "dbg-fault"
118
+ ]
119
+ ]
120
+ },
121
+ {
122
+ "id": "dbg-status",
123
+ "type": "debug",
124
+ "name": "Driver status",
125
+ "active": true,
126
+ "tosidebar": true,
127
+ "console": false,
128
+ "tostatus": false,
129
+ "complete": "payload",
130
+ "targetType": "msg",
131
+ "z": "tab-tmc2208-demo",
132
+ "x": 790,
133
+ "y": 200,
134
+ "wires": []
135
+ },
136
+ {
137
+ "id": "dbg-fault",
138
+ "type": "debug",
139
+ "name": "Fault",
140
+ "active": true,
141
+ "tosidebar": true,
142
+ "console": false,
143
+ "tostatus": false,
144
+ "complete": "payload",
145
+ "targetType": "msg",
146
+ "z": "tab-tmc2208-demo",
147
+ "x": 970,
148
+ "y": 120,
149
+ "wires": []
150
+ }
151
+ ]
@@ -0,0 +1,151 @@
1
+ [
2
+ {
3
+ "id": "tab-tmc2209-demo",
4
+ "type": "tab",
5
+ "label": "TMC2209 Stepper Demo",
6
+ "disabled": false,
7
+ "info": "A StallGuard4 stall-monitoring slider controller. One Inject node sends {enable: true, current: 0.8, microsteps: 16, stall_threshold: 60} once at start. A second Inject node ticks every 5 s into a Function node that cycles the commands {speed: 200}, {speed: -200}, {stop: true}, so the TMC2209's internal step generator turns the motor forward, backward and stops, without any STEP pulses. A third Inject node polls the driver status every 2 s (any other message); a Function node checks msg.payload.fault and sg_result (below 2 * stall_threshold) and raises a Node-RED warning, while a Debug node shows every reply."
8
+ },
9
+ {
10
+ "id": "inj-setup",
11
+ "type": "inject",
12
+ "name": "Enable 0.8 A, 16 microsteps, SGTHRS 60",
13
+ "topic": "",
14
+ "payload": "{\"enable\":true,\"current\":0.8,\"microsteps\":16,\"stall_threshold\":60}",
15
+ "payloadType": "json",
16
+ "repeat": "",
17
+ "crontab": "",
18
+ "once": true,
19
+ "onceDelay": 1,
20
+ "z": "tab-tmc2209-demo",
21
+ "x": 190,
22
+ "y": 80,
23
+ "wires": [
24
+ [
25
+ "tmc2209-node"
26
+ ]
27
+ ]
28
+ },
29
+ {
30
+ "id": "inj-cycle",
31
+ "type": "inject",
32
+ "name": "Cycle tick (5 s)",
33
+ "topic": "",
34
+ "payload": "",
35
+ "payloadType": "date",
36
+ "repeat": "5",
37
+ "crontab": "",
38
+ "once": true,
39
+ "onceDelay": 3,
40
+ "z": "tab-tmc2209-demo",
41
+ "x": 140,
42
+ "y": 160,
43
+ "wires": [
44
+ [
45
+ "fn-cycle"
46
+ ]
47
+ ]
48
+ },
49
+ {
50
+ "id": "fn-cycle",
51
+ "type": "function",
52
+ "name": "speed 200 / -200 / stop",
53
+ "func": "const seq = [{ speed: 200 }, { speed: -200 }, { stop: true }];\nconst i = context.get('step') || 0;\ncontext.set('step', (i + 1) % seq.length);\nmsg.payload = seq[i];\nreturn msg;",
54
+ "outputs": 1,
55
+ "noerr": 0,
56
+ "z": "tab-tmc2209-demo",
57
+ "x": 350,
58
+ "y": 160,
59
+ "wires": [
60
+ [
61
+ "tmc2209-node"
62
+ ]
63
+ ]
64
+ },
65
+ {
66
+ "id": "inj-poll",
67
+ "type": "inject",
68
+ "name": "Poll status (2 s)",
69
+ "topic": "",
70
+ "payload": "",
71
+ "payloadType": "date",
72
+ "repeat": "2",
73
+ "crontab": "",
74
+ "once": true,
75
+ "onceDelay": 2,
76
+ "z": "tab-tmc2209-demo",
77
+ "x": 140,
78
+ "y": 240,
79
+ "wires": [
80
+ [
81
+ "tmc2209-node"
82
+ ]
83
+ ]
84
+ },
85
+ {
86
+ "id": "tmc2209-node",
87
+ "type": "periph-tmc2209",
88
+ "z": "tab-tmc2209-demo",
89
+ "name": "TMC2209",
90
+ "port": "/dev/ttyS0",
91
+ "baudrate": "115200",
92
+ "rsense": "0.11",
93
+ "current": "0.5",
94
+ "microsteps": "16",
95
+ "enGpio": "",
96
+ "x": 570,
97
+ "y": 160,
98
+ "wires": [
99
+ [
100
+ "fn-fault",
101
+ "dbg-status"
102
+ ]
103
+ ]
104
+ },
105
+ {
106
+ "id": "fn-fault",
107
+ "type": "function",
108
+ "name": "warn on fault",
109
+ "func": "if (msg.payload.fault) {\n node.warn('TMC2209 fault bitmask: ' + msg.payload.fault);\n return msg;\n}\nif (msg.payload.speed === undefined && msg.payload.sg_result < 120) {\n node.warn('TMC2209 possible stall, SG_RESULT ' + msg.payload.sg_result);\n return msg;\n}\nreturn null;",
110
+ "outputs": 1,
111
+ "noerr": 0,
112
+ "z": "tab-tmc2209-demo",
113
+ "x": 790,
114
+ "y": 120,
115
+ "wires": [
116
+ [
117
+ "dbg-fault"
118
+ ]
119
+ ]
120
+ },
121
+ {
122
+ "id": "dbg-status",
123
+ "type": "debug",
124
+ "name": "Driver status",
125
+ "active": true,
126
+ "tosidebar": true,
127
+ "console": false,
128
+ "tostatus": false,
129
+ "complete": "payload",
130
+ "targetType": "msg",
131
+ "z": "tab-tmc2209-demo",
132
+ "x": 790,
133
+ "y": 200,
134
+ "wires": []
135
+ },
136
+ {
137
+ "id": "dbg-fault",
138
+ "type": "debug",
139
+ "name": "Fault",
140
+ "active": true,
141
+ "tosidebar": true,
142
+ "console": false,
143
+ "tostatus": false,
144
+ "complete": "payload",
145
+ "targetType": "msg",
146
+ "z": "tab-tmc2209-demo",
147
+ "x": 970,
148
+ "y": 120,
149
+ "wires": []
150
+ }
151
+ ]
@@ -0,0 +1,26 @@
1
+ [
2
+ {"id": "tab-tmc5160-demo", "type": "tab", "label": "TMC5160 Stepper Demo", "disabled": false,
3
+ "info": "A positioning stage driven by the TMC5160 ramp generator. One Inject node sends {enable: true, current: 1.5, speed: 300, acceleration: 800} once at start. A second Inject node ticks every 5 s into a Function node that alternates {move_to: 400} and {move_to: 0}, so the chip moves forward and back by itself. A third Inject node polls the driver status every 2 s (any other message); a Function node checks msg.payload.fault and raises a Node-RED warning when it is non-zero and a notice when sg_result drops below 100, while a Debug node shows every reply."},
4
+ {"id": "inj-setup", "type": "inject", "name": "Enable 1.5 A, 300 steps/s, 800 steps/s²", "topic": "",
5
+ "payload": "{\"enable\":true,\"current\":1.5,\"speed\":300,\"acceleration\":800}", "payloadType": "json",
6
+ "repeat": "", "crontab": "", "once": true, "onceDelay": 1, "z": "tab-tmc5160-demo", "x": 220, "y": 80,
7
+ "wires": [["tmc5160-node"]]},
8
+ {"id": "inj-cycle", "type": "inject", "name": "Cycle tick (5 s)", "topic": "", "payload": "", "payloadType": "date",
9
+ "repeat": "5", "crontab": "", "once": true, "onceDelay": 3, "z": "tab-tmc5160-demo", "x": 140, "y": 160,
10
+ "wires": [["fn-cycle"]]},
11
+ {"id": "fn-cycle", "type": "function", "name": "move_to 400 / 0",
12
+ "func": "const seq = [{ move_to: 400 }, { move_to: 0 }];\nconst i = context.get('step') || 0;\ncontext.set('step', (i + 1) % seq.length);\nmsg.payload = seq[i];\nreturn msg;",
13
+ "outputs": 1, "noerr": 0, "z": "tab-tmc5160-demo", "x": 330, "y": 160, "wires": [["tmc5160-node"]]},
14
+ {"id": "inj-poll", "type": "inject", "name": "Poll status (2 s)", "topic": "", "payload": "", "payloadType": "date",
15
+ "repeat": "2", "crontab": "", "once": true, "onceDelay": 2, "z": "tab-tmc5160-demo", "x": 140, "y": 240,
16
+ "wires": [["tmc5160-node"]]},
17
+ {"id": "tmc5160-node", "type": "periph-tmc5160", "name": "TMC5160", "bus": "spi", "spiBus": "0", "spiDevice": "0",
18
+ "port": "/dev/ttyS0", "baudrate": "115200", "address": "0", "echo": true, "enGpio": "0:17", "diag0Gpio": "", "diag1Gpio": "",
19
+ "rsense": "0.075", "fclk": "12000000", "current": "1.0", "speed": "200", "acceleration": "400",
20
+ "z": "tab-tmc5160-demo", "x": 560, "y": 160, "wires": [["fn-fault", "dbg-out"]]},
21
+ {"id": "fn-fault", "type": "function", "name": "fault / stall check",
22
+ "func": "if (msg.payload.fault) {\n node.warn('TMC5160 fault bitmask: ' + msg.payload.fault);\n return msg;\n}\nif (msg.payload.tstep !== undefined && msg.payload.sg_result < 100) {\n node.warn('TMC5160 SG_RESULT low: ' + msg.payload.sg_result);\n return msg;\n}\nreturn null;",
23
+ "outputs": 1, "noerr": 0, "z": "tab-tmc5160-demo", "x": 780, "y": 120, "wires": [[]]},
24
+ {"id": "dbg-out", "type": "debug", "name": "TMC5160 reply", "active": true, "tosidebar": true, "console": false,
25
+ "tostatus": false, "complete": "payload", "z": "tab-tmc5160-demo", "x": 780, "y": 200, "wires": []}
26
+ ]
@@ -0,0 +1,116 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('periph-tmc2130', {
3
+ category: 'Peripheral',
4
+ color: '#C084FC',
5
+ defaults: {
6
+ name: { value: '' },
7
+ bus: { value: '0', required: true, validate: RED.validators.number() },
8
+ device: { value: '0', required: true, validate: RED.validators.number() },
9
+ speedHz: { value: '1000000', validate: RED.validators.number() },
10
+ stepGpio: { value: '0:27', required: true },
11
+ dirGpio: { value: '0:22', required: true },
12
+ enGpio: { value: '' },
13
+ rsense: { value: '0.11', required: true, validate: RED.validators.number() },
14
+ current: { value: '0.5', validate: RED.validators.number() },
15
+ microsteps: { value: '16' },
16
+ speed: { value: '200', validate: RED.validators.number() }
17
+ },
18
+ inputs: 1,
19
+ outputs: 1,
20
+ icon: 'font-awesome/fa-cog',
21
+ label: function() { return this.name || 'TMC2130'; },
22
+ paletteLabel: 'TMC2130'
23
+ });
24
+ </script>
25
+
26
+ <script type="text/html" data-template-name="periph-tmc2130">
27
+ <div class="form-row">
28
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
29
+ <input type="text" id="node-input-name" placeholder="TMC2130">
30
+ </div>
31
+ <div class="form-row">
32
+ <label for="node-input-bus"><i class="fa fa-plug"></i> SPI bus</label>
33
+ <input type="number" id="node-input-bus" min="0" style="width:100px">
34
+ </div>
35
+ <div class="form-row">
36
+ <label for="node-input-device"><i class="fa fa-plug"></i> SPI device (CS)</label>
37
+ <input type="number" id="node-input-device" min="0" style="width:100px">
38
+ </div>
39
+ <div class="form-row">
40
+ <label for="node-input-speedHz"><i class="fa fa-tachometer"></i> SPI clock (Hz)</label>
41
+ <input type="number" id="node-input-speedHz" min="100000" max="4000000" style="width:120px">
42
+ </div>
43
+ <div class="form-row">
44
+ <label for="node-input-stepGpio"><i class="fa fa-microchip"></i> STEP GPIO</label>
45
+ <input type="text" id="node-input-stepGpio" placeholder="e.g. 0:27" style="width:140px">
46
+ </div>
47
+ <div class="form-row">
48
+ <label for="node-input-dirGpio"><i class="fa fa-microchip"></i> DIR GPIO</label>
49
+ <input type="text" id="node-input-dirGpio" placeholder="e.g. 0:22" style="width:140px">
50
+ </div>
51
+ <div class="form-row">
52
+ <label for="node-input-enGpio"><i class="fa fa-microchip"></i> ENN GPIO (optional)</label>
53
+ <input type="text" id="node-input-enGpio" placeholder="not wired, e.g. 0:17" style="width:140px">
54
+ </div>
55
+ <div class="form-row">
56
+ <label for="node-input-rsense"><i class="fa fa-bolt"></i> Sense resistor (Ω)</label>
57
+ <input type="number" id="node-input-rsense" min="0.01" step="0.01" style="width:100px">
58
+ </div>
59
+ <div class="form-row">
60
+ <label for="node-input-current"><i class="fa fa-bolt"></i> Default current (A RMS)</label>
61
+ <input type="number" id="node-input-current" min="0" max="1.4" step="0.05" style="width:100px">
62
+ </div>
63
+ <div class="form-row">
64
+ <label for="node-input-microsteps"><i class="fa fa-th"></i> Default microsteps</label>
65
+ <select id="node-input-microsteps" style="width:100px">
66
+ <option value="1">1</option><option value="2">2</option><option value="4">4</option>
67
+ <option value="8">8</option><option value="16">16</option><option value="32">32</option>
68
+ <option value="64">64</option><option value="128">128</option><option value="256">256</option>
69
+ </select>
70
+ </div>
71
+ <div class="form-row">
72
+ <label for="node-input-speed"><i class="fa fa-forward"></i> Default speed (full steps/s)</label>
73
+ <input type="number" id="node-input-speed" min="1" style="width:100px">
74
+ </div>
75
+ </script>
76
+
77
+ <script type="text/html" data-help-name="periph-tmc2130">
78
+ <p>Drives a two-phase bipolar stepper motor through a Trinamic TMC2130 over SPI (Mode 3). The chip has no internal step generator, so the node pulses the STEP and DIR GPIOs; moves are blocking.</p>
79
+
80
+ <h3>Inputs</h3>
81
+ <dl class="message-properties">
82
+ <dt>payload.move <span class="property-type">number</span></dt>
83
+ <dd>Full steps to move; negative = reverse. Blocks until finished.</dd>
84
+ <dt>payload.speed <span class="property-type">number</span></dt>
85
+ <dd>Speed in full steps per second for <code>move</code>; defaults to the configured speed.</dd>
86
+ <dt>payload.current <span class="property-type">number</span></dt>
87
+ <dd>Run current in A RMS (at most 1.4); hold current becomes one third of it.</dd>
88
+ <dt>payload.microsteps <span class="property-type">number</span></dt>
89
+ <dd>Microstep resolution: 1, 2, 4, 8, 16, 32, 64, 128 or 256.</dd>
90
+ <dt>payload.stall_threshold <span class="property-type">number</span></dt>
91
+ <dd>StallGuard2 threshold <code>sgt</code> −64…63; lower is more sensitive.</dd>
92
+ <dt>payload.spreadcycle <span class="property-type">boolean</span></dt>
93
+ <dd><code>true</code> selects SpreadCycle only (needed for StallGuard2), <code>false</code> StealthChop.</dd>
94
+ <dt>payload.enable <span class="property-type">boolean</span></dt>
95
+ <dd><code>true</code> switches the power stage on, <code>false</code> off (the motor freewheels).</dd>
96
+ <dt>payload <span class="property-type">any</span></dt>
97
+ <dd>Any other message polls the driver status.</dd>
98
+ </dl>
99
+
100
+ <h3>Outputs</h3>
101
+ <dl class="message-properties">
102
+ <dt>payload.standstill <span class="property-type">boolean</span></dt>
103
+ <dd>The motor is at standstill.</dd>
104
+ <dt>payload.fault <span class="property-type">number</span></dt>
105
+ <dd>Fault bitmask: 1 over-temperature pre-warning, 2 over-temperature, 4 short to GND, 16 open load (informative only); <code>0</code> = none.</dd>
106
+ <dt>payload.cs_actual <span class="property-type">number</span></dt>
107
+ <dd>Actual current scale 0–31.</dd>
108
+ <dt>payload.sg_result <span class="property-type">number</span></dt>
109
+ <dd>StallGuard2 result 0–1023 (0 = highest load).</dd>
110
+ <dt>payload.tstep, stallguard, otpw, ot</dt>
111
+ <dd>Status polls only: time between microsteps, stall flag, over-temperature pre-warning and shutdown flags.</dd>
112
+ </dl>
113
+
114
+ <h3>Configuration</h3>
115
+ <p>Connect the chip to the SPI bus (SPI_MODE pin high, SCK idles high) and set the bus and device numbers (<code>/dev/spidevB.D</code>). STEP and DIR GPIOs are given as <code>chip:line</code> (e.g. <code>0:27</code>, needs the <code>opengpio</code> package); the optional ENN GPIO drives the enable pin, otherwise the node switches the power stage through the chopper (<code>TOFF</code>). Set the external sense resistor value (0.11 Ω on common boards) and the default current, microsteps and speed applied at start. The driver is disabled when the node is closed.</p>
116
+ </script>