Skip to content

Understanding Hardware Rules

As you can imagine, many types of mechanisms in a pinball machine require near "instant" response to switches. For example, you do not want any "lag" between the time you press the flipper button and the time the flipper physically moves.

To address this, MPF and the control systems handle "quick response" devices in a special way. This includes things like:

  • flippers
  • pop bumpers
  • slingshots
  • kicking targets
  • kickback lanes
  • diverters
  • and maybe others?

What's the problem?

To understand why MPF and the hardware control systems work this way, first think about how MPF works in general.

When you configure (and enable) a flipper in MPF, what you're really doing is saying, "when this switch becomes active, fire this coil" (and do that as fast as possible).

The challenge is that MPF is software running on a computer connected to a pinball control system via USB. So if you think about the entire process that needs to happen to flip a flipper, you have:

  1. The hardware control system is continuously scanning switches to see if they change state.
  2. The player pushes the flipper button.
  3. The hardware control system notices the change.
  4. The hardware control system adds the message with the switch state change to the queue to be sent to the computer via USB.
  5. The computer processes the USB message.
  6. MPF gets notification of the switch change.
  7. MPF looks at its configuration and notices that a coil should be fired.
  8. MPF creates the instruction to fire the coil.
  9. That instruction is put in the queue to be sent to the hardware controller via USB.
  10. The USB bus transfers that command to the hardware controller.
  11. The hardware controller receives that command and fires the coil attached to the flipper.

Of course computers are really fast, and this can all happen in 10 or 20ms. But again, with the desire for "instant" response of these devices, that isn't fast enough.

The solution? "Hardware rules"

So the way this is handled is that all the pinball control systems have the ability to have simple "rules" written to them which lets them do simple things on their own.

These rules are very simple and only involve switches and coils. For example, a rule might be "when this switch is activated, pulse that coil", or "when this switch is released, cut off the power to that coil".

Then when one of these "hardware rules" (as we call them in MPF) is written to the hardware pinball controller, that controller can handle it all by itself with minimal delay (usually in a millisecond or two) without having to deal with USB and MPF and all that.

These rules are not permanently stored on the hardware controller, and in fact they're constantly added, removed, and updated throughout the course of a game. (Rules for flipper buttons and coils are removed when a ball ends and added when a ball starts, etc.)

By the way, even when MPF writes hardware rules to the pinball controller, the switch notification is still sent to MPF (since you might want to have scoring or play a sound or something when that switch is hit). It's just that in that case, the switch notification is sent to MPF for MPF's game logic purposes, but the actual coil firing would have already happened thanks to the hardware rule on the pinball controller.

This is all automatic

The good news about these hardware rules is that there's nothing you need to do to use them. This is just one of the things that MPF does behind the scenes, thanks to the smart people who designed the pinball controllers.

What kind of rules does MPF use?

  1. Pulse + Cancel: This means that we pulse a coil when a switch becomes active and cancel the pulse when the switch becomes inactive.
  2. Pulse + Cancel + Hold: This means that we pulse and then enable a coil with pwm when a switch becomes active and cancel the pulse when the switch becomes inactive.
  3. Just Pulse: This means that we pulse a coil when a switch becomes active but never cancel the pulse.
  4. Pulse + Cancel + Hold + EOS: This means that we pulse and then enable a coil with pwm when a switch becomes active and cancel the pulse when the switch becomes inactive. Additionally, the pulse is changed to pwm when EOS becomes inactive (it's usually normally closed).

For most platforms 1 and 2 is basically the same rule (e.g. rule 1 is rule 2 with hold power = 0).

We use type 2 for single wound flippers. For dual wound we use type 1 on the main/high power coils and type 2 on the hold coil (often with 100% pwm = full enable). When flippers have EOS we use type 4 rules (for dual wound flippers with hold=0). Rule 3 is used for pop bumpers.

Not all platforms support all types of rules. In those cases we use the next best available rule (e.g. 1 instead of 3 or the other way around).


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