Oh ... and I wanted it to be cheap.
So how do you get all of the switches that you need for a pinball machine to communicate with the computer? The first idea was through the Arduino but really didn't seem practical and it certainly was not the cheapest and easiest solution.
I started researching and found an interesting product in the I-PAC. The price was reasonable and the product looked solid but at about $45, I thought I could do better. After some research on building a custom keyboard encoder, I had my "light bulb" moment: every USB keyboard has a built-in keyboard encoder that can be cannibalized. If I didn't have a spare USB keyboard, I could buy one at the dollar store for $3.
I bought the dollar store keyboard and disassembled it.
This is the underside with the switch membrane removed.
The keyboard encoder is simple enough. The connections are arranged into Rows and Columns to form a matrix. Pushing a key closes the connection between a row and column. It is the job of the keyboard encoder to check the rows and columns and send a signal to the computer with the code for key pressed.
Here is the circuitry from the keyboard. They leads on the printed circuit board were coated in a black substance which I scraped off to test the unit.
After plugging in the USB connection to the computer, I used a small jumper wire to connect random rows and columns to see what would happen. Using the program Notepad in Windows, here are the results:
This system works for mechanical SPST (single pole single throw) switches but I also need to include some sensor switches and I haven't figured out how I am going to do that yet. If you have ideas, I would like to hear them in the comments section.