Skip to content

stepper module

doomke edited this page Jul 20, 2023 · 8 revisions

Description

Manages, drives and tracks the position of a 4 phase stepper motor. Essentially a wrapper for AccelStepper, but so far only supporting 4 phase motors.

Settings

name type range description
accell integer > 0 acceleration of the motor in steps/s2
speed integer > 0 maximum speed of the motor in steps/s
position integer current position of the motor in steps
minimum integer lower end of the step range, the motor will not go lower than this[1]
maximum integer upper end of the step range, the motor will not go higher than this[1]
initial integer number of steps driven on initialization. Does not respect step range limits. Sets position to minimum if < 0 and to maximum if > 0. No effect if = 0.
infoLED String controlId of a led module. Module will instruct led to indicate if a user made changes[2]
pin[4] integer > 0 output pins used to control the stepper motor [3]
  1. The only exemption to this is the initialization of the motor, where the limits are ignored. This can be used to drive the motor against a physical barrier for a quick and dirty "calibration"
  2. Defaults to an empty String, in which case no attempts to operate the LED will be made.
  3. For a 28BYJ-48 stepper one of the following two pin configurations are recommended:
pin# 1st 2nd
1 19 4
2 22 17
3 21 16
4 23 18

Command Keys

key type range description
move integer drive the specified amount of steps relative from the current position
moveTo integer drive to the specified position on the step range (absolute position)
binaryCtrl boolean move minimum of step range if false and to maximum if true
hold boolean keep motor coils powered after movement if true
identify integer > 0 highlight the hardware by its LED[4] for the specified time (in ms)
  1. infoLED must be assigned, otherwise no LED will light up

Status

"controlId":"top",
"status":
{
    "busy":"true",
    "absolute":0,
    "relative":50
}
  • busy – boolean, true if the motor is currently moving to a new position
  • absolute – integer, current position of the motor in steps
  • relative – float, current position of the motor as percentage of the total range

Events

  • busy – emitted when the module is starting to move a motor
  • ready – emitted when the target position has been reached

General

Guides

Principle of Operation

Modules

Software Hardware
camera camera
infoLED infoLED
input input
macro macro
output output
servo servo
socket socket
stepper stepper
WiFi wifi

Clone this wiki locally