My project consists of an automatic cocktail-making machine, based on the Arduino Uno R3 board and equipped with four pumps controlled via relays, an LCD keypad shield for selecting recipes, and a buzzer that signals and enhances the atmosphere with music. My goal was to automate the precise dosing of ingredients to ensure drink consistency and to create an interactive experience. The idea came to me at a party, when I was trying to make myself a drink and couldn't get the proportions right — that’s when I thought it would be much easier if there were a machine to do it for me. I believe the project is useful both for parties and for home bars, offering an interactive and precise way of serving drinks.
Schema bloc
+------------------+ | LCD Keypad | | Shield | +--------+---------+ | v +--------+--------+ | | | Arduino UNO | | R3 | | | +----+-------+----+ | | +-------------+ +-------------+ | | v v +------------------+ +---------------------+ | Buzzer (via NPN)| | 74HC595 (SPI) | +--------+---------+ +----------+----------+ | | | +-----+-----+ | | | | +--+--+ +--+--+ | |Rele1| |Rele2| | +--+--+ +--+--+ | | | | +--+--+ +--+--+ | |Rele3| |Rele4| | +--+--+ +--+--+ | | | | | | | | | | | | v v v +--------------+ +--------------+ +--------------+ | GND | | Pompa YX 1 | | Pompa YX 2 | +--------------+ +--------------+ +--------------+
+--------------+ +--------------+ | Pompa YX 3 | | Pompa YX 4 | +--------------+ +--------------+
Hardware component list:
YX DC12V 385 Pumps (x4)
Relay Modules (x4)
Arduino UNO R3 + LCD Keypad Shield
Buzzer
Switch
Type-C Plug
Perfboard
1. Cocktail Machine Controller setup()
Configures the output pins:
loop() Continuously plays a looped melody in the background (playLoopedMelody()).
Displays and navigates the Main Menu via menu():
Executes drink preparation logic depending on the selected menu page.
Main Menu Navigation: menu() Displays a list of options using the LCD.
Uses analog button input (button_read()) to navigate LEFT/RIGHT and SELECT.
Plays melody during menu interaction.
Sets the menu_page based on user selection:
Predefined Drinks Mode (Page 1) Drink Selection: Scroll through predefined cocktail options:
Uses button input to change selection and confirm with SELECT.
Strength Selection:
Execution: Calls DrinkSelect(choice, strength):
Prompts user to assign pumps for Rum and Coke.
Computes ingredient volumes:
Calls Pump_drive(…) to activate pumps accordingly.
Custom Drink Mode (Page 2) For each pump (1 to 4), user can manually assign volume in ml.
Increments/decrements volume in 20ml steps via button input.
After configuration, calls Pump_drive(…) with custom values.
Melody Control: playLoopedMelody() Loops through an array of notes (melody) and plays them on the buzzer using tone().
Uses millis() for non-blocking delays.
Stops playback if musicOn == false.
Pump Control & Shift Register shiftOut(byte data): Sends a byte to 74HC595 via SPI to update pump states.
activatePump(pump_index): Activates a single pump by setting corresponding bit LOW in current_output_state and updating via shiftOut().
deactivatePumps(): Turns off all pumps by sending 0xFF.
Pump_drive(p1, p2, p3, p4):
For each non-zero amount:
Displays which pump is active.
Calculates duration based on flow rate (20 ml/s).
Activates the pump for the calculated time, playing the melody during operation.
Turns off all pumps after dispensing.
Analog Button Input: button_read()
Reads analog value from A0.
Maps the value to:
Adds a delay to avoid bounce/misreads.
Ingredient Assignment: DrinkSelect(choice, strength) Prompts the user to select which pumps to use for Rum and Coke.
Adjusts amount[] array based on strength and recipe.
Executes pump drive for the selected ingredients.
Fişierele se încarcă pe wiki folosind facilitatea Add Images or other files. Namespace-ul în care se încarcă fişierele este de tipul :pm:prj20??:c? sau :pm:prj20??:c?:nume_student (dacă este cazul). Exemplu: Dumitru Alin, 331CC → :pm:prj2009:cc:dumitru_alin.