Skip to content

Smart Bartender with Raspberry Pi

Build an automated drink dispenser using Raspberry Pi with pumps, relays, and a touch interface.

  • Raspberry Pi
  • Advanced
  • 180 minutes
  • 5 steps

Shop this project

Cart

Prices from vilros.com. Tax and shipping at checkout.

Before you start, you'll need

  • Raspberry Pi 4
  • 4-6 peristaltic pumps (12V)
  • 4-6 relay modules
  • 12V power supply
  • Silicone tubing
  • Touchscreen display (optional)
  • Drink containers and bottles

Connect relays and pumps

About 45 minutes

Wire relay modules to control pumps.

  1. Connect relay module VCC to Pi 5V, GND to Pi GND.
  2. Connect relay IN pins to GPIO 17, 22, 23, 24 (one per pump).
  3. Connect each pump's positive wire to relay NO (Normally Open) terminal.
  4. Connect relay COM terminals to 12V power supply positive.
  5. Connect all pump negative wires to power supply GND.
  6. Connect Pi GND to power supply GND (common ground).

You should see

All pumps are wired through relays to 12V power.

Test each pump

About 15 minutes

Verify pumps work individually.

  1. Place tubing into water containers.
  2. Create a test script to activate each relay.
  3. Run each pump for 5 seconds to verify flow.
  4. Check for leaks in tubing connections.

You should see

All pumps dispense liquid when activated.

Build the GUI

About 60 minutes

Create a touchscreen interface for drink selection.

  1. Install tkinter if needed: sudo apt-get install python3-tk
  2. Create a Python GUI with buttons for drinks.
  3. Each drink button triggers a sequence of pumps with specific timing.
  4. Add drink recipes (e.g., 'Mojito': pump1=3s, pump2=1s, pump3=2s).

You should see

GUI displays drink options.

Write the bartender logic

About 45 minutes

Program drink recipes and dispensing.

  1. Create the main script with GPIO control.
  2. Define drink recipes as pump/timing combinations.
  3. Implement safety features (max pour time, cleanup cycle).
python
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

pumps = {
    'vodka': 17,
    'juice': 22,
    'soda': 23,
    'lime': 24
}

for pin in pumps.values():
    GPIO.setup(pin, GPIO.OUT)
    GPIO.output(pin, GPIO.LOW)

def pour(pump_name, seconds):
    pin = pumps[pump_name]
    print(f"Pouring {pump_name} for {seconds}s")
    GPIO.output(pin, GPIO.HIGH)
    time.sleep(seconds)
    GPIO.output(pin, GPIO.LOW)

def make_drink(recipe):
    print("Making drink...")
    for ingredient, duration in recipe:
        pour(ingredient, duration)
        time.sleep(0.5)
    print("Enjoy your drink!")

# Example recipe
screwdriver = [('vodka', 3), ('juice', 4)]
make_drink(screwdriver)

Adjust pour times by testing with actual liquids and measuring output.

You should see

The bartender can make drinks automatically.

Calibrate pour amounts

About 15 minutes

Fine-tune pump timing for accurate pours.

  1. Test each pump with measuring cups.
  2. Note how much liquid is dispensed per second.
  3. Adjust timing in recipes for desired amounts.
  4. Create a calibration function to standardize pours.

You should see

Drinks are mixed with correct proportions.

What to do next

Stuck? Contact Vilros Support with your board model and what you see on screen.