Skip to content

Stepper Motors

Related Config File Sections:

image

image

Stepper motors offer digitally controlled precise movement of mechanisms. They require a separate driver board that interfaces with the host computer by USB or through the pinball machine controller. Steppers have a unique design with two or more sets of coils which when energized sequentially turn the armature a set distance, typically 1.8 degrees.

Overview video about steppers:

Steppers vs Servos

It is useful to compare stepper motors to servo motors. While in many cases they can be used interchangeably, each has advantages and disadvantages. The principle advantage of steppers is precision. If used within their torque window, steppers can reproducibly count thousand of steps, reverse them, and land back at the starting position. Generally steppers are faster than servo motors which transmit torque through a gear assembly. Disadvantages of steppers include less torque than offered by servo motors and requiring a driver controller. Also, unlike servos, steppers do not include a feedback mechanism to report the rotational angle of the armature. This deficit requires that a stepper use a homing mechanism (typically a switch) to inform software when the assembly is at an extreme of linear or rotational position. Lastly, steppers are subject to rotational drift when not energized, whereas servos maintain position in their off state.

Stepper controller boards require a minimum of two digital inputs, one for rotational direction and one to trigger a rotational step. Usually one or more additional inputs are also used to control the power state of the driver board and/or motor coils. Some driver boards also allow programming of microstepping to command rotation at less than that of a full step.

MPF abstracts the nitty gritty of stepper control allowing steppers to be used with a minimum of YAML programming. On startup, an event is issued to rotate the motor to a home position. Once homed, further events can be issued which rotate the motor an arbitriary number of steps in either direction as required by the application.

See Servos for more details.

Example config

#config_version=5
switches:
  s_home:
    number:
steppers:
  stepper1:
    number: 1              # depends on your hardware
    homing_mode: switch
    homing_switch: s_home
    named_positions:
      10: move_to_position_1
      20: move_to_position_2
      50: move_to_position_3

When you post move_to_position_1 the stepper will move to the position 10. Similarly, it will move to 20 when you post move_to_position_2 and to 50 when move_to_position_3 is posted. It will track its current position internally.


Something missing or wrong? You can fix it!

This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?

Please help us! You can fix it yourself and be an official "open source" contributor!

It's easy! See our Beginner's guide to editing the docs.

Page navigation via the keyboard: < >

You can navigate this site via the keyboard. There are two modes:

General navigation, when search is not focused:

  • F , S , / : open search dialog
  • P , , : go to previous page
  • N , . : go to next page

While using the search function:

  • Down , Up : select next / previous result
  • Esc , Tab : close search
  • Enter : go to highlighted page in the results