Cocktail Machine
By Rob Zwetsloot. Posted
A robotic bartender that can make cocktails to order?
What’ll it be? Monkey wrench, swimming pool, zombie, painkiller? You can have any of these exotic drinks and more mixed by Stefan Höving’s home-made cocktail machine, whose secret ingredient is a Raspberry Pi.
This article first appeared in The MagPi 70 and was written by Nicola King
Bioengineering student Stefan came up with the idea for automated cocktails thanks to a friend who “would always pour way too much alcohol into the drinks when we would get together on the weekends… We basically needed something that can ensure that everyone always has the same composition of juice and booze, that would still be enjoyable.”
Stefan was also looking for a project to practise his fledgling Python programming skills, learned during his part-time job at an analytical institute. “The first thing I had to do was program a graphical user interface in PyQt for a temperature control system,” he recalls. While that never came to fruition, the GUI would eventually be put to good use in his cocktail machine, which offers a choice of nine drinks via a touchscreen display.
Tubes and valves
Housed in a handcrafted hexagonal wooden case, the cocktail machine holds five bottles. Each is fitted with a shot dispenser with two tubes: air is pumped through one tube to force liquid up the other, which leads to a magnetic valve to turn the flow on or off. “From there, all five tubes (one for every bottle) are funnelled into the outlet that one can see above the glass,” explains Stefan.
To ensure the correct volume measures are poured out, the platform where the glass is placed is a scale. “The first thing the program does after a cocktail is selected is [discount] the weight of the glass. I was surprised by how precise the scale actually is.”

It did cause Stefan a headache during development, though. “For some reason, [its HX711 ADC] chip would produce random and really off values, although there was nothing on the scale. This would only happen when the machine was completely assembled. I reassembled the machine three times until I understood this behaviour.” In the end, the annoyingly simple solution was to connect the VCC of the HX711 to 3.3 V power instead of 5 V.
Pumping air
Stefan also had a problem with the original aquarium air pump, which worked fine with one bottle but couldn’t produce enough pressure to displace liquid from all five. “The gas volume of the five bottles combined was simply too high. So I got myself a bigger pump and it worked.”
The air pump, magnetic valves, and LED lighting are controlled by an eight-channel relay board connected to the Raspberry Pi via a PCB with resistors. “For making easy connections, I soldered them and some plugging connectors to a PCB board. So I have easy access for maintenance purposes.”
Equipped with bottles of rum, vodka, cola, orange, and pineapple, the machine can produce nine different cocktails using the recipes within the Python code – available from Stefan’s GitHub repo – but it could easily be adapted to produce other drinks, including non-alcoholic ones. “For new cocktails, you would have to adjust the ratios in the code accordingly.”
Dispensing liquid from each required bottle in turn, from the smallest to largest volume, helps to mix them in the glass. “A mechanical way of stirring might be possible,” says Stefan. “However, I have not come up with an elegant solution so far… I am open to any suggestions.”
Rob is amazing. He’s also the Features Editor of Raspberry Pi Official Magazine, a hobbyist maker, cosplayer, comic book writer, and extremely modest.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Make your RAM go further – Raspberry Pi OS memory optimisation tips
In issue 164 of Raspberry Pi Official Magazine we have been playing around with the new Raspberry Pi 5 1GB RAM. While the RAM shortage caused by the demands of AI infrastructure is annoying beyond belief, this has been a great chance for us to really get to grips with RAM. Generating images in Stable […]
Read more →
Mighty Projects – 1GB Computer in Raspberry Pi Official Magazine 164
It’s normal for computers to get faster and more pwerful, but the new-ish Raspberry Pi 5 1GB is a step in the other direction: it has all the processing power and the same GPIO pins of its more costly siblings, but with only 1GB of RAM it’s at a price that’s friendlier on the wallet […]
Read more →
Win one of five 256GB Raspberry Pi Flash Drives
If you’ve been around long enough, you know that every Raspberry Pi accessory is top quality, and the latest Flash Drive is no different. Fancy a big one? We have five up for grabs, and you can enter below… Win 1 of 5 256GB Raspberry Pi Flash Drives
Read more →