Introduction: Turn a 1970's Pinball Machine Into an Atomic Synced Alarm Clock Using a Gps and an Arduino
One of the more common problems faced by pinball collectors is where to put the next one. The thought came to me one day - what if I could re-purpose the pinball machine? I could then replace an existing appliance with the pin and my problem would be solved. With that in mind I converted my 1975 Bally Wizard into the most accurate clock in the house. And all I needed was an Arduino, A GPS receiver, an 8 relay board and some assorted odd bits.
Features:
Pinball machine will automatically power up at the preset time each day and then resets to display the current time, the year, the time the alarm is set for and the date month/day. Then as long as the GPS has a signal the time will update once a minute for the rest of the day. At the time you would like to go to bed the Arduino will cut power to the game and it will remain off until the alarm time. Should you have a power failure in the night the machine will not lose it's settings. If power is restored prior to the alarm time the machine will wake up as normal, otherwise the machine will wake up once power is restored.
If the game is powered on because it is not yet bed time and it is after the alarm time then at 12am, 1am or 1pm the game will do a full reset. This makes sure the clock hasn't gotten off due to a stuck score reel, keeps the time in a 12 hour format and keeps the date display up to date.
The machine will automatically adjust for daylight savings time and leap years.
[[Video(http://www.youtube.com/watch?v=uUnR5iLF33M) ]]
Cool features:
The machine will automatically coin-up for any resets it needs - no need to have the game set on free play to do all of this. Powering off the clock (Arduino) will let you play the game as though no changes have been made to it.
Coolest features:
When setting scores to the right displays instead of sequentially counting up the machine will advance the various scores randomly - slightly random timing and random scoring - and every so often listen for the occasional 500 or 5000 point score advances like you would get hitting a high scoring target. Looks and sounds more like a pinball machine being played, albeit quite a bit faster than most games, as it gets to the right display.
All this is done WITHOUT MAKING ANY PERMANENT CHANGES TO THE GAME. Take the Arduino and wires out - the game is as it was before you started without making a screw hole or soldering anything to the machine.
Disclaimers:
I have seen the sparks these machines can generate and I have felt the flow of electricity through my arm. I have felt the tears run down my face when I have seen these same sparks come from under my Arduino when it has touched places inside the pinball machine it shouldn't have. If these things worry you, as they should, then know this - that is nothing compared to the reaction you will get when you get caught replacing a clock radio in the bedroom with a pinball machine.
The atomic synced claim may be a little liberal - but the satelites I get the clock signal from are, so in a sense my pinball machine is now as well. It does have about a 1-2 second delay.
But seriously folks... The voltages in a pinball machine range from as low as 6 to full line voltage from the wall. Be careful in there. This is probably not the best thing to do if you have never played around inside a pin before.
Step 1:
Materials:
Arduino. I used an Arduino Duemilanove but an uno should work as well $25-$30
8 relay board/shield. picked this up on e-bay for less than $20
GPS receiver (as found in Microsoft Streets and Trips) $20 - $30 on ebay
Long length of cat-5 cabling (cat-5 is what I used, but you just need to get three wires from the GPS by the window into your pinball machine) $10
Jacks to connect the cat-5 cable. $5
Headers and connectors like the kind you that you would find at the same place you picked up your Arduino $3
some aligator clips and wire. $3
A blown fuse from a pinball machine $0
Power for it all - an old PC power supply $15
An electro-mechanical pinball machine (and a schematic diagram just to be safe) $150-$2000
I am just guessing about some of the prices as I happened to have a GPS, cat-5 cable, rj-45 connectors and a pinball machine. All I really needed to pickup was the Arduino, the relay board and some odd bits to finish it off.
When I built this I used a Bally Wizard. The code for the Arduino should work for almost any four player Bally game from that era without too much tweaking required. It shouldn't take much at all to adjust things around and make this work on almost any EM pinball machine you just need to take into account what switches will advance the score to the next player and if the game scores a bonus at the end of each ball.
Arduino. I used an Arduino Duemilanove but an uno should work as well $25-$30
8 relay board/shield. picked this up on e-bay for less than $20
GPS receiver (as found in Microsoft Streets and Trips) $20 - $30 on ebay
Long length of cat-5 cabling (cat-5 is what I used, but you just need to get three wires from the GPS by the window into your pinball machine) $10
Jacks to connect the cat-5 cable. $5
Headers and connectors like the kind you that you would find at the same place you picked up your Arduino $3
some aligator clips and wire. $3
A blown fuse from a pinball machine $0
Power for it all - an old PC power supply $15
An electro-mechanical pinball machine (and a schematic diagram just to be safe) $150-$2000
I am just guessing about some of the prices as I happened to have a GPS, cat-5 cable, rj-45 connectors and a pinball machine. All I really needed to pickup was the Arduino, the relay board and some odd bits to finish it off.
When I built this I used a Bally Wizard. The code for the Arduino should work for almost any four player Bally game from that era without too much tweaking required. It shouldn't take much at all to adjust things around and make this work on almost any EM pinball machine you just need to take into account what switches will advance the score to the next player and if the game scores a bonus at the end of each ball.
Step 2: Make Some Connections Inside the Pinball
The playfield and coin doors connect to the main insides of the pinball machine using rather large and old school connectors called jones plugs. It is here where we will tap into the circuits to control the pin.
Rollovers, buttons and wire frames are all used to score features on the game. As the ball rolls over the switch above the playfield they will close a pair of contacts below. Using your schematic and multimeter identify the pairs involved in the following:
Scores 10
Scores 100
Scores 1000
Ball kickout/return
credit switch
coin-up
Once each pair is identified, clip an alligator clip to the lug on the female end of the jones connector and run the wire back to the relay board. T save a few wires note that on my machine all of the scoring, as well as the ball return, use a common yellow wire so I made one connection to the Jones connector and split it out to one side of each of the four relays.
Before you do this however, now would be a good time to load the attached sketch onto your Arduino. A lot easier to get this done before tucking it away inside the pinball machine.
Step 3: Replace the Mains Fuse in the Pin With This...
This was the easiest way I could find to cut power to the entire game at bedtime.
I replaced the main fuse with a small length of wire (with an inline fuse - don't skip the fuse ) that connects into one of the relays. This relay we use the normally closed contacts, all the rest of our connections will go to normally open contact pairs. The reason for this being when power is cut to the Arduino the game will operate as normal.
Step 4: Wire in the GPS
There are only three wires we care about on the GPS
TX (transmit data), this will connect to pin 0 (RX) on the Arduino
Ground, this connects to any ground on the Arduino
Power, we draw 3.3 volts from Arduino to power the GPS.
I built a couple small interfaces to the GPS, the one I ended up using was an old connector used in the days of 5 1/4" floppy drives. It seemed to have the pins in the right spot. I simply cut away the parts I didn't need and soldered on my wires.
Prior to this I made my own connector. To do so I cut a small piece of plastic to snugly fit the width of the slot in the GPS. Drilled a couple of holes right where the connection needed to be,. Inserted three pins that had wires attatched into the holes and wedged it all in. Once in place it seemed quite secure but it did not hold up well to repeated insertions and removals.
Using either method I then wired the three wires into an female RJ45 coupler I had kicking around. I rewired a similar rj45 coupler for the Arduino end, but here I just go from RJ45 t othree wires that end in pins that plug into the Ardiuno.
The reason I used the rj45 couplers was so I could use a standard category 5 ethernet cable between the Arduino and the GPS. I happened to have a spare, lengthy, cable from the days before routers at home all went wireless.
When all is good - find a window that faces the satellites for your GPS.
A brief note on wiring standards:
On my first set of connectors I just picked three wires made sure that the lines I used for 3.3volts and ground were straight through and that TX on the GPS went to RX on the Ardiuno. Everything was in, everything worked. Then I got it in my head that I could use the serial port on my computer to send "test" data as if it was from the GPS. So I ripped the entire assembly apart, looked up what pins are used for what when converting db9 to rj-45 and rewired it all from scratch. It was at this point I realized that I would now have to rebuild my connector to the GPS from scratch. So I did. And I rewired both ends to match the standards. And when all was done - I still couldn't talk with the serial port on the pc to the Arduino. Not because of my wiring, but because I needed an rs232 to ttl converter. Had I looked at the wiring standard beforehand - I would have saved all this trouble with the same result!
Step 5: Wire It All Up and Stuff It in a Box
The connections on the Arduino are
pin 0 - TX from the GPS
pins 3,4,5,6,7,8,9 - These connect straight across from the Arduino to the relay board/shield. Please note that you cannot use 2.54 mm spaced header as there is a gap on the Arduino between pins 7 and 8 and it just won't fit nice.
pin 3 goes to relay 8
pin 4 to relay 7
pin 5 to relay 6
pin 6 to relay 5
pin 7 to relay 4
pin 8 to relay 3
pin 9 to relay 2
pin 10 would have gone to relay 1 - but I blew that relay up on the first day (best to pay heed to the disclaimers)
pin 11 to select button
pin 12 to advance button
gnd - A connection to ground on the Arduino board is required to each of the two buttons and the GPS
5 volts - to vcc on the relay board
3.3 volts to power on the GPS
Power to the Arduino is +12 volts from a PC power supply
Power to the relay board is +5 volts from the PC power supply
At this point I jammed the whole mess into a small box I picked up at the dollar store. Had I been more patient I am sure I could have found a similar box filled with crap at the dollar store for the same price - but I opted for an empty one. The biggest reason for the box - to stop me from dropping my Arduino on top of any stray volts or wires.
The buttons that I haven't talked much about yet are just simple push buttons that release when you let go of them. one wire goes to ground, the other to the pin on the Arduino. I use the Arduinos built in pull up resistors so no extra parts required.
The 8-relay board had a jumper I disconnected so I could use external power. I tap 5 volts from the Arduino to VCC on the relay board and power the relay board with separate +5 and ground from an old computer power supply. The same supply I get 12 volts from to run the Arduino.
pin 0 - TX from the GPS
pins 3,4,5,6,7,8,9 - These connect straight across from the Arduino to the relay board/shield. Please note that you cannot use 2.54 mm spaced header as there is a gap on the Arduino between pins 7 and 8 and it just won't fit nice.
pin 3 goes to relay 8
pin 4 to relay 7
pin 5 to relay 6
pin 6 to relay 5
pin 7 to relay 4
pin 8 to relay 3
pin 9 to relay 2
pin 10 would have gone to relay 1 - but I blew that relay up on the first day (best to pay heed to the disclaimers)
pin 11 to select button
pin 12 to advance button
gnd - A connection to ground on the Arduino board is required to each of the two buttons and the GPS
5 volts - to vcc on the relay board
3.3 volts to power on the GPS
Power to the Arduino is +12 volts from a PC power supply
Power to the relay board is +5 volts from the PC power supply
At this point I jammed the whole mess into a small box I picked up at the dollar store. Had I been more patient I am sure I could have found a similar box filled with crap at the dollar store for the same price - but I opted for an empty one. The biggest reason for the box - to stop me from dropping my Arduino on top of any stray volts or wires.
The buttons that I haven't talked much about yet are just simple push buttons that release when you let go of them. one wire goes to ground, the other to the pin on the Arduino. I use the Arduinos built in pull up resistors so no extra parts required.
The 8-relay board had a jumper I disconnected so I could use external power. I tap 5 volts from the Arduino to VCC on the relay board and power the relay board with separate +5 and ground from an old computer power supply. The same supply I get 12 volts from to run the Arduino.
Step 6: Running the Clock
Now that it everything is all wired up load the attached sketch onto the Arduino and turn on the pinball machine and turn on then the PC power supply. If all is as it should be the pinball machine will light up nice when you power it up then shut down a few seconds after the sketch starts running on the Arduino.
To set the alarm at this point watch for the red led to flash twice, pause then twice more then press the select button. The game will power up, add a credit and then reset to 0, once the reset cycle is complete the Arduino will flash to indicate it is ready to set the hour. Each press of the advance button will increase the score by 1000 points (one hour). When the hour is correct press the select button. The Arduino will flash. When the flashing stops press the advance button, each press will advance the score by 10 (each 10 is one minute). Press select when done.
To change the shutoff time press select once more. The game will add a credit, add 1000 (an hour) to the alarm time on the player one display , kick the ball out and the Arduino will flash as before. Note that when setting the shutoff time the alarm time will be as you set it, not the hour later. This is a result of 1000 points bonus being added to the score before it kicks the ball out for player two.
Press advance to change the hours and select when they read as you would like. The Arduino will flash, press advance to set the minutes and press select when done.
You have about 20 seconds, plus about a second more for every time you press a button, to get this all done. If at any time you just stop pushing buttons the game will eventually time out and set things as you left them. ie if you set just the alarm time hours it will leave the minutes as 0 and leave the shutoff time as it was before.
If you do not want to make any changes to the alarm or shutoff time - just turn the game and the Arduino on. After about 20 seconds of waiting to see if you had changes to make the Arduino will start listening for a time code from the GPS. It can take a couple of minutes at times for the GPS to synch up nice. Once the GPS has fixed on a signal the Arduino/Pinball machine will check to see if the current time is between the Alarm time and the shutoff time. If it is during the waking hours the machine will turn on, reset and when complete the scores will read as follows:
Player 1 - The current time in a 12 hour format
Player 2 - Current year
Player 3 - Alarm time (24 hour format)
Player 4 - Current Month/Day
If the current time is out side of those hours, the machine will wait until the Alarm time and then reset as above.
When the shutoff time arrives the game will wait for the end of the minute that the shutoff was scheduled and then power down.
At the end of each hour the core will advance from :59 to 00 by adding 410 points instead of just 10
at midnight, 1am and 1pm (if these times fall within your settings for waking hours) the machine will reset and advance the scores so that the 12 hour format and date are correct.
Tweeked the sketch a bit, turns out I couldn't set an alarm time of 00: xx So it will now let you - but will display as 24:xx. Also put some comments into the text version of the sketch - but I doubt it will help follow my thought process.
time for some more tweeks - two biggies actually - turns out that you cannot display 01000 (1am or 1pm) on a Bally pinball used as I am using it. The 1010 points is the lowest score after the ball advances to the next player. If you don't score 10 points the machine will not advance to the second player - so the year will be added to the time score and things just go wrong from there. I will fix this by having the game "rest" until 1:01 then carry on. So at 1pm there will be a 1 minute pause.
The thing that really has me upset today - It never adjusted for daylight savings time. Will have to figure that one out aand get back to you...
Hope you like it, it was a fun build.