This is the second post in a series on building our own pinball machine. This post is more or less an addition to the first one, as it describes all the different things we experimented with before we were able to assemble the first prototype "machine".
Inspired by the The Book of Kells project, we started out with the idea of using a parallel port to control our machine. The creators of The Book of Kells pinball machine used a parallel port to control all the LEDs, high voltage drivers and switches.
After some time of fiddling around with code examples we found online, we were able to control the parallel port. At the time it didn't do much more than turning a LED on and off. The makers of the Book of Kells project had written their own Linux kernel module to get the performance they needed from the parallel port. We didn't want to do that because of the complexity it introduces. On top of that, a parallel port is not as commonly found on consumer motherboards nowadays. All these things together made us abandon this idea and look for other solutions.
After abandoning the idea of using a parallel port, we went looking for another solution. We then found out about the Velleman K8055N kit. This board provides five digital inputs, two analog inputs, eight digital outputs, and two analog outputs. All these inputs and outputs can be controlled via USB, which seemed more future-proof than the parallel port.
We bought this kit, assembled it and got it working. The first test also didn't do much more than turning a LED on and off. We soon noticed that updating the state of a pin was too slow to run a pinball machine. It also had too few I/O pins which meant that we needed more than one of these boards. The number of boards per computer was also limited at four.
Another downside of the board was its software support. To use it in any project you'd have to include a precompiled DLL into your project. This meant its usage was bound to the Windows operating system. With all these downsides in mind we soon abandoned this option as well.
High power drivers
At the same time as we were experimenting with the Velleman kit, we were looking for a way to drive the high power solenoids. The Freedom Pinball machine ran its solenoids at 50V DC for pop-bumpers and slingshots. The rest of the solenoids ran at 50V AC. We chose to run all solenoids at 50V DC. This didn't noticeably affect the performance of the solenoids.
For driving the solenoids we used some MOSFETs we had laying around. We earlier desoldered these from old PC power supplies. To protect the logic part of the pinball controller we used opto-coupler chips. These chips create a separation (also called Galvanic Isolation) between the high-voltage and the low-voltage part of the controller. We also implemented a totem pole driver for driving the MOSFETs. The opto-couplers and totem pole driver can be seen on the image below. Note that the MOSFETs are not present on these boards.
Driving the MOSFETs was not as straight forward as we thought it would be. Apparently, MOSFETs have a saturation voltage which should be applied to the gate for them to fully open. We were driving the MOSFETs with 5 volts, while their saturation voltage was about 12 to 14 volts. This causes the MOSFET to not fully open and thefore behave like a resistor. After a lot of MOSFETs had lost their magic smoke before we took another look at the datasheet only to discover this beginners mistake we made.
Not so long after experimenting with the Velleman kit I found Arduino being another option for controlling our pinball machine. We then did some research on what Arduino is and what it is capable of. Its specs looked promising, so we ordered our first Arduino board: The Arduino Mega. We started experimenting with the board and managed to get some promising results very quickly.
Compared to the Vellman kit, an Arduino is fully programmable. It also uses a standard serial connection to communicate to the host computer. This meant we weren't bound to any programming language or operating system.
With the high voltage drivers and controller somewhat worked out, we had to find a way to read the status of the switches scattered all over the playfield. The most simple option is to connect each switch to one of the pins of the Arduino Mega. Unfortunately, microcontrollers generally do not offer this many GPIO ports. Therefore we had to find another way of reading the status of this many switches.
Almost all solid state pinball machines use something called a switch matrix. A switch matrix allows you to connect more switches to a microcontroller than it has pins. The switch matrix was also the first thing we prototyped with the Arduino.