Hardware Control Systems

From PinWiki
Revision as of 22:02, 4 February 2016 by ForceFlow (talk | contribs) (Page clean-up - content first posted by user claires-dad)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

1 Introduction

2 P-ROC/P3-ROC

Official Website

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:

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 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 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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.


3 FAST

Official Website