Make: Projects
Secret-Knock Gumball Machine
Make a cute candy vending machine that only dispenses treats when you knock the secret rhythm on its front panel.
One of the best things about exhibiting at Maker Faire is giving attendees a challenge. For the 2010 Maker Faire Bay Area, I decided to combine a past project of mine, a door lock that opens only when you give a secret knock, with a standard crowd pleaser: candy.
The result was this Secret-Knock Gumball Machine, which tempted and tested the crowds at Maker Faire to guess the right rhythm and receive a treat. Since the knock was not terribly secret (I happily handed out hints), it distributed hundreds of gumballs over the event’s two days.
The “secret” knock defaults to the famous “Shave and a Haircut” rhythm, but you can program custom knocks by simply pressing a button and knocking a new pattern. The machine only listens for the rhythm, not the tempo, so the correct knock will dispense a treat whether you perform it fast or slow.
Inside the machine, a piezo sensor picks up sounds from the front knock panel, while an Arduino microcontroller recognizes the target pattern and controls a servo-driven gumball-dispensing wheel. You can build the Secret-Knock Gumball Machine with its inner workings visible or hidden, depending on whether you want to show off the mechanism or keep it a mystery.
Copies of downloadable files can also be found at http://makezine.com/25/gumball.
Steps
Step #1: Build the case.
Next


- Download the templates and print them at full size. Transfer to plywood or acrylic, and cut all pieces to size. Mark all screw and rail locations for later drilling and placement. To avoid confusing or flipping parts, temporarily mark the outside of each part with masking tape. Sand all edges smooth.
- Use a 4" hole saw to cut the hole in the top plate as well as the 7 dispensing wheel disks (2 stir plates and 5 center disks). You can use the remnant of the top plate hole as one of the dispensing wheel disks. Drill the 1/4" axle holes (which are off-center on the stir plates) as shown on the template.
- TIP: To minimize chipping when working with acrylic, support the work well, tape both sides of all cuts, and use fine-bladed saws at low speed — or have your local plastics retailer cut the pieces.
- Attach 3 rails to each side panel where indicated on the template. The front and back rails are 3/16" from the edge. The 2 side pieces should mirror each other, with rails on the inside of the case.
- NOTE: Unless otherwise specified, all attachments in this project are made with #8 3/4" wood screws, and holes should be pilot-drilled to prevent splitting.
Conclusion
Treat Selection
The 1" ball is a vending industry standard for not only gum, but also jawbreakers and other candies, bouncy balls, toy capsules, and empty capsules that you can fill with your own small objects.
An 8" globe holds about 200 gumballs, which are usually sold in quantities of 850 — but you can also buy 1" gumballs by the pound at bulk candy stores, and there are sellers on eBay that offer them in smaller quantities. I also found a box of 500 gumballs at Smart & Final.
This project first appeared in MAKE Volume 25, page 92.




































































If simply plugging the perf-board into the Arduino switches it off, something is wired incorrectly in the perf-board causing a short. This could be a wire going to the wrong location or a soldered joint bridging a connection that it shouldn’t.
1) First double and tripple check that the wires go to the correct locations.
2) Next carefully check the solder joints. They should use enough solder to cover the copper pad and the wire but not so much it makes a big blob. Make sure they connect what they’re supposed to and ”only” what they’re supposed to. If you find a suspicious solder joint remelt it with your soldering iron. If you have too much solder on a joint use desoldering wick or a solder sucker to remove the extra.
If two connections look like they might be connected when the shouldn’t try remelting one or both joints, or use a sharp knife or a narrow file to remove conductive material between the joints.
The pin to “Reset” shouldn’t be a problem as nothing is supposed to be connected to that pin.