How to configure an older style trough with two coils and switches for each ball¶
This guide will show you how to configure MPF to use an older-style drain and trough combination that uses two coils (one to eject the ball from the drain hole and a second to release a ball into the plunger lane).
This guide is written for the types of systems where the trough side (after the “hump”) has multiple switches—one for each ball that’s sitting there.
Here’s an example of a Williams System 11 trough that uses this system, from a Pin*Bot machine:
If your machine’s trough system is like this but you only have one switch on the trough side (like Gottlieb System 3 machines), then use this guide instead.
The following diagram shows how the layout that this guide is written for works: (This is a side view)
This style of trough and drain was used in Williams System 11 machines and early WPC machines (Addams Family, T2, Hurricane, and a few others).
1. Add the switches¶
The first step is to add all the switches to the
section of your config file. Create an entry in your
switches: section for
the drain switch as well as each switch in your trough, like this: (This
example has three switches in the trough. Yours may have more or less.)
switches: s_drain: number: 1 s_trough1: number: 2 s_trough2: number: 3 s_trough3: number: 4
Note that we configured this switches with numbers
you should use the actual switch numbers for your control system that the trough
switches are connected to. (See How to configure “number:” settings for instructions for
each type of control system.)
It makes no difference which switch is which (in terms of whether Switch 1 is on the left side or the right side). Also the actual switch names don’t really matter. We use s_trough1 through s_trough3 though you can call them s_ball_trough_1 or trough_ball_1 or s_mr_potatohead.
2. Add the coils¶
Next, create the entries in your
coils: section for the drain eject
coil and the trough release coil. Again, the names don’t matter. We’ll call
them c_drain_eject and c_trough_release and enter them like this:
coils: c_drain_eject: number: 3 default_pulse_ms: 20 c_trough_release: number: 4 default_pulse_ms: 20
number: entries in your config will vary depending on your actual
hardware, and again, you can pick whatever name you want for your coil.
You’ll also note that we went ahead and entered
default_pulse_ms: values of 20
which will override the default pulse times of 10ms. It’s hard to say
at this point what values you’ll actually need. You can always adjust
this at any time. You can play with the exact values in a bit once we
finish getting everything set up.
Note that some trough coils use a shorter pulse to pop the ball into the plunger
lane. However, some machines have gates or rotational devices that need to be
active for much longer. So having a long pulse time, like
(for one second) is totally fine. However, if the pulse time is over 255ms, then
technically that coil is enabled and disabled versus pulsed, so in that case,
you also need to add
allow_enable: true which tells MPF it’s ok to enable
this coil for more than 255ms (since 255ms is the maximum pulse time for most
In other words, a trough release time of 1s would look like this:
coils: c_trough_release: number: 4 default_pulse_ms: 1000 allow_enable: true
3. Add your “drain” ball device¶
In MPF, anything that holds and releases a ball is a ball device. With this drain/trough setup, there are actually two ball devices—one for the drain and a second for the trough.
Let’s add the drain device first, which we’ll add to the
section of your machine config. (If you don’t have that section add it now.)
Then in your
ball_devices: section, create an entry called
This means that you’re creating a ball device called bd_drain.
We use the preface bd_ to indicate that this is a ball device
which makes it easier when we’re referencing them later. Then under
bd_drain: entry, you’ll start entering the
configuration settings for your drain ball device.
ball_switches: s_drainwhich means this device will use the s_drain switch to know whether or not this device has a ball.
eject_coil: c_drain_ejectwhich is the name of the coil that will eject the ball from the drain.
eject_targets: bd_troughwhich tells MPF that this ball device ejects its balls into the device called bd_trough. (We’ll create that device in the next step.)
tags: drainwhich tells MPF that balls entering this device mean that a ball has drained from the playfield.
Your drain device configuration should look now look like this:
ball_devices: bd_drain: ball_switches: s_drain eject_coil: c_drain_eject eject_targets: bd_trough tags: drain
4. Add your “trough” ball device¶
Next create a second entry in the
ball_devices: section called
that will be for the trough device that holds the balls that are ejected from
the drain before they’re released into the plunger lane.
The configuration is pretty straightforward:
ball_switches: s_trough1, s_trough2, s_trough3tells this device that those switches are used to count balls in the trough. (You may have more or less than 3. Also the order of these doesn’t matter.
eject_coil: c_trough_releasewhich is the name of the coil that will be pulsed to eject the ball from the drain.
eject_targets: bd_plunger_lanewhich tells MPF that this ball device ejects its balls into the device called bd_plunger_lane. (We won’t actually create the plunger device in this How To guide, but you need to have it, so see the Plungers & Ball Launch Devices documentation for full details since there are lots of different types of plungers.
tags: home, troughwhich tells MPF that it’s ok to store unused balls here and that it’s ok for balls to be here when games start.
Your trough device configuration should look now look like this:
ball_devices: bd_trough: ball_switches: s_trough1, s_trough2, s_trough3 eject_coil: c_trough_release eject_targets: bd_plunger_lane tags: home, trough
5. Configure your virtual hardware to start with balls in the trough¶
While we’re talking about the trough, it’s probably a good idea to configure
MPF so that when you start it in virtual mode (with no physical hardware) that
it starts with the trough full of balls. To do this, add a new section to your
config file called
virtual_platform_start_active_switches:. (Sorry this
entry name is hilariously long.) As its name implies,
virtual_platform_start_active_switches: lets you list the names of
switches that you want to start in the “active” state when you’re
running MPF with the virtual platform interfaces.
The reason these only work with the virtual platforms is because if you’re running MPF while connected to a physical pinball machine, it doesn’t really make sense to tell MPF which switches are active since MPF can read the actual switches from the physical machine. So you can add this section to your config file, but MPF only reads this section when you’re running with one of the virtual hardware interfaces. To use it, simply add the section along with a list of the switches you want to start active. For example:
virtual_platform_start_active_switches: s_trough1 s_trough2 s_trough3
Here’s the complete config¶
#config_version=5 switches: s_drain: number: 1 s_trough1: number: 2 s_trough2: number: 3 s_trough3: number: 4 s_plunger: number: 10 coils: c_drain_eject: number: 3 default_pulse_ms: 20 c_trough_release: number: 4 default_pulse_ms: 20 ball_devices: bd_drain: ball_switches: s_drain eject_coil: c_drain_eject eject_targets: bd_trough tags: drain bd_trough: ball_switches: s_trough1, s_trough2, s_trough3 eject_coil: c_trough_release eject_targets: bd_plunger_lane tags: home, trough # bd_plunger is a placeholder just so the trough's eject_targets are valid bd_plunger_lane: ball_switches: s_plunger mechanical_eject: true playfields: playfield: default_source_device: bd_plunger_lane tags: default virtual_platform_start_active_switches: s_trough1 s_trough2 s_trough3