Introduction: Arduino Slot Machine

About: Old dog still learning new tricks.

One of my earlier Instructables details a small slot machine that I built to entertain my grandkids. I used my favorite PIC microcontroller to run it but lately I’ve been on an Arduino kick so I thought I would make a version for the few people who may not be PIC microcontroller/assembly language fans. Ok, so maybe it’s more than a few.

I won’t rehash the details as to the components and physical build of the slot machine. You can see those pictures and details in my previous Instructable. In essence, everything is the same except that the Arduino takes the place of the PIC.

Step 1: Hardware

The schematic is shown above. Again, it is the same as the original PIC version except for the swap of the Arduino for the PIC. I also deleted the external pull-up resistor on the switch input because the Arduino internal pull-up is used. I use a large character 1601 display but the software works just fine with a standard 1602.

Step 2: Software

The software is pretty much a direct translation of the PIC assembly routines into C++/Arduino commands. The main routine just loops continuously until the button on the coin switch is pressed. 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. 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 “Loser” routine displays digits loosely based on the value of “Random”. A test is done to ensure that an accidental match of digits doesn’t occur.

As in the original PIC software, the “Clickit” routine simulates the sound of the wheels turning. If a winning value is found, then the LEDs alternately flash and a trigger pulse is sent to the ISD1820 Sound Module. You can record whatever short message you want to play. Mine says “Winner, winner, chicken dinner”. The grandkids are young enough that they actually think that’s funny.

Part way through the LED flashing and message playing the trap door will be opened. It is controlled by a simple 12-volt solenoid latch that is driven by a generic power N-FET transistor. The coin door must be manually pushed back up to latch it again. That’s it for this post. Check out my other Instructables. If you are interested in PIC projects take a look at my website: