The usual way to control coils is to connect power to one side of the coil and to connect the other side to a low-side transistor circuit, such as an n-channel MOSFET. When the transistor is activated, the source voltage has a path to ground through the coil and through the transistor, thereby activating the coil.
Coils are typically controlled with a PD-16 board. It's best to connect the power side of the coil to the fused power output connector on the PD-16. This will cause only the PD-16's fuse to blow if there's ever a serious problem with the coil circuit, rather than taking out various other things on the machine. The other side of the coil is then connected to one of the eight transistor circuits the PD-16 provides in each bank.
As shown in the diagram below, banks A and B of the PD-16 are completely independent. The voltages used to feed each bank can be the same, but they don't have to be. This diagram is showing how to use bank A to control high power coils and bank B to control low power coils or flashlamps.
Coils are used for a variety of features in most pinball machines. Common features with coils are flippers, slingshots, pop bumpers, drop targets, diverters, etc. Most coils are simply a long wire wrapped around a hollow core. When current flows through through the wire, a magnetic field is created in the core. This magnetic field pulls in metal objects. Typically, a steel rod (plunger) is connected to the playfield feature. When the coil is activated (current applied), the steel rod is pulled into the core due to the magnet field. The movement of the rod translates to movement of the feature. For instance, a pop bumper typically has a metal ring attached to the plunger that gets pulled down toward the playfield when the coil activates. This downwards motion pushes the ball away from the pop bumper.
As shown in the picture below, a coil generally has two lugs, sometimes with a diode wired between them.
To connect a coil to a PD-16 board, simply wire power out from the desired bank (J3 or J4) to one lug, and one of the bank's 8 transistor circuits (J7 or J11) to the other lug.
Important: If the coil has diode, you MUST wire power out to the bar end of the diode and the transistor circuit to the non-bar end of the diode. Otherwise, bad things ensue (blown diodes, blown transistors, blown fuses, etc). The PD-16 boards have their own diodes on each circuit; so diodes on the coils are unnecessary.
The P-ROC can be configured to automatically control your chain of driver boards, allowing you to issue higher level commands (pulse, schedule, patter, etc). If you're using libpinproc (C) or pyprocgame (Python), you'll first need to configure the P-ROC to work with your chain of driver boards. Instructions for doing this are found here.
To activate the coils in a C program using libpinproc, you simply need to call the desired PRDriver... libpinproc function, passing in the handle to your P-ROC, the coil number, and the desired activation params. For instance, to pulse coil 32 for 40 milliseconds:
PRDriverPulse(PRHandle, 32, 40)
Other available driver commands include:
PRDriverSchedule() - Issue a defined pattern that repeats every second PRDriverPatter() - Issue a repeating pitter-patter style pattern where the coil repeatedly turns on for X ms and off for Y ms. PRDriverPulsedPatter() - Same as above except the pattern ends after Z ms. PRDriverDisable() - Turn off the coil
Refer to the libpinproc code for implementation details.
Warning - It's best to use only PRDriverPulse() and PRDriverDisable() commands for high power coils. This will help to eliminate errors that could result in coils staying on too long and burning up or blowing fuses.
Your machine's YAML file will need to contain coil definitions so that pyprocgame will know know which coils exist on your machine. Here's an example YAML with only the relevant coil items:
PRGame: machineType: custom
PRCoils: coil0: number: PD-16 circuit number for coil0 (0 for board 0, bank A, output 0) coil1: number: PD-16 circuit number for coil1 (1 for board 0, bank A, output 1) coil2: number: PD-16 circuit number for coil2 (8 for board 0, bank B, output 0) coil3: number: PD-16 circuit number for coil3 (16 for board 1, bank A, output 0)
Once your YAML file is loaded into pyprocgame, you can activate your coils by calling:
game.coils.coil0.pulse(40) - Drives coil0 for 40ms
Other available driver methods include:
schedule() patter() pulsedpatter() disable() enable()
Refer to the pyprocgame docs more detailed information.
Warning - It's best to use only pulse() and disable() commands for high power coils. This will help to eliminate errors that could result in coils staying on too long and burning up or blowing fuses.
Mission Pinball Framework (MPF)
See the MPF Documentation about P-Roc Coils for details.
If you'd rather use software to write to the driver board directly, which is possible though eliminates the possibility of using the pulse, schedule, patter, etc functions the P-ROC provides, you can issue direct register writes to the P-ROC that, in turn, get sent to the appropriate driver board. Refer to the P-ROC FPGA documentation for more details (register addresses and data format)
Other controller (non - P-ROC)
If you are using a microcontroller such as an Arduino or Parallax Propeller to control your flippers through a PD-16, you'll need to do everything in software. Refer to the PD-16 documentation for a description of the PDB Protocol used for sending commands to the driver board.