Introduction: Pa-Drink-O: the Pachinko Bar Bot
Sharing a drink with friends is great. Sharing time with robots is great too. Playing classic arcade games? Fantastic. I deeply enjoy the electromechanical goodness of classic pinball machines, so in combining my interests, I set out to build my own bar 'bot that had an arcade game interface. After many hours of research and a handful of sketches, I came up with the rough concept for Pa-Drink-O: The Pachinko Bar Bot.
This Instructable will demonstrate construction and proper operation of a drink dispensing “robot” in the style of a Japanese pachinko machine. The unit consists of several systems: bottle storage, alcohol dispensing mechanism, user input controls, ball release mechanism, drink platform, playfield sensors, and scoreboard. After dispensing balls into the hopper on top of the machine, the player is given a set time limit in which to score as many points as possible by aiming and firing the ball release mechanism toward targets on the playfield. Once the game timer has run down, the player will be able to select a drink depending on how many points they have earned.
Step 1: Parts and Materials
(4x) peristaltic pump
(2x) 4 ohm 3W speaker
(4x) N-channel MOSFET
(4x) 10K ohm resistor
(100x) 5/16" ball bearings
(100x) M3 x 20 screw
(20x) M3 x 30 screw
(120x) M3 nut
(4x) M5 x 10 screw
(4x) M5 nut
(4x) 1L glass bottle
heat shrink tubing
(2x) 600 x 900 x 5mm plywood
(4x) 600 x 900 x 3mm acrylic
Step 2: Mechanical Design
Below I'll breakdown the overall physical design of the game. You can read more about each mechanism and related electronics on the individual steps.
I designed the structure of Padrinko to be made out of slotted panels of laser-cut acrylic and plywood. I wanted to use acrylic for the main playfield since it has a nice finish straight from the machine, however it is quite brittle. I opted to make the outer walls of the machine from plywood, which could withstand being handled less gently. I also designed the machine knowing there were going to be a lot of small parts that needed placing and rearranging, so all of the plates are as symmetrical as possible and fastened with t-slot edges for strong, yet removable joints. I only used glue to assemble the ball cup on the side of the machine and to affix the alphanumeric matrices to the scoreboard. In keeping with ease assembly, the machine is also designed to be (almost) entirely fastened with M3 screws and nuts.
In order to design the overall structure, I carefully modeled the machine around the parts I chose. I used Autodesk's Fusion 360, since it's my go to CAD tool. The final machine is rather large, (roughly xxx tall) so I spent most of my design time with the 3D model in order to avoid wasting any material when I finally cut the parts out. Nearly every part is modeled, with the exception of screws and nuts, as there are well over a hundred of each and even digitally arranging them would be too tedious.
With the 3D model in place, I was able to export the flat faces of the machine as .SVG files. I imported these vectors into Adobe Illustrator, organizing them by material type and grouping the more complex parts to make the layout as compact as possible while cutting. There were a lot of individual laser-cut parts, so I split them into two large vector files: one for wood pieces and the other for acrylic.
I chose peristaltic pumps as the main dispensing mechanism. They're hard to beat in terms of simplicity when working with fluids and electronics. I made the machine reasonably compact, so the tubes don't have to extend very far from the bottles. All four tubes feed out the side of the machine and into a small stainless steel funnel centered over the cup plate. The funnel and cup plate simply slot into place without any screws so they're easily removable for cleaning.
The machine's play mechanisms were inspired by a combination of pachinko, pinball, and marble run machines. The balls are fed into a small hopper to the left of the scoreboard before falling into a channel on the play field. This channel leads into what I call the "feed disk." The feed disk has a small void that allows a ball to fall inside. When the player chooses to activate the feed disk, it will rotate ninety degrees to allow the ball to fall towards the aiming disk. The aiming disk lies flat within the playfield and has two bars forming a channel allowing the ball to fall straight down. The bars can also act as slides angled toward other targets as the player moves the joystick. The aim disk can be rotated a full 180 degrees. The balls then fall and bounce off "pins," which are rear-mounted extra-long machine screws. There are six targets through which the ball can fall, each containing a photointerruptor to allow the machine to detect them. I chose 5/16" (roughly 8mm) ball bearings as these would be decently large to handle while still allowing a couple millimeters of clearance as they fall through the sensors. The playfield itself has no exit holes, so as the balls fall, they eventually are funneled toward the side of the machine, whereupon they fall out into a small cup, allowing them to be reloaded into the hopper.
Step 3: Electrical Design
The image above is the overall schematic/connection diagram for the system. The circuits and assembly are explained more in depth on the following steps.
I'm using the Intel Edison mounted on the Arduino breakout board. The Edison has plenty of GPIO and more memory than I could ever use for an embedded project, so it works great as the main processor. The Edison polls the sensors for detecting balls, reads the input from the arcade controls, and controls the servos and matrices via its I2C pins.
PaDrinkO has two separate motor systems: one for servo control and the other for the peristaltic pumps. The Edison controls the servos via a PWM driver shield that communicates via I2C. I'm only using two of the PWM pins on the shield for the servos, but it saves a pin and frees the Edison from needing to constantly maintain servo position. The pumps only need to be run in one direction, so I chose to drive them directly via MOSFETs.
The joystick and arcade button are normally open limit switches and are wired directly to the Edison. I'm using the built-in pullup resistors, so they're straightforward to read and require no additional support circuitry.
For user feedback, I added a sound effects trigger module, which will play a specific .wav file when one of its pins are pulled low. The inputs are connected directly to the output of the sensors, which are also tied to the Edison's GPIO. When a sensor is triggered, its signal pin is pulled low, triggering a sound effect and played on two 3 watt speakers.
(.wav files are attached with the program on step 10)
The Edison detects the location of the ball by polling eight photointerruptors for a digital LOW signal. An interruptor at the top and bottom of the playfield allows it to detect if a ball has been properly dispensed. The remaining six sensors are "targets" which allow for scoring.
Five sets of alphanumeric led breakout boards make up the score board. I chose these since I've worked with them before, they can be controlled via I2c, so for two pins I can control 280 LEDs. These make for a great, retro-style display that is both bright and easily readable at a distance. Each module has four characters, so I chose to use five displays allowing enough space to display the current game time and score.
The whole machine is powered by two power supplies: one 12V and the other 5V. The 12V supply provides current for the pump motors, while the 5V supply powers everything else. These are each connected to a barrel jack adapter, allowing them to be easily wired to terminal blocks for power distribution.
Step 4: User Input Board
To keep controls simple, I chose arcade controls for the user interface. With a minimal setup of three switches, the player can properly aim or select drinks with the joystick and release a ball or choose a drink with the arcade button.
The wooden input panel provides a solid mounting point for the joystick and arcade button. The joystick must have the ball unscrewed before popping in from the underside. The plate has a slot such that the joystick can only move left or right. Four M5 screws secure the joystick in place. The arcade button has a large panel mount nut that secures the body once it has been popped in.
Since only half of the switches on the arcade joystick are used, only three contacts are connected to the Edison: switch left, switch right, and ground. The grounds from the arcade button and joystick are connected locally so that only four wires need to be extended three feet up to the Edison board. The Edison has internal pull-up resistors, so no external components are needed.
Step 5: Playfield: Mechanics
The playfield is by far the most complex assembly within PaDrinkO. I tried to strike a balance between simplicity in design and interesting gameplay, so I spent a lot of time minimizing the design to its core elements.
The playfield has a rear and front assembly. The rear assembly is detailed on the following steps as it relates more to the electronics. The front consists of five layers: base, stacks 1-3, and "glass." The base is the main plate of the entire playfield and has holes for the feed disk, aim disk, sensors, and pins. The base plate (along with a couple more rear plates) has three tabs that extend from the sides that fit nicely into the side panels. Three identical layers of acrylic stack on top of the playfield with a separate panel for the left and right side of the field. Three plates of acrylic provide just enough clearance for the balls to fall down easily. The playfield is held together with three M3 x 30 screws on either side. Finally, the front "glass," which is just a sheet of clear acrylic, rests on top of the stack to enclose the playfield and keep the balls from falling out.
I designed a small exit cap for the balls as they exit the playfield as they move quite fast. This cap consists of three stacked plywood pieces that are screwed onto the side of the machine. Once the balls hit the cap, they'll fall into the cup. The cup rests on three screws that face out from the machine. The cup itself is made of 10 plates and ribs of wood glued together.
Step 6: Playfield: Electronics
Each target consists of the interruptor, breakout board, resistor, and three pin male headers. All eight need to be soldered before being placed. I made a female header extension cable for each sensor, extending them 24" with ribbon cable before tying the ground and VCC connections together. Each signal wire is then split in two, with a solid core wire for directly plugging into the Edison, and another female ribbon cable for connecting to the male headers of the SFX board.
Rear Playfield Plates
The rear assembly of the playfield consists of three stacked plates. The first acrylic layer (black) provides a hexagonal space for an M3 nut and a rectangular void for the base of the target sensors. Each hex needs to be filled with one nut. The next acrylic layer (yellow) provides an additional rectangular void for the sensors. The final acrylic layer (red) encloses the sensors and provides wider holes for the heads of the playfield screw "pins," giving them a counter-bored look. Each wider hole in the final layer is filled with an M3 x 20 screw. The whole playfield assembly is held in with three M3 x 30 screws, three on each side.
Each servo is mounted to an identical bracket with four M3 x 10 screws. Each bracket has six acrylic spacer disks, three on each side. The servo horns are screwed into a wooden spacer and disk (this can be more clearly seen in the model). The disks have voids for an M3 hex nut, allowing the pieces that extend into the playfield to be aligned properly (the red through white layers). The servo wires themselves do not need to be extended and can plug directly into the PWM shield.
Step 7: Alcohol Dispensing Mechanism
Four identical 1 liter bottles rest in the rear of the machine. The machine has no bottom, so the bottles themselves rest on whatever surface the machine is placed. A single wooden plate fits into the side plates, secured by an M3x 30 screw on either side and keeps the bottles properly spaced below the pumps.
Pump Assembly and Tube Feed
The pumps are mounted on the rear plate (more on this on step 9), simply pop into place, and are each secured with two M3 x 10 screws on either side of the pump. The left side of the tube goes into the bottle and the right side of the tube goes into the small hole below each pump. The tubes lead to the four holes on the right side of the machine to the funnel and cup stand assembly.
Funnel and Cup
As the tubes exit the machine, they are guided into a wooden plate that pops into the side of the machine. A stainless steel funnel rests in another removable plate gathering any liquids over the cup. Another rounded plate pops out the side of the machine acting as a stand for the cup. A riser supports the cup plate and fits into the slots in its base. The cup rests about an inch from the spout of the funnel on top of the plate, but as the plate is removable, a taller glass may be placed below.
Step 8: Scoreboard
The ball hopper consists of three identical acrylic spacer places and one base plate. These attach to the rear of the scoreboard plate and are held in place with four M3 x 20 screws.
Each display module has a five-bit binary address jumper on the back. Each display needs to be given a unique address. The PWM shield has a conflicting I2C quirk that conflicts with the displays, so they need to be incremented starting at one through five (0x71 to 0x75), which you can read more about on the display's page linked in the earlier parts step. The VCC and VI2C pins are all tied together to 5V. The ground, clock, and data lines are each wired together in their own bus, so that ultimately only four wires for the display extend out. The display modules pop in the rear of the scoreboard plate and are held in place with a couple beads of hot glue.
The speakers are wired directly to the left and right terminal blocks on the sound effects board. Each speaker is secured to the rear of the scoreboard plate with four M3 x 10 screws.
Step 9: Rear Mounting Plate
The Edison screws into the plate with four M3 x 10 screws and the PWM shield pops directly on top. The Edison is powered via a spliced micro USB cable and connected to the 5V rail.
The anodes of the pump motors are connected directly to the 12V supply and the grounds are each connected to the drain pin of a MOSFET via a terminal block. The protoboard attaches via two M3 x 10 screws and provides a mounting point for the MOSFETs with one of the power rails for 12V and the other for the 5V supplies.
For each power supply, the positive wires extend from the barrel jacks and are soldered to on side of the DPDT switch. The output of the switch and the grounds from the barrel jacks connect to the power rails via terminal block on the protoboard.
The sound effects board attached with four M2 x 10 screws. The VCC and GND pins are connected to the 5V rail via male to female jumper wires.
Step 10: Software
The main program is an Arduino-style sketch running on the Edison. I heavily commented the attached sketch, so you can easily modify it. The software comprises most of the gameplay, which I explain on the next step, so I won't go into it here
There's no programming related to the sound effects board as it is tied directly to the sensors, but you can find the attached .wav files that I used. You can read how to load files and the proper nomenclature over on Adafruit's website.
Step 11: Game Operation
Once the bottles are loaded with your beverage(s) of choice and the balls have been loaded into the hopper, it's time to play the game!
After bootup, the Edison will configure it's GPIO and connect to the the PWM shield and displays. The servos will move to their default positions. At this point, the game is ready! There are four main modes:
Idle - Before or after a game, the system will display an idle screen with its name followed by text encouraging the player to play. A button press will set the game to Run mode.
Run - The player has sixty seconds to score as many points as possible by tilting the aim disk with the arcade joystick. The game does not dispense balls automatically so it's up to the player to release them by pressing the arcade button. The Edison is constantly polling the sensors to detect if a ball falls through and updates the score depending on the target through which the ball passes. The player can release as many balls as possible within sixty seconds to increase the score, but once the timer runs down, the controls become inactive. The game now enters Choose mode.
Choose - Here the player is shown the "prices" of the various bottles and their current score. The player may select and "spend" their points on one of the bottles. There are only four physical bottles, but five choices. The fifth "bottle x" allows the player to skip dispensing a drink. If the player chose a real bottle, then the game will enter Dispense mode.
Dispense - The game now dispenses the beverage by activating the appropriate pump for 30 seconds and count down on the display. After the pump has run its course, then the game will return to Idle mode.
(If you want to increase flow rate, you could also run all four pumps simultaneously. As is, the dispensing process is quite slow.)
Thanks for reading! I really enjoyed building Pa-Drink-O and I hope you are inspired to build your own hybrid arcade/drinking machine. Be sure to drink responsibly, and let me know what you think in the comments. I'd love to improve this and work on even more weird/wild games in the future!
We have a be nice policy.
Please be positive and constructive.