ball_device (example config files)

Machine config examples

Here are some example machine-wide config files that show real-world examples of how these configs are used.

Note that there are multiple machine config examples here. They’re just included to show different options. You wouldn’t actually use more than one.

#config_version=5
coils:
    eject_coil1:
        number:

switches:
    s_ball_switch1:
        number:
    s_ball_switch2:
        number:

ball_devices:
    test_device:
        eject_coil: eject_coil1
        ball_switches: s_ball_switch1, s_ball_switch2
        entrance_events: entrance_event
        debug: true

ball_holds:
    hold_test:
        hold_devices: test_device
        balls_to_hold: 1
        release_one_events: release_test
#config_version=5

playfields:
    playfield:
        default_source_device: trough
        tags: default

coils:
    trough_eject:
        number:

switches:
    s_trough_1:
        number:
    s_trough_2:
        number:
    s_trough_3:
        number:
    s_trough_4:
        number:
    s_trough_jam:
        number:
    s_playfield:
        number:
        tags: playfield_active

ball_devices:
    trough:
        eject_coil: trough_eject
        ball_switches: s_trough_1, s_trough_2, s_trough_3, s_trough_4
        debug: true
        tags: trough, drain, home
#config_version=5

coils:
    trough_eject:
        number:
    plunger_eject:
        number:

playfields:
    playfield:
        default_source_device: plunger
        tags: default

switches:
    s_trough_1:
        number:
    s_trough_2:
        number:
    s_plunger:
        number:
    s_playfield:
        number:
        tags: playfield_active
    s_launch:
        number:
        tags: launch

ball_devices:
    trough:
        eject_coil: trough_eject
        ball_switches: s_trough_1, s_trough_2
        debug: true
        tags: trough, drain, home
        eject_targets: plunger
        confirm_eject_type: target
    plunger:
        eject_coil: plunger_eject
        ball_switches: s_plunger
        debug: true
        mechanical_eject: true
        player_controlled_eject_event: sw_launch
#config_version=5

game:
    balls_per_game: 1

playfields:
    playfield:
        default_source_device: test_target1
        tags: default

coils:
    eject_coil1:
        number:
    eject_coil2:
        number:
    eject_coil3:
        number:
    eject_coil4:
        number:
    eject_coil5:
        number:

switches:
    s_start:
        number:
        tags: start
    s_ball_switch1:
        number:
    s_ball_switch2:
        number:
    s_ball_switch_launcher:
        number:
    s_launcher_confirm:
        number:
    s_ball_switch_target1:
        number:
    s_ball_switch_target2_1:
        number:
    s_ball_switch_target2_2:
        number:
    s_ball_switch_target3:
        number:
    s_playfield:
        number:
        tags: playfield_active

ball_devices:
    test_trough:
        eject_coil: eject_coil1
        ball_switches: s_ball_switch1, s_ball_switch2
        debug: true
        confirm_eject_type: target
        eject_targets: test_launcher
        tags: trough, drain, home
    test_launcher:
        eject_coil: eject_coil2
        ball_switches: s_ball_switch_launcher
        confirm_eject_switch: s_launcher_confirm
        debug: true
        confirm_eject_type: switch
        eject_targets: test_target1, test_target2
        eject_timeouts: 6s, 10s
    test_target1:
        eject_coil: eject_coil3
        ball_switches: s_ball_switch_target1
        debug: true
        confirm_eject_type: target
    test_target2:
        eject_coil: eject_coil4
        ball_switches: s_ball_switch_target2_1, s_ball_switch_target2_2
        debug: true
        tags: trough, drain, home
        confirm_eject_type: target
        eject_targets: test_target3
    test_target3:
        eject_coil: eject_coil5
        ball_switches: s_ball_switch_target3
        debug: true
#config_version=5

game:
    balls_per_game: 1

playfields:
    playfield:
        default_source_device: test_target1
        tags: default

coils:
    eject_coil1:
        number:
    eject_coil2:
        number:
    eject_coil3:
        number:
    eject_coil4:
        number:
    eject_coil5:
        number:

switches:
    s_start:
        number:
        tags: start
    s_ball_switch1:
        number:
    s_ball_switch2:
        number:
    s_ball_switch_launcher:
        number:
    s_ball_switch_target1:
        number:
    s_ball_switch_target2_1:
        number:
    s_ball_switch_target2_2:
        number:
    s_ball_switch_target3:
        number:
    s_playfield:
        number:
        tags: playfield_active

ball_devices:
    test_trough:
        eject_coil: eject_coil1
        ball_switches: s_ball_switch1, s_ball_switch2
        debug: true
        confirm_eject_type: target
        eject_targets: test_launcher
        tags: trough, drain, home
    test_launcher:
        eject_coil: eject_coil2
        ball_switches: s_ball_switch_launcher
        debug: true
        confirm_eject_type: event
        confirm_eject_event: launcher_confirm
        eject_targets: test_target1, test_target2
        eject_timeouts: 6s, 10s
    test_target1:
        eject_coil: eject_coil3
        ball_switches: s_ball_switch_target1
        debug: true
        confirm_eject_type: target
    test_target2:
        eject_coil: eject_coil4
        ball_switches: s_ball_switch_target2_1, s_ball_switch_target2_2
        debug: true
        tags: trough, drain, home
        confirm_eject_type: target
        eject_targets: test_target3
    test_target3:
        eject_coil: eject_coil5
        ball_switches: s_ball_switch_target3
        debug: true
#config_version=5
config:
 - test_ball_device_jam_switch.yaml

virtual_platform_start_active_switches:
  - s_trough_jam
#config_version=5

playfields:
    playfield:
        default_source_device: test_launcher
        tags: default

coils:
    eject_coil1:
        number:
    eject_coil2:
        number:
    eject_coil3:
        number:
    eject_coil4:
        number:
    eject_coil5:
        number:
    eject_coil6:
        number:


switches:
    s_ball_switch1:
        number:
    s_ball_switch2:
        number:
    s_ball_switch_launcher:
        number:
    s_ball_switch_launcher2:
        number:
    s_ball_switch_target:
        number:
    s_playfield:
        number:
        tags: playfield_active
    s_launch:
        number:
        tags: launch
    s_vuk:
        number:



ball_devices:
    test_trough:
        eject_coil: eject_coil1
        ball_switches: s_ball_switch1, s_ball_switch2
        debug: true
        confirm_eject_type: target
        eject_targets: test_launcher
        eject_timeouts: 3s
        tags: trough, drain, home
    test_launcher:
        eject_coil: eject_coil2
        ball_switches: s_ball_switch_launcher
        debug: true
        eject_timeouts: 6s, 10s
        eject_targets: playfield, test_target
        mechanical_eject: true
        confirm_eject_type: target
    test_target:
        eject_coil: eject_coil3
        ball_switches: s_ball_switch_target
        debug: true
        eject_timeouts: 6s
        confirm_eject_type: target
    test_launcher_manual_on_unexpected:
        eject_coil: eject_coil4
        ball_switches: s_ball_switch_launcher2
        debug: true
        eject_timeouts: 6s
        eject_targets: playfield
        mechanical_eject: true
        auto_fire_on_unexpected_ball: false
        confirm_eject_type: target
    test_vuk:
        eject_coil: eject_coil5
        ball_switches: s_vuk
        debug: true
        eject_timeouts: 3s
        eject_targets: test_launcher
        auto_fire_on_unexpected_ball: false
        confirm_eject_type: target
#config_version=5

game:
    balls_per_game: 1

playfields:
    playfield:
        default_source_device: test_trough

switches:
    s_ball_switch1:
        number:
    s_ball_switch2:
        number:
    s_playfield:
        number:
        tags: playfield_active

ball_devices:
    test_trough:
        ejector:
          class: mpf.devices.ball_device.event_ejector.EventEjector
          events_when_eject_try: trough_eject
        ball_switches: s_ball_switch1, s_ball_switch2
        debug: true
        tags: trough, drain, home
#config_version=5

playfields:
    playfield:
        default_source_device: test
        tags: default

coils:
    eject_coil:
        default_hold_power: 0.25
        default_pulse_ms: 20
        number:

switches:
    s_ball1:
        number:
    s_ball2:
        number:

ball_devices:
    test:
        eject_coil: eject_coil
        eject_coil_enable_time: 600ms, 200ms
        ball_switches: s_ball1, s_ball2
        tags: home, trough
        debug: true
#config_version=5

playfields:
    playfield:
        default_source_device: test
        tags: default

coils:
    eject_coil:
        default_hold_power: 0.25
        default_pulse_ms: 20
        number:

switches:
    s_ball1:
        number:
    s_ball2:
        number:

ball_devices:
    test:
        eject_coil: eject_coil
        eject_coil_enable_time: 400ms
        ball_switches: s_ball1, s_ball2
        tags: home, trough
        debug: true
#config_version=5

config: test_gottlieb_trough.yaml

virtual_platform_start_active_switches:
  trough_entry
#config_version=5

game:
    balls_per_game: 1

playfields:
    playfield:
        default_source_device: test_target1
        tags: default

coils:
    eject_coil1:
        number:
    eject_coil2:
        number:
    eject_coil3:
        number:
    eject_coil4:
        number:
    eject_coil5:
        number:

switches:
    s_start:
        number:
        tags: start
    s_ball_switch1:
        number:
    s_ball_switch2:
        number:
    s_ball_switch_launcher:
        number:
    s_ball_switch_target1:
        number:
    s_ball_switch_target2_1:
        number:
    s_ball_switch_target2_2:
        number:
    s_ball_switch_target3:
        number:
    s_ball_switch_target3_2:
        number:
    s_playfield:
        number:
        tags: playfield_active
    s_entrance:
        number:

ball_devices:
    test_trough:
        eject_coil: eject_coil1
        ball_switches: s_ball_switch1, s_ball_switch2
        debug: true
        confirm_eject_type: target
        max_eject_attempts: 3
        eject_targets: test_launcher
        tags: trough, drain, home
    test_launcher:
        eject_coil: eject_coil2
        ball_switches: s_ball_switch_launcher
        debug: true
        confirm_eject_type: target
        eject_targets: test_target1, test_target2
        eject_timeouts: 6s, 10s
    test_target1:
        eject_coil: eject_coil3
        ball_switches: s_ball_switch_target1
        debug: true
        confirm_eject_type: target
    test_target2:
        eject_coil: eject_coil4
        ball_switches: s_ball_switch_target2_1, s_ball_switch_target2_2
        debug: true
        tags: trough, drain, home
        confirm_eject_type: target
        eject_targets: test_target3
    test_target3:
        eject_coil: eject_coil5
        ball_switches: s_ball_switch_target3, s_ball_switch_target3_2
        eject_targets: playfield, test_trough
        confirm_eject_type: target
        debug: true
    test_entrance_ignore_device:
        ball_capacity: 2
        eject_coil: eject_coil5
        entrance_switch: s_entrance
        entrance_switch_ignore_window_ms: 3000
#config_version=5
playfields:
    playfield:
        default_source_device: bd_plunger
        tags: default

coils:
    c_trough_eject:
        number:
    c_autolauncher:
        number:

switches:
    s_trough_switch1:
        number:
    s_trough_switch2:
        number:
    s_trough_switch3:
        number:
    s_trough_jam:
        number:
    s_ball_switch_plunger_lane:
        number:
    s_playfield:
        number:
        tags: playfield_active

ball_devices:
    bd_trough:
        eject_coil: c_trough_eject
        ball_switches: s_trough_switch1, s_trough_switch2, s_trough_switch3, s_trough_jam
        jam_switch: s_trough_jam
        eject_targets: bd_plunger
        eject_timeouts: 3s
        tags: trough, drain, home
        debug: true
    bd_plunger:
        eject_coil: c_autolauncher
        ball_switches: s_ball_switch_plunger_lane
        mechanical_eject: True
        eject_targets: playfield
        eject_timeouts: 4s
        debug: true
#config_version=5

game:
    balls_per_game: 3
    allow_start_with_ball_in_drain: True

machine:
    min_balls: 3

playfields:
    playfield:
        default_source_device: plunger
        tags: default

coils:
    outhole:
        number: 1
    trough:
        number: 2

switches:
    start:
        number: 1
        tags: start
    outhole:
        number: 2
    trough_entry:
        number: 3
    plunger:
        number: 4
    playfield:
        number: 5
        tags: playfield_active

ball_devices:
    outhole:
        tags: drain
        ball_switches: outhole
        eject_timeouts: 2s
        eject_coil: outhole
        eject_targets: trough
        confirm_eject_type: target
        debug: true
    trough:
        tags: trough, home
        entrance_switch: trough_entry
        entrance_switch_full_timeout: 3s
        eject_coil: trough
        eject_targets: plunger
        confirm_eject_type: target
        ball_capacity: 3
        debug: true
    plunger:
        ball_switches: plunger
        mechanical_eject: true
        eject_timeouts: 4s
        debug: true
#config_version=5

config: test_system_11_trough.yaml

virtual_platform_start_active_switches:
  - trough1
  - trough2
  - trough3
  - outhole
#config_version=5

game:
    balls_per_game: 1

playfields:
    playfield:
        default_source_device: test_target1
        tags: default

coils:
    c_trough1:
        number:
    c_trough2:
        number:
    c_launcher:
        number:
    c_target1:
        number:
    c_drain1:
        number:

switches:
    s_trough1_1:
        number:
    s_trough1_2:
        number:
    s_trough2_1:
        number:
    s_trough2_2:
        number:
    s_launcher:
        number:
    s_target1:
        number:
    s_drain1:
        number:
    s_playfield:
        number:
        tags: playfield_active

ball_devices:
    test_trough1:
        eject_coil: c_trough1
        ball_switches: s_trough1_1, s_trough1_2
        eject_targets: test_launcher
        tags: trough, drain, home
    test_launcher:
        eject_coil: c_launcher
        ball_switches: s_launcher
        eject_targets: test_trough2, test_target1
    test_target1:
        eject_coil: c_target1
        ball_switches: s_target1
    test_trough2:
        eject_coil: c_trough2
        ball_switches: s_trough2_1, s_trough2_2
        tags: trough, drain, home
        confirm_eject_type: target
    test_drain:
        eject_coil: c_drain1
        ball_switches: s_drain1
        tags: drain
        eject_targets: playfield, test_target1, test_trough2
#config_version=5

playfields:
    playfield:
        default_source_device: test
        tags: default

coils:
    hold_coil:
        number:
    hold_coil2:
        number:
    hold_coil3:
        number:
    hold_coil4:
        number:

switches:
    s_entrance:
        number:
    s_entrance2:
        number:
    s_entrance_and_hold3:
        number:
    s_ball4_1:
        number:
    s_ball4_2:
        number:

ball_devices:
    test:
        hold_coil: hold_coil
        entrance_switch: s_entrance
        hold_events: test_hold_event
        ball_capacity: 3
        debug: true
        confirm_eject_type: fake
    test2:
        hold_coil: hold_coil2
        entrance_switch: s_entrance2
        hold_events: test_hold_event2
        ball_capacity: 3
        tags: trough, home
        debug: true
        confirm_eject_type: fake
    test3:
        hold_coil: hold_coil3
        entrance_switch: s_entrance_and_hold3
        hold_switches: s_entrance_and_hold3
        tags: trough, home
        debug: true
        eject_timeouts: 2s
        ball_capacity: 2
    test4:
        hold_coil: hold_coil4
        hold_switches: s_ball4_1, s_ball4_2
        ball_switches: s_ball4_1, s_ball4_2
        tags: trough, home
        debug: true
#config_version=5

game:
    balls_per_game: 3
    allow_start_with_ball_in_drain: True

playfields:
    playfield:
        default_source_device: plunger
        tags: default

coils:
    outhole:
        number: C09
        default_pulse_ms: 20
    trough:
        number: C10
        default_pulse_ms: 20

switches:
    start:
        number: S13
        tags: start
    outhole:
        number: S15
    trough1:
        number: S16
    trough2:
        number: S17
    trough3:
        number: S18
    plunger:
        number: S28
    playfield:
        number:
        tags: playfield_active

ball_devices:
    outhole:
        tags: drain
        ball_switches: outhole
        eject_coil: outhole
        eject_targets: trough
        confirm_eject_type: target
        debug: true
    trough:
        tags: trough, home
        ball_switches: trough1, trough2, trough3
        eject_coil: trough
        eject_targets: plunger
        confirm_eject_type: target
        debug: true
    plunger:
        ball_switches: plunger
        mechanical_eject: true
        eject_timeouts: 4s
        debug: true
#config_version=5

playfields:
    playfield:
        default_source_device: plunger
        tags: default

coils:
    trough_eject:
        number:
    plunger_eject:
        number:

switches:
    s_trough_1:
        number:
    s_trough_2:
        number:
    s_trough_3:
        number:
    s_trough_4:
        number:
    s_trough_jam:
        number:
    s_plunger:
        number:
    s_playfield:
        number:
        tags: playfield_active
    s_launch:
        number:
        tags: launch

ball_devices:
    trough:
        eject_coil: trough_eject
        ball_switches: s_trough_1, s_trough_2, s_trough_3, s_trough_4, s_trough_jam
        jam_switch: s_trough_jam
        debug: true
        tags: trough, drain, home
        eject_targets: plunger
        confirm_eject_type: target
        exit_count_delay: 3s
    plunger:
        eject_coil: plunger_eject
        ball_switches: s_plunger
        debug: true
#        mechanical_eject: true
        player_controlled_eject_event: sw_launch
        exit_count_delay: 300ms
#config_version=5

playfields:
    playfield:
        default_source_device: trough
        tags: default

coils:
    c_eject:
        number:

switches:
    s_trough:
        number:

virtual_platform_start_active_switches:
  s_trough

ball_devices:
    trough:
        eject_coil: c_eject
        ball_switches: s_trough
        tags: home, trough, drain
        debug: True
#config_version=5

coils:
    trough_eject:
        number:
    plunger_eject:
        number:

playfields:
    playfield:
        default_source_device: plunger
        tags: default

switches:
    s_trough_1:
        number:
    s_trough_2:
        number:
    s_trough_3:
        number:
    s_trough_4:
        number:
    s_trough_jam:
        number:
    s_plunger:
        number:
    s_playfield:
        number:
        tags: playfield_active
    s_launch:
        number:
        tags: launch

ball_devices:
    trough:
        eject_coil: trough_eject
        ball_switches: s_trough_1, s_trough_2, s_trough_3, s_trough_4, s_trough_jam
        jam_switch: s_trough_jam
        debug: true
        tags: trough, drain, home
        eject_targets: plunger
        confirm_eject_type: target
        eject_coil_jam_pulse: 5
        eject_coil_reorder_pulse: 2
        eject_coil_retry_pulse: 15
    plunger:
        eject_coil: plunger_eject
        ball_switches: s_plunger
        debug: true
        mechanical_eject: true
        player_controlled_eject_event: sw_launch
#config_version=5

playfields:
    playfield:
        default_source_device: test_launcher
        tags: default

coils:
    eject_coil1:
        number:
    eject_coil2:
        number:
    eject_coil3:
        number:
    eject_coil4:
        number:
    eject_coil5:
        number:
    c_diverter:
        number:

switches:
    s_ball_switch1:
        number:
    s_ball_switch2:
        number:
    s_ball_switch_launcher:
        number:
    s_ball_switch_target:
        number:
    s_playfield:
        number:
        tags: playfield_active
    s_launch:
        number:
        tags: launch


ball_devices:
    test_trough:
        eject_coil: eject_coil1
        ball_switches: s_ball_switch1, s_ball_switch2
        debug: true
        confirm_eject_type: target
        eject_targets: test_launcher
        eject_timeouts: 3s
        tags: trough, drain, home
    test_launcher:
        eject_coil: eject_coil2
        ball_switches: s_ball_switch_launcher
        debug: true
        eject_timeouts: 6s, 10s
        eject_targets: playfield, test_target
        confirm_eject_type: target
        player_controlled_eject_event: sw_launch
    test_target:
        eject_coil: eject_coil3
        ball_switches: s_ball_switch_target
        debug: true
        eject_timeouts: 6s
        confirm_eject_type: target