A Raspberry Pi-powered robotic bartender



People ask me why I built a drink-mixing robot (aka the drinkbot).

The better question: Why wouldn’t I build one?

This project originally started as an exercise in learning about the Raspberry Pi 3 Model B Motherboard and Nodejs.  I came across a similar drink-mixing project called the Bar Mixvah and was inspired to build my own with more features and a different system architecture.  I borrowed the idea of using peristaltic pumps and the design for the pump control circuit, but all other components (including the nodejs code) use my own design.

This article isn’t meant be a complete tutorial on how to build one. I’ve documented just enough here to avoid forgetting too many details about it.  I make no guarantees and take no responsibility for whatever happens if you try to build this yourself.


  • The frame was built from mainly scrap aluminum. I had to machine a few of the parts.
  • Some of the electronics come from old stuff pulled from a parts bin.
  • Controlled by a Raspberry Pi computer.
  • You select your drink from a web page.
  • Supports up to six liquid ingredients, using six peristaltic pumps powered by a 12V DC motor. Ingredients can be layered or mixed.
  • Avoids big messes by only pumping when a cup is present.
  • It talks! It announces the drink it is making and occasionally tells jokes.
  • Maintenance mode for cleaning and pump priming
  • Blinky LEDs

Video Demo

High Level System Design

The hardware system consists of several circuit boards, noted below.  This makes the system modular and allowed easy testing of components in isolation.  The various boards all plug into a central connector board to make wiring easier.  That connector board took a while to design and solder but the convenience of easy connections later made it worthwhile. Being able to use these components in other projects later is a bonus.

Pump Controller Circuit

The pump controller is essentially a motor controller circuit that supports up to six 12v motors. TIP120 transistors drive the pump motors. Perhaps I’ll try mosfets in a future version and see if there’s any performance difference.


Parts List:

12V DC Peristaltic Pumps6Pumps liquid from the ingredient containers (i.e. liquor bottles) through food-safe tubing to the cup/glass. These come with some tubing but it's too small and can't be sure it's food-safe. It is replaced with the tubing mentioned below.
Tygon B-44-3 PVC Beverage Tubing, 1/8" ID, 3/16" OD, 1/32" Wall, 25' Length, Clear1Food-safe tubing that carries liquids through the pumps. This is the only thing that comes into contact with the liquid. There should be a length of tubing for each pump, long enough to run from the bottle of the ingredient container (i.e. liquor bottle) to the cup/glass.
2.2K Resistors (R1 - R6)6Limits current into the transistors that drive the motors
TIP120 TO-220 Darlington Transistors (Q1 - Q6)6Switches the current to the motors on and off.
1N4004 Diodes (D1 - D6)6Serves as flyback diodes. When the pump motors turn off, their magnetic field collapses, sending a voltage spike back through the circuit. These diodes prevent those voltage spikes from damaging the other components.
12-pin female header (SV1)1Provides power and ground connectors for each of the 6 pump motors.
7 pin female header (SV2)1Six pump control inputs from the Raspberry Pi via the connector board, plus the common ground connection. The schematic above doesn't show a seventh pin for the ground, but it's there.
DC Power Barrel Jack (J1)112V input
0.1uf capacitor6These are not shown on the schematic, but one is soldered across the terminals of each pump motor to reduce electrical noise. My surrounding electronics were behaving strangely while the motors were running until I added these.

These capacitors really help reduce electrical noise.  The motors are still pretty noisy.

Audio Amplifier Circuit

The Raspberry Pi’s audio output plugs into this amplifier circuit, which is based on a LM386N-1 amplifier chip. An LED flashes with the sound.

The LED, driven by a transistor, is connected in parallel to the speaker, with the audio signal entering the transistor base. This makes the LED brightness proportional to the audio signal strength. It’s sort of a like a volume unit (VU) meter with just one “unit”.

This amplifier takes 9V, so a linear voltage regulator steps down the 12V input to 9V.


Parts list:

LM386N-1 (IC1)1Audio amplifier chip. Amplifies the sound from the Raspberry Pi using a single channel.
10 uf capacitor (C2)1Sets the gain of the LM386 to the maximum, at 200 (24 dB) per the datasheet.
220uf capacitor (C1 and C3)2Noise reduction.
4.7uf (C4)1Bypass capacitor.
10K Audio Potentiometer (R2)1Volume control knob.
.05uf capacitor (C5)1
1N415 Diode (D1)1Creates a small voltage drop that makes LED1 flashes slightly less sensitive.
1K Resistor (R3)1Limits current into the Q1 transistor base.
NPN2222A Transistor (Q1)1Drives and switches LED1.
200 ohm resistor (R4)1Limits current into LED1.
Blue LED (LED1)1Flashes with the audio signal. You can use another color if desired.
4ohm 3W Speaker (SP1)1Speaker for the audio.

Note:  Parts IC2, C6 and C7 are actually part of the power distribution/voltage regulator circuit below so they aren’t listed in this audio amp parts list.

Power Distribution/Voltage Regulator Circuit

Warning! Electricity is dangerous! Since this circuit involves a power brick that plugs into a wall outlet, it’s the most dangerous one on this page. Do not attempt this unless you really know what you’re doing. I take no responsibility for whatever happens if you try it.

With that said…

Powering this whole thing from one power brick is more convenient than using a separate power supply for each circuit, so I added this power distribution board. This takes 12V DC as input from a 12V 6A power brick and provides the following output voltages:

Why 12V at 6A? Each pump requires 12V (the maximum voltage requirement of all components), and the whole system draws about 2-3A when all pumps are running simultaneously (each pump draws about 300ma when running), so 6A seems to work. The Raspberry Pi gets up to 2.5A of that (provided by the 5V/2.5A buck converter) of that so there’s some extra room in that 6A for initial high load from the motor startup plus the other electronics. So far so good.


Parts List:

DC 12V 6A Power Adapter1Powers the whole thing.
DC Barrel Jack (J2)112v input from a power brick.
5-pin female header (SV1)1A 5V 2.5 Pololu Buck Converter plugs into this to provide a regulated 5v output for the Raspberry Pi.
Double-pole double-throw (DPDT) switch (S1)1Used to turn off the 12v and 9v power. Acts as sort of a "kill switch" for the pumps and audio. It doesn't turn off the Raspberry Pi, since simply killing power to it can cause data corruption. A button on a separate circuit gracefully shuts down the Raspberry Pi.
1k 1/2 watt resistor (R1)1Limits current into the power indicator LED (LED1).
Red LED (LED1)1Power indicator light
L7809CV 9V voltage regulator (IC1)1Steps down the 12v input to 9v for the audio amplifier circuit.
0.3uf capacitor (C1)1Required for the 9v output per the L7809CV datasheet.
0.1uf capacitor (C2)1Required for the 9v output per the L7809CV datasheet.

LED Panel Circuit

Although interaction with the drinkbot is mainly via its web page, it’s nice to have some visibility on status on the bot itself. So we have a little panel with some status LEDs:

  • Green – Stays lit when ready to start pumping.
  • Yellow – Blinks when a cup is missing (i.e. the cup switch is open)
  • Red – Blinks when it is making a drink
  • White – Blinks when in maintenance mode

There’s also a momentary pushbutton switch that gracefully shuts down the Raspberry Pi.


Parts List:

Green LED (LED1)1Indicates a "ready" status when lit.
Yellow LED (LED2)1Blinks when a cup is missing/cup switch is up.
Red LED (LED3)1Blinks when pumping.
White LED (LED4)1Blinks when in maintenance mode.
330 ohm resistor (R1-R3)3Limits current into the green, yellow and red LEDs.
1K resistor (R4)1Limits current into the white LED. This draws more current than the other colors so more resistance is needed here.
Momentary pushbutton switch (S1)1Gracefully shuts down the Raspberry Pi.
10K resistor (R5)1Pulldown resistor for the pushbutton switch.
5-pin right-angle male header pins (JP1)1Connector for the LEDs. Connects to the connector board.
2-pin right angle male header pins (JP2)1Connector for the pushbutton switch (S1). Connects to the connector board.

Connector Board Circuit

I needed a way to connect all of the other boards to the Raspberry Pi. A connector board acting as a central hub or backplane for everything makes this much easier. I used a piece of strip board and designed it using Fritzing since it offers a strip board component.

It turned out that I needed to include some more resistors and a capacitor, and putting those on this board was easier than trying to cram them onto the other boards.

Board layout and wiring:
The strip board works well here since we can place all the connectors parallel to each other.

Parts list:

2-pin Male Header (JP1 and JP2)2Connectors for the cup switch and shutdown button
5-pin Male Header (JP3)1Connector for status LEDs.
7-pin Female Header (JP4)1Connector for the pump controller board
20-pin Female Header (JP5 and JP6)2Connectors for the Raspberry Pi's cobbler connector and ribbon cable.
1K Resistor (R1 and R3)2Limits current into Raspberry Pi's GPIO pins from the cup detection and shutdown switches.
10K Resistor (R2)1Pulldown resistor for the cup detection switch.
0.1uf Capacitor (C1)1Noise reduction for the cup switch. This makes the readings of the cup switch position more reliable.

The Software

Like the Bar Mixvah, I’m using the MEAN middleware stack, which consists of:

M – MongoDB, A database system that stores drink recipes, drink orders, and some settings.
E – ExpressJS, a web development framework for nodejs
A – AngularJS, a front-end HTML templating system for nodejs
N – Nodejs, a server-side Javascript framework.

These are installed on the Raspberry Pi, which serves the web page allowing control of the system. There are other ways to do this, but it works.

Sitting on top of all of this are two main components, written in nodejs:

  1. The front-end: The actual web page allowing control. Open a web browser and point to the Raspberry Pi’s IP address to get to the drinbot’s user interface.
  2. The back-end: Polls for requests coming in from the front-end, detects button and switch presses and controls the drinkbot’s pumps and LEDs via the Raspberry Pi’s GPIO pins.

The text-to-speech is done with pico2wave.

The code and more details can be found on the github project at https://github.com/upperboundcom/drinkbot

Future improvements

Like with any other hobby project, there’s room for improvement. For whenever I get to it:

  • Add a page for managing the list of ingredients and assignments to pumps.
  • Refactor the code to avoid database polling for orders (yeah, I know that’s an anti-pattern).  Maybe use a queuing model with MQTT instead.
  • Add a built-in LCD screen so you don’t need a separate phone or tablet, or even a Wi-Fi connection. This would mean redesigning the front panel. I have one of these Raspberry Pi 7″ Touchscreen Displays but haven’t had a chance to try it with the drinkbot yet.
  • Build real enclosures for the circuit boards.
  • Maybe consolidate some of the circuitry onto fewer boards, and make actual printed circuit board (PCB) layouts instead of hand-soldering the whole thing on protoboard.
  • Wire the cup detection switch such that the motors don’t run unless it is pressed, instead of relying only on the software.
  • Make the audio amp less electrically noisy.