Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2025:avaduva:george_matei.popa [2025/05/20 09:50]
george_matei.popa [Hardware Design]
pm:prj2025:avaduva:george_matei.popa [2025/06/01 19:09] (current)
george_matei.popa [Software Design]
Line 7: Line 7:
 ===== Introducere ===== ===== Introducere =====
  
-Proiectul meu constă într-un aparat automat de preparare a cocktailurilorbazat pe placa Arduino Uno R3 și echipat cu patru pompe controlate prin releeun LCD keypad shield ​pentru selectarea rețetelor și un buzzer ​care semnalizează și întreține atmosfera cu muzicăScopul meu fost să automatizez dozarea precisă ​ingredientelor pentru a obține consistența băuturilor și să creez o experiență interactivă. Ideea mi-venit la o petrecere, când încercam să îmi prepar o băutură și dozajul nu îmi ieșea corect, iar atunci m-am gândit că ar fi fost mult mai ușor dacă exista un automat care să facă asta pentru mineCred că proiectul este util atât pentru petrecericât și pentru baruri de acasă, oferind un mod interactiv și precis de servire a băuturilor. +My project consists of an automatic cocktail-making machinebased on the Arduino Uno R3 board and equipped with four pumps controlled via relaysan LCD keypad shield ​for selecting recipes, and a buzzer ​that signals and enhances the atmosphere with musicMy 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 party, when I was trying to make myself ​drink and couldn'​t get the proportions right — that’when I thought it would be much easier if there were machine to do it for meI believe the project is useful both for parties and for home barsoffering an interactive and precise way of serving drinks.
 ===== Descriere generală ===== ===== Descriere generală =====
 Schema bloc Schema bloc
Line 22: Line 21:
                           |        R3       |                           |        R3       |
                           |                 |                           |                 |
-                          +--+--+--+--+--+--+ +                          +----+-------+----+ 
-                             ​ ​| ​ |  |  ​+                               ​      ​
-     ​+----------------+ ​     ​| ​ |  |  |  |       +-------------+ +                 ​+-------------+ ​      ​+-------------+ 
-     ​    Buzzer ​    |<​-----+ ​ |  |  |  ​+------>​|Rele Module 1+-------------------------+ +                 ​                                ​| 
-     +----------------+ ​        ​| ​ |  |          +-------------+ ​                        | +                 ​v ​                                v 
-                                |  |           ​+-------------+ ​                        +       +------------------+ ​            ​+---------------------+ 
-                                ​| ​ |  ​+--------->|Rele Module 2+------------------+ ​     | +       ​|  ​Buzzer (via NPN)            ​    74HC595 (SPI)   
-                                |  |             +-------------+                  |      | +       ​+--------+---------+ ​            ​+----------+----------+ 
-                                |  |             +-------------+ ​                      +                ​                                ​
-                                 +------------>​|Rele Module 3+---------+ ​            +                                          ​+-----+-----+ 
-                                ​| ​               ​+-------------+         ​            | +                ​                          |           
-                                ​|                +-------------+         ​            +                ​|                        ​+--+--+     +--+--+ 
-                                +--------------->|Rele Module 4        ​            +                ​                       |Rele1    ​|Rele2| 
-                                                 ​+----+--------+         ​            +                |                        ​+--+--+     +--+--+ 
-                                                                                   +                ​                          ​          ​
-                    +---------------------------------+ ​                 ​| ​       |      | +                ​| ​                       ​+--+--+     +--+--
-                    |                   +--------------------------------+ ​       |      | +                ​                       |Rele3    ​|Rele4
-                    ​                  ​                          ​+-------------+ ​     | +                ​| ​                       ​+--+--+     +--+--+ 
-                    |                   ​| ​                          ​| ​                   | +                ​                          ​          ​
-                    v                   ​v ​                          ​v ​                   v +                                          ​          ​| 
-            ​+--------------+ ​   +--------------+ ​          ​+--------------+ ​     +--------------+ +                |                           ​| ​          
-            Pompa YX 4   ​|    | Pompa YX 3   ​          ​Pompa YX 2   ​|      | Pompa YX 1   +                ​| ​                          ​| ​          | 
-            +--------------+ ​   ​+--------------+ ​          ​+--------------+ ​     ​+--------------++                v                           ​v ​          v 
 +       +--------------+          +--------------+ +--------------+ 
 +           GND      ​| ​           Pompa YX 1 |   Pompa YX 2 | 
 +       +--------------+ ​         +--------------+ +--------------+ 
 + 
 +                                    ​+--------------+ +--------------+ 
 +                                    |   Pompa YX 3 | |   Pompa YX 
 +                                    +--------------+ +--------------+
  
 ===== Hardware Design ===== ===== Hardware Design =====
Line 54: Line 60:
       * LCD keypad shield (x1)       * LCD keypad shield (x1)
       * Buzzer (x1)       * Buzzer (x1)
 +      * NPN transistor
 +      * 1k ohm resistor
       * Switch       * Switch
       * Type C Plug       * Type C Plug
Line 89: Line 97:
       * Used to produce a sound at the beginning/​end of distribution,​ for error alerts and playing ambient music.       * Used to produce a sound at the beginning/​end of distribution,​ for error alerts and playing ambient music.
  
-      * Connected to a digital pin.+      * Connected to a digital pin via an npn transistor.
  
 **Switch** **Switch**
Line 109: Line 117:
  
  
-<note tip> +1. Cocktail Machine Controller 
-Descrierea codului aplicaţiei ​(firmware): +setup() 
-  mediu de dezvoltare ​(if any) (e.gAVR StudioCodeVisionAVR+   * Initializes the LCD (16x2) and SPI interface for shift register control. 
-  librării şi surse 3rd-party (e.gProcyon AVRlib+ 
-  * algoritmi şi structuri pe care plănuiţi ​să le implementaţi +Configures the output pins
-  * (etapa 3surse şi funcţii implementate + 
-</note>+   latchPin ​(for 74HC595 control)
 + 
 +   * buzzerPin ​(for sound output, via PWM), 
 + 
 +   * Sets initial output state of pumps to OFF (0xFF). 
 + 
 +   * Begins serial communication for debugging (Serial.begin(9600)). 
 + 
 +   * Initializes the melody loop timer with noteStartTime = millis(). 
 + 
 +loop() 
 +Continuously plays a looped melody in the background (playLoopedMelody()). 
 + 
 +Displays and navigates the Main Menu via menu(): 
 + 
 +   * Option 1 – Have a drink: Select a predefined cocktail and desired strength. 
 + 
 +   * Option 2 – Make your own: Manually select pump volumes. 
 + 
 +   * Option 3 – Toggle Music: Enable or disable background melody. 
 + 
 +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:​ 
 + 
 +   * Page 1 = predefined drinks. 
 + 
 +   * Page 2 = custom drink creation. 
 + 
 + 
 +Predefined Drinks Mode (Page 1) 
 +Drink Selection:​ 
 +Scroll through predefined cocktail options: 
 + 
 +   * Rum & Coke 
 + 
 +   * Long Island 
 + 
 +   * Raspberry Vodka 
 + 
 +Uses button input to change selection and confirm with SELECT. 
 + 
 +Strength Selection:​ 
 +   * Adjust strength (1 to maxstrength) using LEFT/​RIGHT. 
 + 
 +   * Displays strength visually using repeated ++ symbols. 
 + 
 +Execution:​ 
 +Calls DrinkSelect(choicestrength)
 + 
 +Prompts user to assign pumps for Rum and Coke. 
 + 
 +Computes ingredient volumes: 
 + 
 +   ​Rum = 40 + strength * 10 ml 
 + 
 +   * Coke = 40 ml 
 + 
 +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: 
 + 
 +   RIGHT, UP, DOWN, LEFT, SELECT, or NONE (debounced). 
 + 
 +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. 
  
 ===== Rezultate Obţinute ===== ===== Rezultate Obţinute =====
pm/prj2025/avaduva/george_matei.popa.1747723811.txt.gz · Last modified: 2025/05/20 09:50 by george_matei.popa
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0