BarBuddy – A DIY Raspberry Pi Cocktail Maker

Note: This post is copied from the Instructable page for this project, located here.

The BarBuddy is a personal bartender that can create a wide variety of drinks right at home. There have been countless times when we’re hosting guests and they request a drink, but only a few basic recipes come to mind. The BarBuddy solves this by knowing what alcohol and mixers are loaded in the machine and displays the cocktails that can be made. But the BarBuddy doesn’t stop there! It also will pump the loaded ingredients and even allows customization if you prefer your drink a little stronger or a little lighter. The drink options the BarBuddy can create are endless and can be updated at any time by inputting your own recipes.

I started developing the BarBuddy right before COVID when I thought it would be fun to have a personal bartending machine at home. I’ve seen products on the market that offer this sort of solution but they all are either too expensive, use proprietary pods, or only have a set number of ingredients and recipes offered. As a Mechanical Engineer I wanted to challenge myself to come up with my own solution that gives some extra features these other products done. The general idea for my machine is there are bottles loaded with the different ingredients which are hooked up to different pumps. These pumps are controlled by a relay to turn them on and off depending on which ingredients are in the selected drink. Everything is controlled by a Raspberry Pi 3 B+ which runs the custom GUI I created. The backend of the code allows up to 8 different ingredients to be loaded and up to 50 different recipes. This information is easily updatable via a CSV file so you can swap in and out ingredients as they’re available and even update recipes depending on moods. The GUI will then show the list of recipes and allow adjustment for whichever ingredients are loaded.

As this project includes alcohol I feel obligated to remind anyone who chooses to follow along to consume responsibly.

Supplies

One of the goals of the BarBuddy was to create a cocktail maker solution that wouldn’t break the bank and used easily accessible components. Some of these components have already shown to not stand up the best over time (cheap diaphragm pumps), and I’m unsure if others will remain to be food safe over years of use (could the plastic condiment bottles holding alcohol break down and leech chemicals over time?). Nonetheless, These are the components I’m using in the current iteration of the BarBuddy so use at your own risk. Like with any other project, I already have ideas for how to swap out these components or improve the design to ensure the BarBuddy is reliable and safe for many years to come (see the later section for design updates).

The following bill of materials are suggested parts. The number of pumps and bottles can vary depending on how many ingredients you want loaded (8 max, restricted by my current code). Bottle sizes can also be smaller or larger depending on space constraints and how much of each ingredient you want to use. For reference, I am using 16oz condiment bottles I got for cheap from Business Costco for my main liquors (tequila, vodka, rum, gin) and 16oz bottles for other ingredients (grenadine, triple sec, lime juice, sour mix). Some components might also be cheaper at other retailers (a lot of small electronics pieces such as wires and buttons I already had but the ones listed below will also work).

Bill of Materials

  1. (1) Raspberry Pi 3B+ and 16GB MicroSD card, ~$50
  2. (1) 7″ Touchscreen (800×480), $79.99 (Amazon option 1Amazon option 2)
  3. (4) 3-6V Diaphragm Pump (2 pack), $10.68 (Amazon)
  4. (25ft) 1/4″ ID Flexible Tubing, $13.25 (McMaster)
  5. (1) 16oz Condiment Bottles (8 pack), $17.99 (Amazon)
  6. (1) Power Port, $4.15 (Amazon)
  7. (1) Wire Kit, $15.99 (Amazon)
  8. (1) Limit Switch, $0.60 (Amazon)
  9. (1) Latching Push Button, $0.58 (Amazon)
  10. (1) 8 Channel Relay Board, $9.89 (Amazon)
  11. (2) 12V to 5V DC Converter, $4.00 (Amazon)
  12. (1) 12V Power Supply, $13.99 (Amazon)
  13. Heat shrink tubing
  14. Wood or acrylic for the housing (see attached photo)
  15. Small hinges (for drink platform)

For this project I estimate a total cost of ~$325 which is significantly cheaper than other products already out there! (for reference I’ve seen the Barsys 2.0 is ~$1500 or the Bartesian is ~$400 but requires pods). Not to mention the BarBuddy allows scaling for whatever you need (use your own ingredients and recipes). I recommend to use at least 4 pumps but plan for 8 so spacing is figured out at the start of the project.

Tools and Supplies Required

  • Soldering iron and wire strippers
  • Woodworking tools or CO2 laser to make the enclosure
  • Hot glue gun
  • Drill and screws
  • Spray paint (if desired)

Step 1: How Does It (the Code) Work?

I am a Mechanical Engineer by trade, so have limited experience in electronics and coding. Like with any other project though, I chose to break it down into parts to make it easier to tackle. The biggest skill gap I had here was programming a GUI for the Raspberry Pi. I have experience using Arduino and coding to control motors, relays, lights, etc., but a GUI was a little more advanced, so this was the biggest hurdle to get over. This section will detail how I broke down the problem to write the code and how it works. The finished code may eventually be available on my website for a small fee to help continue development on the project, but for now there is still some work to make sure it’s stable enough and works with multiple screen resolutions before I make it fully available to others. If you’re interested in building this project yourself and want the actual code definitely leave a comment so you can stay updated when it becomes available! In the meantime, the following is an explanation of how I put the code together.

I began by writing some basic Python code to turn on and off a multichannel relay. I chose an 8-channel relay, meaning up to 8 pumps could be used to dispense up to 8 different ingredients. After this was figured out, I adapted the code to read a list of ingredients from a CSV file and assign them to each of the different pumps. Using the command line, I could then prompt the user to select an ingredient from a list and then turn on then off the corresponding pump loaded with this ingredient. Next step was to add several recipes to the CSV file which would serve as the recipes the machine could create. After some iteration, the code was setup to (1) read the first line of the CSV to determine which ingredients were loaded, (2) read all the recipes loaded onto the machine in the subsequent CSV file rows, (3) display the drink name options for the user to select via the command line, and (4) take the drink name selection from the user and turn on and off pumps of corresponding ingredients as necessary to pump the drink. A safety feature I chose to include in the code was to check to see if a cup was placed under the pump output by reading if a limit switch was triggered or not. With all this put together, the basic functionality of the machine was complete.

The next step for the project was to create a GUI that would easily show the different drink recipes available. This part of the project probably took the longest since I kept putting off figuring out how to write a GUI. I chose Python as the base code due to its simplicity and ability to run different libraries, specifically a GUI library named tkinter. There is plenty of documentation and examples of how to create a GUI using tkinter, but I had a general idea of how I wanted the interface to look and mocked this up for easy reference (see the first image).

The biggest hurdle was trying to figure out how to achieve this look, and luckily I found a great tutorial (https://www.youtube.com/watch?v=Qd-jJjduWeQ&ab_channel=ParthJadhav) on how to use Figma to visually create an interface and then a custom program to convert this visual design into Python code. I used the code generated as a starting point, then modified it heavily to add buttons where needed. Specifically, I made updates so buttons would only be displayed for ingredients that were loaded based on what the recipe required. Additional functionality such as increasing and decreasing quantities of each ingredient via buttons was also added. This code was tied back in with the previously written code so ingredients of the specified quantities would be pumped when the user selected the make drink button. I kept playing around with different tkinter functions until I found a color scheme and layout I liked.

Here’s a video of a test of the GUI using an early version of the BarBuddy enclosure!

Step 2: Circuit Diagram

The code for the BarBuddy is written to control a series of relays that control some diaphragm pumps. There are some other components included to act as checkouts and safety features for the code:

  • A limit switch below the drink platform is checked by the code once a recipe is selected. If the switch isn’t triggered then the code will loop when the popup is dismissed until the switch is triggered to ensure the machine isn’t just spilling ingredients onto itself.
  • A latching toggle button is used between the power supply and the pumps. This serves as an emergency stop incase something stops working and the pumps need to be stopped.
  • The input voltage of 12V is converted to two 5V lines. One powers the Raspberry Pi while the other powers the pumps. I found previously that a single 5V line between these two purposes would have issues and the Raspberry Pi would malfunction or the pumps wouldn’t have enough power to dispense anything.

The circuit diagram above shows the pinouts on the Raspberry Pi 3B+ board as mapped in the software. Not shown is the touchscreen which connects to the Raspberry Pi via the USB and HDMI cables that came with it. I also was noticing power issues for the touchscreen when a drink was being pumped, so I split the 5V power line going to the Raspberry Pi to also go to the touchscreen (in addition to getting power from the USB connections to the Raspberry Pi). You may or may not need to do something similar depending on which touchscreen you use and the power requirements it has.

Step 3: Prepare the Bottles

As mentioned previously, I chose to go with some condiment bottles to hold all the ingredients. I’m using both 8oz and 16oz versions, but feel free to use different sizes. I chose these bottles initially since the lids work well for connecting to the tubing that goes to the pumps. The initial plan was to mount them upside down for easy install in the machine and to maximize ingredients, but I found this was difficult since the bottles would tend to leak when turned upside down.

I chose to pivot by modifying the bottle lids instead so they can be mounted right-side up. This involved using some plastic barbed fittings I ordered from McMaster (link) that would easily connect to the tubing. I cut off the spouts for each lid so the barbed fittings would fit in, then sealed them in place with hot glue. There’s then a small section of tubing within the bottle that is used to actually pump out the ingredients.

A future version of this design would use some sort of valve to allow mounting of the bottles upside down. I’m imagining something like what’s used in a humidifier or coffee machine water reservoir tank where a spring holds the valve closed. Once the bottle is installed, the spring is depressed which opens the valve for pumping.

Step 4: Cut Enclosure

My current iteration of the BarBuddy uses laser cut panels so I could quickly prototype the layout I wanted. This is reflected in the images in the next step, however I have also designed a version of the enclosure that can be cut out with basic woodworking tools as well since not everyone has access to a laser (attached images show how they would assemble, previous step shows labels and sizing of parts). Both enclosure styles are preliminary and still going through design iterations, but the described parts should be good enough (I haven’t actually built this version of the enclosure yet) for basic mounting and hiding of all the components in a similar manner to my BarBuddy.

You can also create your own enclosure based on your BarBuddy configuration and personal constraints. If you take this route you should consider the following:

  1. Include space to hide all the electronics and pumps. I chose to also hide the ingredients in the back too but you can leave them in the open or pump directly from the bottles too with long enough hoses.
  2. Keep the electronics separate from the liquids to avoid fire hazard or other dangers. In the current iteration of the BarBuddy I have all the electronics in the upper section behind the screen and all the ingredients and pumps in the back of the unit. There is also an acrylic shield where the tubes enter the electronics section just in case anything leaks.
  3. Make sure the enclosure materials used are liquid proof where needed to ensure the unit doesn’t break down over time if things leak. I chose to use laser cut acrylic in some areas but it could also be possible to use wood with a polyurethane coating or something similar.
  4. Make sure to include easy access to the ingredients if they are enclosed. They will need to be filled or swapped out eventually so you don’t want this to be a hassle.
  5. Think about how the enclosure can be taken apart if needed. In my case, I had to replace a few of the pumps as they just stopped working over time. This led me to moving them to their current position where I can easily troubleshoot and replace them as needed.

Step 5: Assemble Enclosure

With the code out of the way I next had to figure out how to house everything together into a single unit that wouldn’t look too out of place in our kitchen. I used other kitchen appliances as inspiration, specifically coffee makers, until I came up with a design I liked. This took several iterations, but I finally came up with an idea that hid all the ingredient bottles and electronics. Here’s a description of different designs I iterated through when figuring out the housing:

  1. Small enclosure only hold electronics and would pump ingredients directly out of bottles (first few images). I wasn’t a big fan of this since it looked out of place on the counter and didn’t seem aesthetically pleasing to me. I also wanted to transfer ingredients into another container rather than pump out of what they come in. Good for a quick prototype to get everything setup and confirm the coding works first though.
  2. Pumps located below the bottles (not shown). The issue I found here was it was hard to troubleshoot the pumps if they didn’t work. The pumps were then moved to their current position in the bottle cavity where the wiring and tubing is easily accessible.
  3. Bottles upside down for easy loading (not shown). The issue I found here was the bottles were hard to load in place and would leak pretty easily. The bottles were flipped right side up so they could be loaded without leaking.

The images in this step show some of these old iterations along with the latest iteration for reference. I had designed the enclosure pieces to be cut out using my CO2 laser, however if you’re following along you should be able to follow the previous step to make an enclosure using simple woodworking tools. Make sure to not permanently attach components on the first try as you may need to take things apart and make modifications while building. I recommend using screws to start.

At this moment I’m working on a new iteration of the BarBuddy that will be easier to build and for others to follow along. I don’t currently have an ETA for when this will be complete, but stay tuned if that’s something you’re interested in. For the time being, I’m hoping the information included herein will be enough for someone to make their own version of the project.

Step 6: Prewire Pumps

It’s recommended to wire up the pumps before installing them in the structure. Most DC pumps should have a +ive and -ive contact. Make sure you know which one is which prior to attaching the wires otherwise you may not get any pumping action. Using different colored wires for each one is helpful for troubleshooting later if things aren’t working. It’s also beneficial to label the pumps now (1-8) so you know which one will be referenced by each ingredient later on in the code.

Step 7: Install and Connect Electronics

It’s important to keep the electronics away from the ingredients to avoid risk of shock, fire, or damaging of the components. I chose to locate everything in the front of the machine behind the screen and above where the ingredients are pumped out. Make sure the electronics are accessible for troubleshooting and reference the circuit diagram above for necessary connections. I would also recommend to add some sort of ports on the side of the electronics section to easily access the Raspberry Pi if needed.

Step 8: Route Tubes and Load Ingredients

Cut and route the tubes from the ingredient bottles and into the input side of each pump. The tube from the output side of the pump should route through the center panel and through the electronics base above the drink platform. It’s not entirely necessary, but I also made a acrylic box to shield the tubes as they pass through the electronics compartment. This prevents shock, fire or damage in the unlikely event that the tubes break or leak.

Step 9: Enjoy a Cocktail!

After over 3 years of on and off development, I am happy to show off the BarBuddy DIY Cocktail Maker! So far I’m happy with how the BarBuddy has been functioning and it definitely gives lots of drink options for our guests. Even if we don’t have all the ingredients loaded it’s been helpful to have a list of recipes easily accessible as a jumping off point to take some at home cocktails to the next level. At some point I may even decide to offer the BarBuddy as a DIY kit (or maybe a finished product?) so other makers can create their own personal cocktail machine at home.

BarBuddy test video 1

BarBuddy test video 2

BarBuddy test video 3

Step 10: Possible Improvements

As an engineer, I find that once I finish a project I am always looking for ways to improve a design, and the BarBuddy is no exception. I’m fairly happy with how the code itself works, but I already have plans for how to improve some of the other components. For starters, the DC pumps used aren’t the best quality and I’ve already had a few burn out and stop working. Switching from diaphragm pumps to peristaltic pumps would likely increase the cost a little, but would also bring some better quality. I also run the machine off a Raspberry Pi 3 B+ since that’s what I had on hand. I’ve noticed that these days this particular board is hard to find, so in the future I’d like to see if there is a cheaper option available since all I really need to do is control some relays and display a GUI. Adding on to this, it might be possible to host a web server where the GUI itself lives, so the user can connect to the machine via Bluetooth or a local website to select their drink that way (maybe even Alexa controlled??). This would also cut down some costs by removing the touchscreen, also allowing the unit to shrink in size.

The last update I can think of now is to figure out a way for the bottles to be better connected to the pumps. Right now I’m using condiment bottles and some flexible tubing but I’m not sure how these components would hold up over time. I’d also like to have some way for the bottles to be loaded into the machine upside down, but need to figure out some sort of valve to prevent leaking. Doing so would decrease the amount of tubing needed and make the machine look cleaner under the hood.

If you made it this far, thanks for reading about the BarBuddy! This project is in no way finished, so if you have any ideas or questions feel free to leave it below!

Leave a Comment

0
    0
    Your Cart
    Your cart is empty