This post is a narrative overview of the build process for our Fireball HD Pinball – it is a good story of what I’d call an “accidental project” that has led to lots of learning, many nights of puzzlement as we moved from one problem to the next, lots of fun as we’ve shown it to others, and occasionally a game of pinball. This story will make it all sound so simple, but the reality was much, much more difficult. Huge thanks to those who helped along the way, especially my friends at FamiLAB – if you are interested in making things, and live in Florida (or visit!), please stop by to say hi and make things with us!
Enjoy, and please – ask questions!
It all started when… I saw a Fireball Home edition playfield on eBay locally – I purchased it ($135!) with the intent of lighting the lamps with an Arduino, framing it, and hanging it on the wall of my office. My boys saw it and asked “can you make it play?” – Now this was either an innocent question – or a challenge by my sons. Not one to let a challenge go unanswered, I started thinking about the problem – how hard could it be?
We’d need to:
- Read switches
- Turn on & off Lamps (LEDs)
- Activate solenoids
- Keep score
I’d built complex projects with Arduino before, and I’d been looking for a Raspberry Pi GPIO project. I’d purchased some when they first launched, but STILL hadn’t done GPIO work. We’d just finished teaching our first Intro to Raspberry Pi classes at FamiLAB, so I was really excited to try it.
My first plan was to find schematics – and they were available online (love this about pinball machines!). Once I’d studied the schematics, I realized that lighting the lamps and reading the switches would be a challenge – as they were in the same matrix – and running at high voltages! This means that I need a microcontroller that constantly is cycling through the lamps and switches >30fps so that the eye doesn’t detect flicker, but that leaves the lamps on enough that they are bright, and I needed to protect the microcontroller from the high voltages coming back from the switches. I decided that I didn’t want to dedicate my Pi CPU to cycling through lamps, so I prototyped it using an Arduino and this mess…
Here, I’m using an npn transistor array (ULN2803A) to source 6 “rows” of the matrix using PNP transistors (TIP42) with 24v. There is a corresponding npn transistor array which sinks 4 “columns” of the matrix.
This worked, and led to some fun lighting tests
Next we focused on the solenoid activation. We prototyped a small circuit, then replicated it. The “final” board…
This board takes a +5v signal and actuates the solenoid using an PNP transistor (PN2222 – I hadn’t thought about using the arrays at this point…) and a P-channel mosfet (more of the FQP27P06). The 24v for the solenoids (and the Lamp / Switch matrix) comes from an unbranded Chinese 24v 15A power supply ordered from Amazon.
Originally I was controlling these using the Pi and some MCP23017 i2c I/O expanders, but after realizing I needed good timing control, I once again decided to connect these to an Arduino, have it do the precise timing (and safeguard that a solenoid is not left on!) and then leave the Raspberry Pi for higher level duties.
Here’s our big test of the solenoid driver…(while I was still using the Pi to actuate them…)
Unfortunately, I hadn’t yet had the realization that with a Pi, you can stop your code, but leave a pin high (on Arduino, you stop it by unplugging it!) – and I overheated a Mosfet and melted a solenoid.
With lights lit, switches read, and solenoids actuating, it was time to integrate all this and create something playable.
With some guidance (and a long FamiLAB forum thread), I decided to use Python and Pygame. I’ve never written a line of Python, but it was a good time to learn. I learned using the Adafruit WebIDE (LOVE IT!), and started with basic GPIO examples, then moved to i2c, building as I went.
The basic system design has the Pi as an i2c master with the following functions:
- reading switches from the lamp / switch Arduino when that slave pulls an interrupt pin hi (read by Pi GPIO after a level shifter)
- sending commands to the lamp / switch Arduino to turn on / off specific lights
- sending commands to the solenoid driver to fire specific solenoids
- Gameplay tracking – players, balls, scores, bonus
- Background music
- Game event sounds
- HD GRAPHICS!
You can see that integrating it all made quite the wiring mess – this is a good shot of my project space – it stayed like this for months…
Along the way we purchased another machine with a cabinet ($200!), built a new head, and installed a 24″ 1080p LCD. Here it is in an early playable state – it was an exciting moment!
At that point, we loved playing it – but we couldn’t move it due to the breadboard mess (and a cat that likes to occasionally steal breadboard jumper wires!), so we started moving the electronics into a less fragile state.
Doesn’t she LOOK guilty?!
I’d been wanting to learn CadSoft Eagle and create real PCBs, but I hadn’t made the time, so for now, we made a protoboard version of the lamp & switch driver.
Here’s a good pic of the back of that board so you can see the construction. I’m sure there are better ways, but this I started doing these at some point, I can get the boards at Radio Shack locally and it works for me…
This board is connected to an Arduino Uno via a custom shield built with the seeedstudio arduino protoshield (from Radio Shack) – which btw, can be a great source for emergency project parts needs given that it contains a protoboard, lots of header, some small buttons, a potentiometer, etc.
This is a work-in-progress shot while I was building it – all my planning, I still reversed the wiring and rebuilt that shield a few times (doh!)
With the breadboard gone, we moved all the electronics into the cabinet and took it to a “Maker Saturday” event at Orlando Science Center (we do this each month in advance of Orlando Mini Maker Faire, which I help produce…)
It was a mess…
…but it worked! These Chinese students are enjoying their FIRST game of pinball!
I was amazed – the pin worked far better than I expected, we had fun and the boys & I were energized for the next round of improvements – getting those electronics safely mounted!
Since my goal for the machine is to get others interested in learning Raspberry Pi, Arduino, and electronics, I wanted everything to be visible at an event. I had lots of complex ideas, but after talking to the boys, we decided to keep it simple for now – we just mounted everything right on the back of the head!
We knew this wasn’t permanent, so lots of zip ties and adhesive pads. I later built custom cables to get right of the jumper wires…and there is still more cleanup coming.
This video shows all the electronics and explains the function of each item…
The white board to the left of the Raspberry Pi is an Adafruit PermaProto board which has the level shifter, the GPIO breakout, and two (currently unused) MCP23017.
After getting everything mounted, we went back to improve the game graphics – I’m using omxplayer and the pyomxplayer wrapper to call the videos from python. The videos play into a specific rect on the screen, and we have the capability of running multiple videos simultaneously which lets us still write text to the screen with pygame, but also have fancy video effects.
Currently we are reworking the in-game graphics – we’ve animated the player and ball numbers, and are working on some larger animations for the game “modes”.
We had debug info on the screen for a long time, and recently we added a web4robots i2c LCD to the game (it is mounted on the apron right by the player) – I’ll likely switch this out later for a VFD to have a more classic pinball look…but I had this one, it fit and was easy to work with.
We went from this:
Feeling good about the project, we took it to a Raspberry Pi event at FamiLAB – Gordon Hollingworth, Director of Engineering for Raspberry Pi visited, and in this video, you can hear his thoughts on Fireball HD….[iframe src=”http://embed.newsinc.com/Single/iframe.html?WID=2&VID=25028064&freewheel=90022&sitesection=orlandosentinel&height=320&width=425″]
Between Gordon’s comments and the reactions from others (especially kids!), we left feeling that our hard work was worthwhile!
As much as we’ve completed our original goal of “make it playable” – we still aren’t finished.
I’m battling electrical noise – big projects with multiple voltages are tricky, and I’m learning a LOT about grounding…
And coming soon:
- Event tournaments with play tracking and prizes
- NFC login by phone, card, or hand implant (yes, we know people with them!) for regular players using the Adafruit NFC shield
- Website with player profiles, high scores, tournament rankings, etc.
- Adafruit Thermal receipt printer with QR codes so a new player can scan to register and claim their score
- Adafruit Accelerometer (i2c device) to act as a very fancy tilt sensor
- Adafruit Current sensor (i2c device) to ensure solenoids are not overheating
- Fuses – I need lots of fuses
- Lots of cosmetic work – painting the head, mounting the speakers, creating a custom bezel for the monitor
- Custom Artwork by Punkin Studios – a local artist that I met last year at Orlando Mini Maker Faire. I’ve asked him to start by recreating original Fireball backglass art without the scoring boxes. Here’s the preliminary inked version…
A HUGE thank you to everyone that has helped along the way, especially to my wife, Candy, for letting this big messy project live in the house for all these months and for listening to it make loud noises at all hours of the night as I’ve been troubleshooting.
If you live in Florida, please visit Orlando Mini Maker Faire on October 5th, 2013 to see Fireball HD!
Thanks for reading all this, please ask questions or leave a comment!