How I made an Arduino cocktail machine

By Sven Kroesen. Posted

Around a year ago, I bought an Arduino Uno after fiddling around with them at college for a few weeks. I already owned a 3D printer, so this seemed like a great addition to the hobby. After completing a couple of simple projects, it was time to try something more complex. On the weekends, I enjoy making cocktails for myself and my friends. A Long Island iced tea has always been our favourite, but with six ingredients, it’s quite a hassle to make.

So I thought, why spend a few minutes making a drink when you can spend a few months automating it? So I did.

The machine

In essence, the cocktail maker is simply seven peristaltic pumps controlled by an Arduino Nano, on which all the recipes are stored. These peristaltic pumps are super-handy components that allow you to accurately dose liquids without them coming in direct contact with the pumps’ mechanism. When you know the amount of liquid that is pumped through per unit time, it’s very easy to use delays in your code in order to pour drinks accurately.

Previous projects of mine have always exclusively used 3D-printed parts and off-the-shelf components. Because I wanted to try something new this time, and since it would turn out to be so big, I had the biggest parts laser cut. Doing so helped give the machine a much nicer look. In addition, LED rings hidden under the bottles and glass finish the machine’s look.

My goal was for anyone that comes over to be able to use the machine without assistance. So, controlling the machine had to be very simple. For this reason, the only way to interact with it is by using the rotary encoder that’s placed under the TFT display. When the cocktail maker is turned on, this screen immediately displays a list of available recipes. Using the knob, the user can navigate through the different drinks, change what bottles are stored, and access various machine settings. Telling the Arduino which bottles are stored as well as their locations helps it determine if all necessary ingredients are present to make a cocktail. If that is not the case, the cocktail is greyed out in the menu. It can still be prepared, but the missing ingredient will be omitted.

To make a drink, the user simply pushes the button with their drink of choice selected. A list of ingredients is then displayed on  the right-hand side of the screen and the user is asked to confirm their choice. The next step is to input the strength of the cocktail and the amount of ice desired. At 50% strength, a regular drink will be prepared. At 100%, your drink will not contain any mixers. 0% is the same thing but for the alcoholic parts. The ice selection bar works similarly, where at 0%, your drink will not contain any ice. Any higher and the amount of ice will also increase. When both choices are confirmed, the preparation of your cocktail will start. The screen automatically updates to let you know how much liquid is still left to pour. When everything is done, the machine lights up and you can take your finished cocktail!

Build process

During this project, I used two new techniques to put everything together, which turned out to be extremely helpful. The first is the aforementioned laser-cutting of wooden and plastic panels. I had never done this before, but I heard it was possible to order them online, so I decided to give it a try. If you want to follow along with this project, I assume you already have some knowledge of basic CAD design. For laser cutting, all you need is a 2D projection of your design which you can turn into a DXF file with any modelling program.

All I had to do after that was upload them on the website of a local laser cutting place and wait two weeks. It turned out to be surprisingly cheap, too. Numbers are relative, but all together, it was cheaper than the sum of the electronic components. To keep this price down, it helps to design the parts in such a way that they fit snugly next to, or even within, one another. This way you can cut them all out of one big piece. The cocktail maker is cut out of two such panels: one made out of a reflective black plastic, and another made from wood. These parts don’t only look nice, but they also provide rigidity to the structure. On their own, they cannot be held together, though. In order to do this, I tried another new technique.

Brass inserts. These little things allow you to put metal taps into your own 3D-printed objects, which is very handy. At first, I tried to simply use tiny nuts and bolts with brackets in the corners, but the further along the build got, the harder it became to reach in certain places, making it necessary to try a different technique. Using the inserts is very easy if you have a soldering iron handy. If you’re going to copy this project, you will probably need one anyway. To use them, simply put circular holes in your designs that are just snug enough. Put the insert on the top of a heated soldering iron and slowly press it into place, making sure no plastic gets on the inside. After the plastic solidifies around it, it will be as strong as the plastic it’s placed in, which should be plenty for this application if you use the right materials and density for your 3D prints. I like 30% in this case. Doing this for all components makes assembly surprisingly simple, as you only have to screw them in place. Even allowing you to make a frame to put all electronic components in instead of using a PCB.

The mechanisms

Effectively, the machine consists of three parts: the pumps, the ice mechanism, and an electronics rack hidden in the back. We’ll talk about the pumps first.

As explained earlier, they are called peristaltic pumps. Instead of turbine-like mechanisms used in many other types, these pumps sort of squeeze the liquid through a flexible PTFE tube. This ensures the fluids never come into contact with anything but those tubes. For this reason, it is perfect for transporting liquids intended for consumption and is, for example, commonly used in medical devices. Starting out with this project, I ordered six of these pumps from China. Since it usually takes a while for the parts to arrive, I try to buy everything I will need in one go. Sometimes, unfortunately, this means a part doesn’t work exactly as expected. In those cases, I still try to make the best of it. For this project, the pumps I ordered turned out to be a little slow when pumping. A large glass needed almost a minute to completely fill up using two pumps, which was too slow for my needs. As a solution, I decided to order a different type of pump that is much faster. Since most cocktails have one dominant ingredient, this faster pump can be used to speed up the whole process. Often this ingredient is Cola. The pumps are all mounted in a 3D-printed rack in the top of the machine. A gap is left open so the new seventh bottle can be stored inside the machine.

This seventh bottle is used by the faster pump and should be for the primary ingredient in most cocktails. It is a bit of a mess, but this inner container can also store some ice to keep the bottle cool and for putting in your drink. To achieve this, a so-called Archimedes screw is used. This mechanism lets you vertically lift up small objects or, in certain designs, even liquids. We are using it to lift up ice cubes through the gap that leads to the glass. The ice cubes do have to be small enough to prevent jamming the screw.

Working with cooling elements was a little out of reach for this project, so I decided instead to just let the ice slowly melt. All cracks in the interior are covered up with a food-safe resin to prevent leaking, except for a tiny hole under the Archimedes screw. From here, the water leaks through another PTFE tube to the back of the machine. Here, you can either let the water leak away or redirect it to a basin/sink with another tube.

All of this is controlled by a single Arduino Nano. The recipes are stored in a struct data type, with each the name of the drink, references to all ingredients, their volumes, and whether it contains alcohol or not. This last characteristic is necessary to adapt the recipe to the user’s alcoholic strength preference. When a drink is selected, the Arduino gets to work. Because we are using peristaltic pumps, we know exactly how much liquid flows every second when they are powered on. By simply dividing the required amount according to the recipe by this number, we know the number of seconds each pump should run for. These pumps, together with the motor for the screw, are controlled through eight relays.

To know which pumps to turn on, we first have to tell the Arduino which ingredients are present and where they are placed. Before we select a recipe, we can input this data by going to a special menu where you first select one of the seven platforms and then one of about 30 pre-installed ingredients. This data will be stored even when the machine is turned off, thanks to EEPROM.

Even when not all ingredients are present, the Arduino will find all corresponding pumps and turn them on for the number of seconds we calculated earlier. All seven tubes are individually led to the console in the front. I attempted to connect them all together in one single bigger tube but this caused a lot of back-flow and leaking. There are purpose-built connectors to achieve this, but at this point, I was nearing the end of the project and I did not intend on spending any more money on it. It is also not recommended to 3D-print such components. 3D-printed objects are inherently not food-safe because of the tiny cracks that exist on their surfaces. These spaces allow bacteria to hide away and are very hard to properly clean. Or even impossible when it’s hidden inside a machine. So, in this case, I preferred my ad hoc solution.

The remainder of the electronics are very simple. The pumps and screw motor all need 12 volts. With a maximum of 2 amps, this is supplied by a simple power supply. Since the microprocessor needs no more than 5 volts, this is stepped down first. This power is also used to power the NeoPixel rings in the platforms and the display on the front. I am still very much learning about electronics, so in my projects, I like to use screw terminals. These allow you to change and adapt as you go while still giving rigid connections.


Altogether, making this machine has been a great learning process. Laser cutting seems like a viable tool if your design is large enough since you usually have to pay for the whole sheet. In our case, some leftover space was used to cut out a door sign with mine, my girlfriend’s and, of course, the cat’s name engraved into the surface. After weeks, the cocktail maker still works beautifully. Soft drinks come out a little flat and ice unfortunately does melt, but I had a ton of fun building it, and Long Islands are, of course, very tasty!

From HackSpace magazine store


Subscribe to our newsletter