Chocolate Slot Machine

1,170

14

I am good at building software, and am trying to improve my hardware and woodworking skills.

We decided to celebrate a Casablanca themed Halloween this year (just in time for the 75th anniversary). We had all sorts of ideas about table games, chocolate poker chips, etc. We settled on building 3 slot machines that dispense chocolate coins. The original coins came from Cost Plus World Market. To buy them in bulk, we found ohnuts.com. We purchased cheaper coins on amazon, but the consistency of the size wasn't good and they jammed the mechanism. Also, make sure to keep the coins in a cold place until they are needed.

Step 1: Chocolate Coin Dispenser Mechanism

The first part of the project was figuring out how to reliably dispense chocolate coins. The first prototype was built from cardboard and scrap wood. It proved the basic concept. I used this as an excuse to purchase a Taz Lulbot 3D printer. I created the models using openscad: Chocolate Coin CAD files The servo horn needs to be longer than the standard horns that come with the servos. I had some success printing them using these: servo arm CAD Ultimately we used the servo arm that came with the servos, and overlaid a laser cut piece of wood. That worked really nicely.

The design was borrowed from a change dispenser that I have in my old coke machine. It has a piece of plastic the height of one coin, and it pushes the coin from the bottom of a large stack. In our mechanism, we separate the stack from the dispenser. The stack lives inside a plastic tube or pipe. I originally used a black PVC tube, but I found a cheap clear alternative at TAP plastics. It is really nice to be able to see the stack of coins, and how many are left in the tube.

There is some adjustment needed depending on the length of your pusher arm - this is in the python code that controls the servos.

Step 2: Raspberry Pi Setup

The computer setup is a normal raspberry pi 3, with an adafruit servo controller hat. We used inexpensive MG996R servos. To keep things simple, we wired the power connector from the servo to the raspberry Pi power. This may not be the best way to power the Pi, but we had a lot of things to power (screen, speakers, Pi, servos). We also hooked GPIO pin 18 to the breadboard part of the HAT where we jumped it to a 1K pull up resistor (wired into 5V lead). We hooked the 18 (via the breadboard) and Ground to long wires, that we put crimps on, so we could attach to the switch that the slot machine lever will pull down. The pi is also hooked via HDMI to the monitor, and powered speakers are plugged into the jack. We had to go into raspi-config and force the audio through the jack instead of the HDMI. We also put a USB extender and plugged it into the Pi, and hooked it to the back of the case.

The software is a simple python program written using the kivy framework. We call it kivySlots. This software by default is setup to spin the slot machine wheels, and randomly stop after a random time. The payout is setup for 1 coin if you lose, and then 2 coins for 1 cherry, 3 coins for 2 cherries, 4 coins for 3 cherries. It would be straightforward to change the payout. We decided to put two tubes of coins in our machine, so the code is setup to alternate which tube it dispenses chocolate from. The slot machine is started by either the space bar, or the switch hooked to GPIO 18.

Step 3: Prototype Hardware and Software

The first prototype was hand built out of 2x2 framing and plywood. I cut the plywood with a jigsaw. This took a few hours, it was much faster than building all the CAD drawings for the laser cutter - but it wasn't very square. Originally I was thinking of using an old tablet as the screen. This worked, but was less than optimal because the tablet had to talk to the raspberry pi over wifi - and there was a lot that could go wrong. If you want to extend this version, the software is available.

Step 4: Laser Cut Case

After building the first prototype, my friend Scott decided that he wanted one as well. He has access to laser cutters, and a big wood shop full of great equipment. Scott is also has much better python skills than I do.

In the past Scott wrote a simple library in python to kick out boxes for various laser cutter projects. This project was a bit more complicated, and I wanted to see if there was a more extensive python library that could help us. I stumbled upon a project called boxes. Here is our fork that includes the Slot Machine project. It took us a while to understand how to use the project, but in the end we were able to generate via code with lots of parameters a design for the pieces. We still loaded the SVG into Corel Draw and laid it out a bit more efficiently.

The slot machine arm is made of a cheap door lever from Home Depot, a PVC pipe, and a 3D printed knob to go on the top. This works really well.

You will find laser cut templates in this directory:

Slot Machine Laser Templates

Step 5: Decorating

Before putting the electronics in the case I spray painted my 3 cases. 2 blue, 1 Red. I didn't do as good a job as I would have liked, too many drips. I need to work on my painting technique. Here are the models for the handle.

Step 6: Wiring and Assembly

The hardest part is to get the wood glued together. It will need to be clamped. We needed a rubber mallet for a bunch of the joints. The main case is glued together. Then you need to make the coin chute separately. It is held in with one wood screw on the top. The front coin tray should be glued minus the bottom, and then the inside should be sanded. Then you can glue the bottom on, and sand the outside edges. If you glue it all together, it is really hard to sand the inside lip of the tray. When that is done, it can be glued onto the front of the slot machine. I glued it after painting both parts different colors.

The monitor gets wedged between two pieces of wood. Depending on the size of your monitor you may need to adjust the plastic and wood pieces. Black tape around the edge can clean up a messy edge. We used this monitor.

We used a big 5V power supply. We wired a jack on the back, and hooked it to a simple switch. From the switch we split off connectors to the monitor, the pi HAT, and a usb connector to power the speakers. Make sure the gauge of the wire is big enough (18 or 20?)

Each of the servos is plugged into the Pi HAT - in the first two ports.

Step 7: Lots of Candy!

Step 8: Update!

Scott updated the kivySlots software to have better graphics.

Share

    Recommendations

    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Plastics Contest

      Plastics Contest
    • Optics Contest

      Optics Contest

    Discussions