Hardware Control Systems
1 Introduction
Starting in the early 2000's, pinball control systems have been released. These systems enable users (and manufacturers) to modify existing games or create new machines. Custom machines based on these control systems are featured at most pinball shows and conventions, and new pinball companies are using them commercially to run their games.
Manufacturers of control systems include:
- Multimorphic, producing the P-ROC and P3-ROC systems
- FAST Pinball
- Ben Heck, who has developed the Pinheck board which is used by Spooky Pinball LLC in America's Most Haunted
- milliSoft, who offers an all-in-one board
2 P-ROC/P3-ROC
The P-ROC / P3-ROC (and their related driver boards) are a set of pinball machine controller boards that allow a computer running custom software to control a pinball machine. The P-ROC board is an intelligent interface board that controls the low level pinball machine circuitry according to instructions from the computer running the game code.
In most cases, a single-board computer works quite well as the computer. The P-ROC board can be used to either (1) replace the CPU board on existing machines (WPC-x, Stern Whitestar, or Stern S.A.M. systems) so they can run custom software, or (2) control a new pinball machine, whereas a P3-ROC can be used only to control new machines.
P-ROC / P3-ROC Feature Support | |||||||||
---|---|---|---|---|---|---|---|---|---|
WPC Driver Boards | Stern Driver Boards | PDB (P-ROC Driver Boards) | Switch Matrix | Serial Switch Boards | DMD Support | Aux Port | I2C | GPIOs | |
P-ROC | Y | Y | Y | Y | N | Y | Y (WPC compatible) | N | N |
P3-ROC | N | N | Y | N | Y | N | Y (Custom) | Y | Y |
2.1 Functionality
A P-ROC combined with a PC or embedded microcontroller provides functionality equivalent to a CPU board in a pinball machine. Software runs on the PC or microcontroller and communicates with the pinball machine's features through the P-ROC via USB.
The P-ROC is essentially an FPGA (Field Programmable Gate Array) surrounded by some support logic and a bunch of connectors. The FPGA contains custom logic enabling it to perform tasks including:
- Communicating with a PC over USB
- Scanning switches for switch events (Direct, Matrixed, and Burst)
- Driving coils, lamps, motors, etc (Direct and Multiplexed)
- Driving a Dot Matrix Display (DMD)
Note that the P-ROC does not handle audio. Instead audio is typically processed by the computer or microcontroller which is running the game software connected to the P-ROC.
The support logic and connectors enable the P-ROC to be used as a controller in custom homebrew pinball machines or as a CPU board replacement in the following generations of machines:
- WPC
- WPC-95
- Stern Whitestar
- Stern S.A.M.
2.1.1 USB Control
The power of a personal computer can be leveraged to create pinball machine software with simple or complex rulesets, video sequences, and audio effects. The PC's audio output can be connected directly to a pinball machine, but interfacing to the machine's switch and driver circuits and to display elements such as a dot matrix display requires an interface card such as a P-ROC.
2.1.1.1 Hardware Implementation
The P-ROC has a type B USB connector allowing it to connect directly to a PC using a standard USB cable. The USB signalling protocol is handled by an FTDI FT245RL chip on the P-ROC. This chip buffers incoming data destined for the FPGA and outgoing data being sent back to the PC. For more information about the FT245RL chip, refer to its datasheet.
2.1.1.2 USB Drivers
FTDI provides a free, closed-source driver for the FT245RL chip called D2XX. P-ROCs have been verified to work successfully with Windows based systems using D2XX. Attempts to communicate with a P-ROC in Mac OS using D2XX have been unsuccessful due to an apparent bug in the Mac OS D2XX implementation.
A free, open-source driver called libFTDI is also available. P-ROCs have been verified to work successfully in Linux and Mac based systems using libFTDi.
2.1.1.3 USB Bandwidth
The P-ROC can send/receive approximately 1 MB of data each second, which is more than enough to exchange any information needed to control a pinball machine, including DMD animation information at frame rates exceeding 60 fps.
2.1.2 Switch Control
The P-ROC can automatically scan direct, matrix, and burst switches and notify software and/or change the state of a driver when a switch changes states. This allows software to spend its cycles processing game rules rather than implementing very high speed switch scan loops.
2.1.2.1 Direct and Matrix Switches
The P-ROC has 32 direct switch inputs, and it has 10 switch column drivers and 16 switch row inputs creating a 160 switch switch matrix. The first 8 switch column drivers have dedicated outputs driven through a ULN2803 transistor array, and the other 2 are driven on an 8-bit multiplexed data bus (for WPC machines to use 8-driver boards). The 16 switch row inputs are dedicated inputs, each going through an LM339 comparator that compares the row's voltage against a 2.5V or 6V reference voltage.
Every x milliseconds, the P-ROC goes through a scanning loop during which it first checks all of the direct inputs. It then iterates through the matrix by driving a column and checking the row inputs, then driving the next column and checking the row inputs, etc. The number of milliseconds between each full scanning loop is programmable down to 1 millisecond.
2.1.2.2 Burst Switches
The P-ROC has 32 burst switch outputs (each with two outputs) and 64 burst switch inputs. These are provided for switches, such as long range infrared emitter/detector pairs, that require bursts of activity to function correctly. The timing parameters of the burst activity are fully programmable (globally) so that it can work with many types of switches. The programmable timing parameters determine how long it takes to cycle through all of the burst switches.
2.1.2.3 Switch Events
While scanning the switches, the P-ROC recognizes when the state of a switch changes. States include:
- Open, non-debounced
- Open, debounced
- Closed, non-debounced
- Closed, debounced
The P-ROC can be programmed to perform specific actions for each state change for each of the 256 switches. Actions include:
- Notify software
- Change a driver's configuration
For increased flexibility, the P-ROC can chain multiple actions together so that more than one action can occur as a result of a switch's state changing. For instance, switch 3 can cause drivers 5, 10, and 20 to turn on, drivers 30-35 to be turned off, and software to be notified when its state becomes closed, debounced. (Crazy example, but possible). It can also have a different set of actions occur when its state becomes one of the other 3 states, such as open, debounced.
In typical applications, users will likely want to simply notify the host of all debounced switch events (for scoring and rule processing). For situations requiring immediate driver reactions, such as pop bumpers popping in response to a pop bumper switch closing, a driver rule might also be used.
2.1.3 Driver Control
The P-ROC can individually control 216 driver outputs. Driver outputs are typically used to control coils, lamps/leds, motors, etc. There are dedicated output pins for 32 of the 216, and the other 184 are driven through a multiplexed bus that is compatible with WPC, WPC95, Stern Whitestar, and Stern S.A.M. power driver boards.
2.1.3.1 Multiplexed Bus
The Multiplexed Bus contains:
- 8 data bits
- 9 enable bits
The functionality of the data and enable bits is controlled by a large set of configuration registers. For detailed information about the registers, refer to the P-ROC FPGA Specifications on the P-ROC Documentation Page.
2.1.3.2 Timing
Every millisecond, the P-ROC checks to see if the internally programmed state of a driver has changed (either by a software write or by a switch event action). When the internally programmed state of a driver with a dedicated output pin changes, the new state is reflected immediately on the pin. Circuits connected to the multiplexed bus won't see driver changes immediately. Rather, they will see the change whenever the bus logic services the changed driver. How long that can take is determined by the configuration registers.
2.1.3.3 Driver Modes
The P-ROC can automatically control drivers in certain modes so that software doesn't need to programmatically turn on/off things like blinking lights or repeatedly pulsing coils. The following modes can be used:
2.1.3.3.1 Solid
This is the simplest mode. Drivers in this mode are either on or off, and they remain in that state until reconfigured.
Note - Drivers connected to high current coil circuits should NEVER be turned on solidly. They should be driven with a timer (see the timed mode below).
2.1.3.3.2 Timed
A timed driver is turned on for a specified number of milliseconds, up to 255. When the millisecond timer expires, the driver is turned off.
This mode is recommended for high current coil circuits that need to be pulsed for short periods of time.
2.1.3.3.3 Schedule
A scheduled driver turns on or off automatically according to a 1 second schedule. The schedule contains 32 timeslots, each lasting for 31 microseconds. When the timer enters an active timeslot, the driver turns on. When the timer enters an inactive timeslot, the driver turns off.
Note - The timed mode can also be used for scheduled drivers. When a schedule driver is configured with a timer, the timer determines how many seconds the schedule is repeated.
Scheduled drivers are recommended for blinking lamps/flashers. Various light effects can be created by assigning different schedules to a set of lamp drivers.
2.1.3.3.4 Patter
Patter (named after the phrase pitter-patter) drivers repeatedly turn on for a certain number of milliseconds and then off for a certain number of milliseconds.
Note - The timed mode can also be used for patter drivers. When a patter driver is configured with a timer, the driver turns on for the number of milliseconds specified by the timer. When the timer expires, the patter begins and repeats indefinitely.
This mode is provided for fine-grained control of pulsed coils, such as Stern flipper coils that don't have hold circuits. An example configuration would be to combine the Timed and Patter modes to pulse the coil and then patter it when the flipper button is pressed. The driver could then be turned off when the flipper button is released.
2.1.4 DMD Control
The P-ROC is capable of directly driving a Dot Matrix Display (DMD) through a 14-bit ribbon cable. Supported DMD features include:
- Programmable resolution, including 128x32.
- Up to 16 brightness levels (colors)
- 48 kb frame buffer storage (3 full frames @ 128x32)
- Frame events (for software synchronization)
Note: The P-ROC does not supply the electrical power for the DMD. The DMD must be powered by other circuits/supplies. If you're using the P-ROC to replace the CPU board in an existing machine, then all you need to do is hook up the 14-pin ribbon cable since the existing DMD gets its power from the existing machine's power supply. If you're building a new machine, you'll need to power the DMD from your power supply in addition to making the 14-pin ribbon connection to your P-ROC.
2.2 Getting Started
2.2.1 Hardware Installation
2.2.1.1 Hardware Mounting
The P-ROC should be mounted into a pinball machine so that the board doesn't flex much when cables are attached or removed. P-ROC mounting plates are available for existing machines including: WPC, WPC-95, Stern Whitestar, and Stern SAM. Generally, each P-ROC is sold with the customer's choice of a mounting plate. Additional plates can be purchased from pinballcontrollers.com. The mounting plates were designed to mount in the same position as each machine's existing CPU board, which needs to be removed when using a P-ROC.
When mounting a P-ROC into a custom cabinet, either make use of one of the pre-designed mounting plates, or secure the P-ROC board using all 6 mounting holes on the circuit board. Not properly mounting the board increases the chances of damaging the board when attaching or removing cables. Such damage is not covered by any warranty.
2.2.1.2 Cabling
When using a P-ROC in a custom machine, any or all of the connectors can be used. Refer to the Board Specifications on the P-ROC Documentation Page for a description of the available connectors and their functionality.
When using the P-ROC in an existing machine, only some of the connectors should be used. The P-ROC Connector Mappings document on the P-ROC Documentation Page identifies which connectors should be used in each of the 4 supported existing pinball machine platforms.
2.2.1.3 Hardware Switches
The P-ROC has 4 DIP switches of which only 3 are currently used:
- DIP switch 1 sets the polarity of the 'clear' signal used to disable driver circuits on connected power/driver boards.
OFF : 'clear' goes high (logic 1) to disable drivers. Used with WPC and WPC-95 machines. Typically also used with PDB driver boards, even though the switch position should not matter.
ON : 'clear' goes low (logic 0) to disable drivers. Used with Stern Whitestar/SAM machines.
Important: Before applying power to a machine with an installed P-ROC, ensure DIP switch 1 is set as desired:
- DIP switch 2 is used to enable USB control or embedded control.
OFF : USB control
ON : Embedded control
- DIP switch 3 determines the default operation of the DMD pins.
OFF : DMD pins carry the DMD signals.
ON : DMD pins carry output driver enables 9 through 12, as follows:
P-ROC DMD Pin mapping | |
---|---|
DMD Signal | Output Driver Enable |
rdata | 9 |
rclk | 10 |
latch | 11 |
sdata | 12 |
2.2.2 Connecting Switches
The P-ROC has a bunch of comparator circuits, similar to WPC and Stern CPU boards, to detect when your machine's switches change state. To make it easy on people who want to use their P-ROC in an existing WPC or Stern machine, the P-ROC has practically the same set of switch connectors that WPC and Stern CPU boards have. When replacing one of those boards, it's therefore a simple matter to plug all of the existing cables directly onto the P-ROC. Refer to the P-ROC Connector Mappings document for a mapping of WPC and Stern switch connectors to P-ROC switch connectors.
2.2.2.1 Dedicated and Matrixed Switches
The P-ROC has support for the following dedicated and matrixed switch configurations:
- 32 dedicated switch inputs and an 8x8 switch matrix (96 switches total)
- 24 dedicated switch inputs and an 8x16 switch matrix (152 switches total)
If you're using the P-ROC in a machine with custom wiring, you're free to connect your switch wires to any of the available switch connectors on the P-ROC. Some of the connectors are 0.100" pitch (WPC-style), and others are 0.156" (Stern-style). Refer to the P-ROC Board Specifications for a detailed list of all of the switch connectors on the board.
The dedicated and matrixed switch inputs on the P-ROC use a voltage reference that comes from the power cable you use to power the P-ROC. In a WPC machine, the power cable provides 12V to the switch logic, and the comparator reference is 6V. In a Stern machine, the power cable provides 5V to the switch logic, and the comparator reference is 2.5V. When using the 4-pin ATX power supply style power connector, it works like a WPC machine with 12V on the switch logic and a comparator reference of 6V.
2.2.2.1.1 Connecting Dedicated Switches
All of the dedicated switch inputs on the P-ROC have pull-up resistors to the switch power rail (12V or 5V as mentioned above). Therefore, when a switch input is unused, the P-ROC will pull the line up to the switch power rail.
2.2.2.1.2 = Mechanical Switches =
When wiring dedicated mechanical switches on your machine, make sure to wire them between the desired switch input and ground. When the switch is open, the corresponding pull-up resistor on the P-ROC will pull the line high. When the switch is closed, a connection to ground is made, and the P-ROC will see the line go low and detect the closing switch event. When the switch is opened again, the P-ROC will see the line go high and detect the opening switch event.
2.2.2.1.3 = Opto Switches =
Dedicated opto switches consist of an IR transmitter and a IR phototransistor (receiver). The transmitter gets connected directly to power through a current limiting resistor (resistor value depends on the power level and the specific type of IR transmitter you use) so that it always transmits. The phototransistor works similarly to a mechanical switch except reversed. The circuit is pulled high on the P-ROC when not enough light is detected by the phototransistor (ie. when a ball is blocking the light) and driven low when the light is not blocked.
2.2.2.1.4 Connecting Matrixed Switches
The P-ROC supports switch matrixes up to 8x16. When in use, the matrix functionality automatically scans the matrix, capturing switch events on each switch in the matrix as they occur.
The topology of the matrix is 8 outputs (columns) and 16 inputs (rows). Refer to the P-ROC Board Specifications for a detailed listing of the connectors to use when wiring up your matrix. To use the full 8x16 matrix, you'll need to use the 0.156" pitch connectors. If you only need an 8x8 matrix, you can use either the 0.100" or 0.156" pitch connectors.
When the P-ROC is scanning the matrix, it will drive each matrix output low, one at a time, while capturing the states on each of the inputs. By iterating through each output, it can capture the states of each and every switch on the matrix in a very short amount of time, configurable down to 1 millisecond.
All switches on your matrix need to have a 1N4004 or equivalent diode in series with the switch. It doesn't matter which side of the switch the diode is on. Just make sure to orient the diode so the bar end points towards the P-ROC matrix output.
2.2.2.1.5 = Mechanical Switches =
2.2.2.1.6 = Opto Switches =
Unlike mechanical switches, which can be used on a matrix input in the same fashion as a dedicated input (with the addition of a diode), opto switches require some more circuitry. There are a few reasons for this, but the primary reason is that opto circuits are constantly active. In other words, the IR transmitter is constantly sending light, and the phototransistor is constantly trying to detect light. This means the output of the phototransistor is always active. Therefore, if it shares a P-ROC matrix input with other switches, it will corrupt the detected states of the other switches.
This issue is resolved, as shown in the diagram below, by adding a comparator circuit that compares the output of a phototransistor to a P-ROC matrix output reference. The P-ROC matrix output reference needs to be generated by even more circuitry (not shown) so that the phototransistors output is only relevant when the P-ROC matrix output is active. In other words, when the P-ROC matrix output is active (driven low), the phototransistor's output determines whether the P-ROC matrix input is driven low or pulled high. When the P-ROC matrix output is inactive, the phototransistor's output will result in the P-ROC matrix input being pulled high, regardless of the amount of light detected.
The P-ROC matrix output reference is commonly created with another comparator circuit that compares the P-ROC matrix output to a fixed voltage that's typically some percentage of the switch power.
Instead of wiring all of these comparator circuits for each and every opto you want to use on the switch matrix, it would be much simpler to use an existing opto board. A common opto board used in many existing pinball machines for the exact same purpose is:
A-15576 : 7-Opto Switch Board
This board is available from many pinball component suppliers and contains everything you should need except the IR transmitters and phototransistors, which incidentally are also available from most suppliers on PCBs and as standalone components (transmitters, receivers).
2.2.3 Software Development
2.2.3.1 Installation/Build Instructions
Build instructions are available for:
2.2.3.2 Sample Game Files
2.2.3.2.1 Custom (PDB)
- Example Machine Config File (YAML) for P-ROC (sample_pdb.yaml)
- Example Machine Config File (YAML) for P3-ROC (simple.yaml)
- P-ROC Game Description file a sample machine using PDBs (PinballControllers.com Driver Boards) and Serial Switch Boards
PRGame: machineType: pdb numBalls: 4 PRFlippers: - flipperLwR - flipperLwL PRBumpers: - slingl - slingr PRSwitches: # **** Format **** # name: # number: <number> # type: <type> # # <number> can be: x (x = 16 * Switch board addr + output number) # <type> can be: 'NO' (normally open. This is the default; so no need to use this) # 'NC' (normally closed. Common for optos) # flippers shown below are examples of dedicated switches flipperLwR: number: 0 flipperLwL: number: 1 # slings shown below are examples of matrix switches slingl: number: 2 slingr: number: 3 # Coil numbering format: Ax-By-z: # Capital letters are required, lower case letters represent the numbers: # x : Board address (0-7) # y : Bank address (0 for A, 1 for B) # z : Output number (0-7) PRCoils: flipperLwLMain: number: A0-B1-0 flipperLwLHold: number: A0-B1-1 flipperLwRMain: number: A0-B1-2 flipperLwRHold: number: A0-B1-3 slingl: number: A0-B1-4 slingr: number: A0-B1-5
# Lamp numbering format: C-Ax-By-z:R-Am-Bn-p:
# Capital letters are required, lower case letters represent the numbers: # For Columns (Source circuits - represented by the 'C') # x : Column board address (0-7) # y : Column bank address (0 for A, 1 for B) # z : Output number (0-7) # For Rows (Sink circuits - represented by the 'R') # m : Row board address (0-7) # n : Row bank address (0 for A, 1 for B) # p : Output number (0-7) PRLamps: testLamp: number: C-A1-B0-0:R-A1-B1-0 VUK_right_b: number: C-A1-B0-0:R-A1-B1-1 VUK_right_g: number: C-A1-B0-0:R-A1-B1-2 VUK_left_g: number: C-A1-B0-0:R-A1-B1-3 VUK_left_b: number: C-A1-B0-0:R-A1-B1-4 VUK_left_r: number: C-A1-B0-0:R-A1-B1-5
PRDriverGlobals: lamp_matrix_strobe_time: 200 use_watchdog: True watchdog_time: 1000
- Simple Game Script (PDB)
import procgame.game import pinproc game = procgame.game.GameController(machine_type=pinproc.MachineTypePDB) game.load_config('simple.yaml') game.enable_flippers(enable=True) game.lamps.testLamp.schedule(schedule=0x00ff00ff, cycle_seconds=0, now=False) game.run_loop()
2.2.3.2.2 WPC
- Example Machine Config File (YAML) for WPC (JD.yaml)
- Simple Game Script (WPC)
import procgame.game import pinproc game = procgame.game.GameController(machine_type=pinproc.MachineTypeWPC) game.load_config('simple.yaml') game.enable_flippers(enable=True) game.lamps.testLamp.schedule(schedule=0x00ff00ff, cycle_seconds=0, now=False) game.run_loop()
- Simple Game Script (WPC95)
import procgame.game import pinproc game = procgame.game.GameController(machine_type=pinproc.MachineTypeWPC95) game.load_config('simple.yaml') game.enable_flippers(enable=True) game.lamps.testLamp.schedule(schedule=0x00ff00ff, cycle_seconds=0, now=False) game.run_loop()
- Simple Game Script (WPCAlphanumeric)
import procgame.game import pinproc game = procgame.game.GameController(machine_type=pinproc.MachineTypeWPCAlphanumeric) game.load_config('simple.yaml') game.enable_flippers(enable=True) game.lamps.testLamp.schedule(schedule=0x00ff00ff, cycle_seconds=0, now=False) game.run_loop()
2.2.3.2.3 =Stern=
- Example Machine Config File (YAML) for Stern Whitestar (LOTR.yaml)
- Example Machine Config File (YAML) for Stern SAM (POTC.yaml)
- Simple Game Script (Stern Whitestar)
import procgame.game import pinproc game = procgame.game.GameController(machine_type=pinproc.MachineTypeSternWhitestar) game.load_config('simple.yaml') game.enable_flippers(enable=True) game.lamps.testLamp.schedule(schedule=0x00ff00ff, cycle_seconds=0, now=False) game.run_loop()
- Simple Game Script (Stern SAM)
import procgame.game import pinproc game = procgame.game.GameController(machine_type=pinproc.MachineTypeSternSAM) game.load_config('simple.yaml') game.enable_flippers(enable=True) game.lamps.testLamp.schedule(schedule=0x00ff00ff, cycle_seconds=0, now=False) game.run_loop()
2.2.3.3 Game Development Resources
- Fonts (.dmd format)
2.3 Driver Boards
2.3.1 Functionality
2.3.2 Hardware installation
2.3.3 Controlling Devices
2.3.3.1 Controlling Flippers
2.3.3.2 Controlling Lamp Matrixes
2.4 Projects
- JD_rules - Custom JD Software
- Single Board Computers
- Pyprocgame_vp, pyprocgame, Visual Pinball
2.5 Additional resources
- Modifying a WPC-95 board for Audio Input
- PinballControllers.com website
- PinballControllers.com discussion forums
3 FAST
4 Single Board Computers
A single board computer is a complete computer built on a single circuit board[1].
Some people in the P-ROC community are investigating various single board computers for use as an alternative to a full PC or laptop (as the host from which to control the P-ROC hardware).
4.1 Overview
Solution | Cost | CPU | RAM | Storage | AV | Other |
---|---|---|---|---|---|---|
Beagleboard | 150 USD | 600MHz | 128MB | 256MB Flash, SD/MMC | Audio I/O, DVI-D + S-video out | USB OTG |
Chumby Hacker Baord | 90 USD | 454MHz | 64MB | 512MB uSD | Composite video out, audio I/O | 3 USB |
ODROID U3 | 75 USD | 1.7GHz quad core | 2GB | 128MB Flash | HDMI, Audio I/O | USB host, USB OTG, Ethernet, GPIO, I2C |
Raspberry Pi | 40 USD | 700MHz | 512MB | SD Card Slot | HDMI out, Audio I/O | USB host, USB OTG, Ethernet |
4.2 Beagleboard
4.2.1 Links
4.3 Chumby
4.3.1 Links
4.4 ODROID
4.4.1 Links
4.5 Raspberry Pi
4.5.1 Links
4.5.2 Setup Guide
Using a Raspberry Pi with P-ROC is not much different than using any other Linux OS. Using the directions on the Linux Build Instructions page should result in a fully-functional environment (keeping in mind that the Raspberry Pi is a pretty under-powered device in general).
You can also download and use the debian toolkit to automatically install everything from the dependencies through libpinproc, pypinproc, and pyprocgame.
The model of Raspberry pi tested was a Model B, Rev 2. The OS used is Raspbian, which is available from http://downloads.raspberrypi.org/raspbian_latest. The specific version of Raspbian used for this test is based on Debian Wheezy. Any other versions (updates or old versions) might change things.
Copying the image to your Raspberry Pi can be accomplished by following the instructions provided on the same download page, or just follow these links:
Once this process is complete, run through initial setup process. Then start building the pinproc components!