I remember when I was a 17-year-old, recent high school graduate, and was traveling with my grandparents from California back to their home in Michigan. Of course we stopped in Las Vegas and walked the Strip just to see what there was to see. Almost all of the casinos were open at the front so I wandered into one with my grandparents. I saw a nickel slot machine and just had to stick a coin in. Surprise, surprise, I hit the jackpot! Jackpots were paid out as two rolls of 50 nickels each so a casino employee came over when the lights and sound went off. He looked at me, handed the rolls to my grandmother and quietly told her that anyone under 21 really wasn’t supposed to be in there.
I like technology but I’m not a tech junkie by any means and I also like a lot of “old school” stuff like antiques, cars, etc. For instance, if I ever decided to buy a pinball machine I’d want one from the 60’s or 70’s before they got too glitzy. I’m also not a gambler but I remember how cool that old time slot machine was. Just for fun I decided to check some out on eBay and about fainted when I saw the price tags. I could probably afford it but I’m too cheap and there’s no place in our home for it anyway. Still, I thought that the young grand kids might enjoy a toy like that when they come to visit so I decided to see if I could build a small version.
Step 1: Components
Old time slot machines had three windows and mechanical wheels with a variety of images that would spin behind the windows when a coin was inserted and the side handle was pulled. The spinning wheels would come to a stop one at a time and some sort of payout would occur for various matching images. They also tended to have flashing lights and noise if a jackpot occurred. I wasn’t trying to exactly recreate an actual slot machine but at least it had to have some of the basics. I needed a solenoid to activate the trap door for the coins when a jackpot occurred and some LED’s for flashing lights. I also wanted some sort of sound so I found a sound recorder module in my junk box and recorded the ever popular phrase “Winner, winner, chicken dinner”. It plays through a small speaker.
The display is one of the large digit surplus 1601 LCD’s that I have lying around. I used square bracket characters to simulate three windows and finally decided to just use numbers instead of characters for the “tumbling” wheels. I added a small buzzer to make a clicking sound while the digit “wheels” were turning. I hemmed and hawed about whether or not to trigger the “spin” when a coin was inserted or to build a separate handle. The coin slot I bought came with a coin reject button so I decided to use that to start the spin. I mounted a micro switch so that it is activated when the coin reject button is almost fully pressed. A piece of scrap PVC pipe was placed between the coin slot and the trap door to hold the inserted coins.
A big part of the fun was doing a little woodwork (one of my other hobbies) to build the cabinet. I didn’t have anything that was quite right in my scrap pile so I headed to the local lumber store to look around. One of the types they carry is poplar which, to me, sounded pretty bland. But when I started sorting through boards I came across one that I just had to have because of its variety of color bands. It was only later that I found out that it is an example of what is termed “Rainbow Poplar”. Unfortunately, my photography doesn’t really do it justice.
Step 2: Hardware
The schematic is shown above. Most of the components have already been described in the previous section and are fairly obvious. I placed four different color LED’s on the front, two on each side, and they flash back and forth when a jackpot is hit. The schematic just shows those as two LED’s on PIC pins 11 and 12. The sound module says it will run on 5 volts but the specs show it being happier with less than that. Instead of a regulator I just put a couple of salvaged 1 amp diodes in series to drop the +5 volts to the module. The inputs to the module prefer 3.3 volt levels so a resistor divider was added to the trigger input.
The solenoid runs on 12 volts and originally I had planned to just use a 7805 regulator to provide the +5 volts for the logic. Because of the current draw of the large LCD, there was a lot of power being dissipated so I grabbed a simple DC-DC buck regulator board from my parts supply to do the job. The small solenoid I used is not very powerful and won’t retract if too many coins are pressing down on the trap door. That shouldn’t be a problem because I made the odds 8:1 to keep the kids interest up. In any case, I decided to use a generic N-channel FET to activate the solenoid in order to reduce the voltage drop.
Step 3: Software
The main routine just loops continuously until the button on the coin slot is pressed. There is no requirement to insert a coin first to activate the spin cycle but I’m hoping that the kids don’t figure that out. While the main routine is looping, it is incrementing the variable “Random”. It will simply overflow back to zero the cycle after it hits 255. When the “Spin” routine is called it just goes through a list of checks on the value in “Random” to determine if a winner has occurred. As stated earlier, the odds are set at 8:1 but it can be easily changed by modifying the winning values in “Spin”. If a matching value is not found, then the logic just shifts bits in “Random” and displays each three bits as a number. A test is done to ensure that an accidental match of digits doesn’t occur.
The power up display shows a question mark in each of the three windows. While the “wheels” are spinning, each window will alternate between a blank and a question mark and then finally settle on a number one at a time. That logic is contained in the routine “Send_Digs”. Instead of having to constantly rewrite the entire display, the routine “Send_Dig” writes to a specific LCD location. Also, while the “wheels” are spinning, the routine “Clickit” is called to simulate the mechanical sound of the wheels. This is accomplished by sending 2ms on / 100ms off sequences to the piezio buzzer.
When a jackpot occurs the LED’s alternate flashing from right to left, the sound module is activated, and the coin door is released. There are no partial payouts, just all or nothing. After the coins are collected the coin door must be manually pushed back up to latch.
That’s it for this post. Check out my other electronics projects at: www.boomerrules.wordpress.com
Step 4: Video
Here's a short video of the slot machine in action.