Skip to content

About

Tell it what's in your liquor cabinet, it asks an AI for a cocktail, then pours it through peristaltic pumps. Judges your ingredient choices silently.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cocktail Machine

An automated cocktail dispenser powered by an ESP32-S3, up to eight peristaltic pumps, and a Groq AI backend. Users connect to the machine via a self-hosted web interface, input available ingredients, and receive AI-generated cocktail suggestions tailored to exactly what they have on hand. Selections are confirmed via onboard buttons and dispensed automatically with real-time LCD feedback and glass-type imagery loaded from SD card.

The system is designed around a modular motor driver architecture — each custom TB6612FNG PCB drives two pumps, and up to four boards can be chained together to support up to eight pumps total. The current firmware configuration drives four pumps across two boards, all connected to a central ESP32-S3 carrier board.


Table of Contents

Section Description
Machine Render 3D render of the full enclosure
PCB Overview Carrier board and motor driver board renders and schematics
Project File Structure Folder and file layout
System Overview Architecture diagram
Features Full feature list
Hardware Component descriptions
Pin Connections ESP32 GPIO assignments for LCD, motors, and buttons
Software Dependencies Required Arduino libraries
Configuration WiFi, API key, and flow rate calibration
SD Card Setup BMP image requirements and conversion
Operation Flow Step-by-step usage guide
Groq API Limits Free tier request and token budgets
BOM Full bill of materials

Machine Render

Machine Render


PCB Overview

ESP32-S3 Cocktail Carrier Board

The main carrier board hosts the ESP32-S3 WROOM module in the center, with four TB6612FNG motor driver sub-boards mounted in the corners — one per two pumps. Power input, bulk capacitance, and pin headers for the LCD and buttons are also on this board.

Cocktail Carrier PCB — KiCad 3D Render

Cocktail Carrier PCB — Full Render

KiCad files: PCB/Cocktail_PCB.kicad_pcb, PCB/Cocktail_PCB.kicad_sch, PCB/Cocktail_PCB.kicad_pro


TB6612FNG Motor Driver Sub-Board

A compact self-contained dual H-bridge driver board. Each board drives two peristaltic pumps and includes local decoupling capacitors, a power indicator LED, and pin socket connectors for motor outputs, control inputs, and power. Boards are panelized for cost-effective fabrication at JLCPCB.

TB6612FNG Motor Driver — PCB Render

KiCad files: PCB/TB6612FNG.kicad_pcb, PCB/TB6612FNG.kicad_sch, PCB/TB6612FNG.kicad_pro


Project File Structure

cocktail_machine/
├── cocktail_machine.ino         # Main Arduino sketch
├── README.md                    # This file
├── BOM.md                       # Bill of materials
│
├── PCB/
│   ├── Cocktail_PCB.kicad_pcb  # Main carrier board PCB layout
│   ├── Cocktail_PCB.kicad_sch  # Main carrier board schematic
│   ├── Cocktail_PCB.kicad_pro  # Main carrier board KiCad project
│   ├── Cocktail_PCB.png        # Main carrier board 3D render
│   ├── PCB.PNG                 # Full system PCB render
│   ├── TB6612FNG.kicad_pcb     # Motor driver sub-board PCB layout
│   ├── TB6612FNG.kicad_sch     # Motor driver sub-board schematic
│   ├── TB6612FNG.kicad_pro     # Motor driver KiCad project
│   ├── TB6612FNG.png           # Motor driver board 3D render
│   └── TB6612FNG_Sch.png       # Motor driver schematic screenshot
│
├── 3DModel/
│   └── machinerender.PNG       # Full machine enclosure render
│
└── sd_card/
    ├── start.bmp
    ├── highball.bmp
    ├── martini.bmp
    ├── rocks.bmp
    ├── champagne.bmp
    └── mulemug.bmp

System Overview

User's Phone/Laptop Browser
        ↕ HTTP (AsyncWebServer on ESP32)
ESP32-S3 (WiFi access point + web server)
        ↕ HTTPS (Groq Cloud API)
Groq LLM (llama-3.3-70b-versatile)
        ↕ parsed JSON recipe data
Motor Driver Boards (TB6612FNG ×2, expandable to ×4)
        ↕ H-bridge direction control
Peristaltic Pumps ×4 (expandable to ×8)
        ↕
Drink in glass

Features

  • AI-generated cocktail suggestions — powered by Groq's Llama 3.3 70B model, running on custom LPU hardware for near-instant inference
  • Up to 20 cocktail suggestions per query, strictly based on available ingredients
  • Strict recipe accuracy — AI cross-references authoritative recipes and never silently drops required ingredients
  • Mocktail support — suggests adapted recipes when exactly one ingredient is missing, with a clear substitution note
  • Proportional volume scaling — user can adjust total cocktail volume and all ingredient ratios scale automatically
  • Custom pour mode — manually dial in ml per pump without any AI involvement, useful for testing or simple pours
  • Real-time LCD feedback — per-ingredient dispensing screens with animated progress bar
  • Pause/resume dispensing — BTN3 pauses the active pump mid-pour, BTN2 resumes exactly where it left off
  • Cancel dispensing — hold BTN1 for 3 seconds during dispensing to abort and return to idle
  • Glass type imagery — loads a matching BMP image from SD card based on the AI's glass recommendation
  • Pump confirmation screen — before dispensing, LCD shows the full pump assignment layout so the user can verify the correct bottles are loaded
  • Expandable to 8 pumps — motor driver board design supports up to 4 boards (8 pumps) driven from a single ESP32-S3
  • Power indicator LED — on each motor driver board, lights whenever the 12V motor rail is live

Hardware

Main Controller

  • ESP32-S3 WROOM dev board — dual-core Xtensa LX7 at 240MHz, 512KB SRAM, 4MB flash, integrated 2.4GHz WiFi. Runs the web server, Groq API client, LCD driver, SD card reader, and pump control concurrently using FreeRTOS.

Display

  • 2.8" ILI9341 TFT LCD — 320×240 resolution, SPI interface, 3.3V logic native. Includes an onboard SD card slot used for loading BMP glass images. Driven via hardware SPI on the ESP32-S3.

Motor Driver Boards (×2, expandable to ×4)

  • TB6612FNG dual H-bridge IC in SSOP-24 package. Each custom PCB drives two pumps and is self-contained with decoupling capacitors, power indicator LED, and pin headers. Multiple boards share the same 12V and 3.3V rails. See PCB/TB6612FNG_Sch.png for full schematic.

Pumps

  • 4× peristaltic pumps — 12V DC brushed motors, rated 0.5A peak per pump. Maximum of two pumps run simultaneously. Expandable to 8 by adding two more motor driver boards.

Power

  • 12V USB-PD power supply — negotiates 12V via PD 3.0 / PD 2.0 / BC1.2. 100W supply provides ~8.3A at 12V, sufficient for 4–8 pumps plus system overhead.
  • Sparkfun buck-boost converter — steps 12V down to regulated 5V for ESP32 power input, isolated from motor switching noise.

Buttons

  • 3× momentary push buttons — normally open, internally pulled up. Active low.

Tubing

  • 3m food-safe silicone tubing — inner diameter matched to the peristaltic pump head.

Pin Connections

LCD (ILI9341) + SD Card

LCD Pin ESP32 GPIO
VCC 3.3V
GND GND
CS GPIO41
RESET GPIO40
DC GPIO39
SDI (MOSI) GPIO37
SCK GPIO36
LED 3.3V
SDO (MISO) GPIO35
SD_CS GPIO15

Motor Driver Board 1 (Pumps A & B)

Signal ESP32 GPIO Notes
AIN1 GPIO4 Pump A direction
AIN2 GPIO5 Pump A direction
BIN1 GPIO6 Pump B direction
BIN2 GPIO7 Pump B direction
VCC 3.3V Logic supply
VM 12V Motor supply
GND GND Common ground

Motor Driver Board 2 (Pumps C & D)

Signal ESP32 GPIO Notes
AIN1 GPIO1 Pump C direction
AIN2 GPIO2 Pump C direction
BIN1 GPIO47 Pump D direction
BIN2 GPIO48 Pump D direction
VCC 3.3V Logic supply
VM 12V Motor supply
GND GND Common ground

Buttons

Button GPIO Function
BTN1 GPIO8 Cancel selection / hold 3s to abort dispensing
BTN2 GPIO3 Resume dispensing after pause
BTN3 GPIO18 Pause active dispensing

Expanding to 8 Pumps

Add Motor Driver Boards 3 and 4, wiring their IN pins to available GPIOs. Update pumpOn() and pumpOff() in cocktail_machine.ino to add cases 4–7.


Software Dependencies

Library Source
Adafruit GFX Library Arduino Library Manager
Adafruit ILI9341 Arduino Library Manager
Adafruit ImageReader Library Arduino Library Manager
SdFat — Adafruit Fork Arduino Library Manager
ArduinoJson (by Benoit Blanchon) Arduino Library Manager
AsyncTCP GitHub: me-no-dev/AsyncTCP (install as ZIP)
ESPAsyncWebServer GitHub: me-no-dev/ESPAsyncWebServer (install as ZIP)

Note: If both the standalone SdFat and SdFat-Adafruit-Fork libraries are installed, delete the standalone one. The Adafruit ImageReader requires the Adafruit fork specifically.


Configuration

At the top of cocktail_machine.ino, set your credentials:

const char* ssid       = "YOUR_WIFI_NAME";
const char* password   = "YOUR_WIFI_PASSWORD";
const char* groqApiKey = "YOUR_GROQ_API_KEY";

Get a free Groq API key at console.groq.com

Flow Rate Calibration

#define ML_PER_SECOND 1.31

To calibrate: order a cocktail with a known total volume, measure the actual output, then:

new ML_PER_SECOND = current × (actual_ml / expected_ml)

Example: expected 200ml, got 175ml → 1.31 × (175 / 200) = 1.146

Run several trials and average for best accuracy.


SD Card Setup

Format as FAT32 (Mac: Disk Utility → MS-DOS FAT). Place in the root directory:

Filename Used for
start.bmp Boot screen, idle state, waiting for selection
highball.bmp Highball / Collins glass cocktails
martini.bmp Martini / Coupe glass cocktails
rocks.bmp Rocks glass cocktails
champagne.bmp Champagne flute cocktails
mulemug.bmp Moscow Mule mug cocktails

All images must be exactly 320×240 pixels, 24-bit RGB BMP, uncompressed.

Operation Flow

  1. Power on — SD card initializes, start.bmp loads with "Press Button To Start"
  2. Press any button — ESP32 connects to WiFi, LCD shows connecting → connected → IP address
  3. Open browser — on any device on the same WiFi network, navigate to the IP shown on LCD
  4. Assign ingredients — enter the ingredient in each pump (A–D) and any extras not in a pump (e.g. simple syrup, salt)
  5. Get AI suggestions — Groq returns up to 20 cocktail options with ingredients, amounts, glass type, serving style, and substitution notes
  6. Select a cocktail — tap a card in the browser; confirmation dialog shows full recipe
  7. Pump confirmation screen — LCD shows all four pump assignments; press any button to confirm
  8. Ready screen — glass BMP loads as background with cocktail details; press BTN2/BTN3 to dispense or BTN1 to cancel
  9. Dispensing — each ingredient poured one at a time with animated progress bar
    • BTN3 = pause (pump stops, bar freezes)
    • BTN2 = resume (pump restarts exactly where it left off)
    • Hold BTN1 for 3 seconds = cancel all remaining pours, return to idle
  10. ENJOY! — shown for 4 seconds, then returns to idle waiting state

Custom Pour Mode

Press Custom Pour on the website to skip AI and manually specify ml per pump. Useful for calibration, testing, or simple single-ingredient pours.


Groq API — Free Tier Limits

Model: llama-3.3-70b-versatile

Limit Value
Requests per minute 30
Requests per day 1,000
Tokens per minute 12,000
Tokens per day 100,000

At ~3,800 tokens per request (prompt + 15 cocktail recipes), approximately 26 suggestion requests per day = 390 individual cocktail suggestions. Adding a credit card to Groq (free, no minimum spend) unlocks ~10× higher limits.

About

Tell it what's in your liquor cabinet, it asks an AI for a cocktail, then pours it through peristaltic pumps. Judges your ingredient choices silently.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages