rpi-io 3.1.4 → 3.1.5
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/CHANGELOG.md +4 -0
- package/README.md +3 -0
- package/documentation/stepper-motor.md +8 -11
- package/package.json +1 -1
- package/test/stepper-motor-bipolar.js +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Stepper Motor Extensions
|
|
2
2
|
|
|
3
|
-
Using the basic **rpi-io** methods for output lines (*write*, *pulseStart*, *pulseStop*), it is easy to drive stepper motors, ranging from simple hobbyist motors (e.g
|
|
3
|
+
Using the basic **rpi-io** methods for output lines (*write*, *pulseStart*, *pulseStop*), it is easy to drive stepper motors, ranging from simple hobbyist motors (e.g. 28BYJ-48) to those designed for robotics and industrial applications, such as the NEMA series (e.g. NEMA 17, 23...) using some hardware driver (e.g. DMA542).
|
|
4
4
|
|
|
5
5
|
To facilitate this type of use, since version 3.1 **rpi-io** has included two stepper motor controller classes:
|
|
6
6
|
|
|
@@ -21,7 +21,7 @@ PLEASE NOTE:
|
|
|
21
21
|
|
|
22
22
|
- **Power source for VCC**: for light loads the Pi's 5V pin can drive the ULN2003/motor directly, but the 28BYJ-48 can draw enough current that it's safer to power VCC from a separate 5V supply, keeping only GND common with the Pi.
|
|
23
23
|
|
|
24
|
-
- The four GPIO pins (17, 18, 27, 22) are just a common convention — any four free GPIO pins work, as long as your code
|
|
24
|
+
- The four GPIO pins (17, 18, 27, 22) are just a common convention — any four free GPIO pins work, as long as your code references the pins you actually wired.
|
|
25
25
|
|
|
26
26
|
- The ULN2003 board's output side connects to the motor with its keyed 5-pin connector — it only fits one way, so no wiring decisions needed there.
|
|
27
27
|
|
|
@@ -67,12 +67,10 @@ motor28BYJF.close()
|
|
|
67
67
|
|
|
68
68
|
- **coilD** *{Object}* **rpi-io** instance for Coil D
|
|
69
69
|
|
|
70
|
-
-
|
|
70
|
+
- **mode** *{'half','full'}* sequence mode: half step or full step
|
|
71
71
|
|
|
72
72
|
- **delay** *{Number}* delay in ms between steps
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
74
|
**Return** *{Object}* StepperUnipolar instance
|
|
77
75
|
|
|
78
76
|
|
|
@@ -82,8 +80,8 @@ motor28BYJF.close()
|
|
|
82
80
|
**Parameter(s)**
|
|
83
81
|
|
|
84
82
|
- **steps** *{Number}*
|
|
85
|
-
- **direction** *{'forward'|'backward
|
|
86
|
-
- **showStep** *{Boolean}*
|
|
83
|
+
- **direction** *{'forward'|'backward'}
|
|
84
|
+
- **showStep** *{Boolean}* to display step in console (default = false)
|
|
87
85
|
|
|
88
86
|
**Return** *{Promise}*
|
|
89
87
|
|
|
@@ -107,7 +105,7 @@ PLEASE NOTE:
|
|
|
107
105
|
|
|
108
106
|
- **STEP and DIR switch low to trigger**, since GPIO pulls PUL- or DIR- down relative to the shared +5V.
|
|
109
107
|
|
|
110
|
-
- **Voltage margin is tight**: the Pi's GPIO output high is 3.3V, but the common rail here is 5V, giving only ~1.7V across the optocoupler when
|
|
108
|
+
- **Voltage margin is tight**: the Pi's GPIO output high is 3.3V, but the common rail here is 5V, giving only ~1.7V across the optocoupler when 'off'. Many builds get away with this, but if you see erratic stepping consider using a Darlington array (e.g. ULN2003) between RPi and DM542.
|
|
111
109
|
|
|
112
110
|
- **ENA+/ENA-** would follow the same common-anode pattern if you wire it — tied into the same 5V junction, with a GPIO pin driving ENA- low to enable.
|
|
113
111
|
|
|
@@ -161,7 +159,7 @@ bipolar.stop()
|
|
|
161
159
|
|
|
162
160
|
- **dir** *{Object}* **rpi-io** instance for direction pin
|
|
163
161
|
|
|
164
|
-
-
|
|
162
|
+
- **edge** *{'desc','asc'}* pulse active edge: descending or ascending
|
|
165
163
|
|
|
166
164
|
- **width** *{Number}* pulse width and space between two edges in µs
|
|
167
165
|
|
|
@@ -174,8 +172,7 @@ bipolar.stop()
|
|
|
174
172
|
**Parameter(s)**
|
|
175
173
|
|
|
176
174
|
- **steps** *{Number}*
|
|
177
|
-
- **direction** *{'forward'|'backward
|
|
178
|
-
- **showStep** *{Boolean}* ** to display step in console (default = false)
|
|
175
|
+
- **direction** *{'forward'|'backward'}*
|
|
179
176
|
|
|
180
177
|
**Return** *{Promise<{elapsedMs: number, pulsesCompleted: number, stopped: boolean}>}*
|
|
181
178
|
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ const dir = new RIO(22, "output", {value: 0})
|
|
|
17
17
|
const bipolar = new StepperBipolar(pul, dir, "desc", 10)
|
|
18
18
|
|
|
19
19
|
// Start rotating full turn (depending on hardware driver settings)
|
|
20
|
-
bipolar.rotate(
|
|
20
|
+
bipolar.rotate(6400, "forward").then(stepped => {
|
|
21
21
|
log("stepped:", stepped)
|
|
22
22
|
// Reset and close lines
|
|
23
23
|
pul.write(0)
|