Differences

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

Link to this comparison view

pm:prj2023:apredescu:milywaymaker [2023/05/30 14:28]
mara_sofia.stan [Software Design]
pm:prj2023:apredescu:milywaymaker [2023/05/30 14:36] (current)
mara_sofia.stan [Download]
Line 3: Line 3:
  
 <note tip> <note tip>
-**Name**: Mara Sofia STAN \\ +**Name**: Mara Sofia **STAN** \\ 
 **Group**: 1221A - FILS **Group**: 1221A - FILS
 </​note>​ </​note>​
Line 49: Line 49:
 Here are the features of this setup: Here are the features of this setup:
  
-  * User Input: The keypad allows the user to input the desired volume of liquid. The code reads the input and stores it as the target volume for dispensing. +  ​* **User Input**: The keypad allows the user to input the desired volume of liquid. The code reads the input and stores it as the target volume for dispensing. 
-  * Liquid Dispensing: The flow sensor measures the flow rate of the liquid. The code calculates the amount of liquid dispensed based on the flow rate and time. It keeps track of the total amount of liquid dispensed until it reaches the target volume. +  ​* **Liquid Dispensing**: The flow sensor measures the flow rate of the liquid. The code calculates the amount of liquid dispensed based on the flow rate and time. It keeps track of the total amount of liquid dispensed until it reaches the target volume. 
-  * Powder Dispensing: The ultrasonic sensor detects the presence of a glass near the machine. When the glass is detected, a servo motor is activated to dispense the coffee powder. +  ​* **Powder Dispensing**: The ultrasonic sensor detects the presence of a glass near the machine. When the glass is detected, a servo motor is activated to dispense the coffee powder. 
-  * Display and Feedback: The LCD display shows various information such as the input volume, flow rate, and total dispensed volume. It provides feedback messages like "​Insert volume,"​ "​Volume reached,"​ and "​Remove cup" to guide the user through the process. +  ​* **Display and Feedback**: The LCD display shows various information such as the input volume, flow rate, and total dispensed volume. It provides feedback messages like "​Insert volume,"​ "​Volume reached,"​ and "​Remove cup" to guide the user through the process. 
-  * Buzzer: The buzzer is used to generate beeping sounds during certain events, such as when the volume is entered correctly or when the target volume is reached.+  ​* **Buzzer**: The buzzer is used to generate beeping sounds during certain events, such as when the volume is entered correctly or when the target volume is reached.
  
  
 Below is the overall flow and explanation of the code. It combines input from the keypad, measurements from the ultrasonic sensor and flow sensor, and control of the water pump and servo motor to automate the process of dispensing milk based on the desired volume. ​ Below is the overall flow and explanation of the code. It combines input from the keypad, measurements from the ultrasonic sensor and flow sensor, and control of the water pump and servo motor to automate the process of dispensing milk based on the desired volume. ​
  
-  - Include the necessary libraries for the keypad, LCD display, and servo motor( //<​Keypad.h>,​ <​LiquidCrystal_I2C.h>,​ <​Servo.h>//​) and define the pin connections for various components.+Include the necessary libraries for the keypad, LCD display, and servo motor( //<​Keypad.h>,​ <​LiquidCrystal_I2C.h>,​ <​Servo.h>//​) and define the pin connections for various components.
 <​code>​ <​code>​
 #include <​Keypad.h>​ #include <​Keypad.h>​
Line 80: Line 80:
 Keypad keypad = Keypad(makeKeymap(keys),​ pin_rows, pin_column, ROW_NUM, COLUMN_NUM);​ Keypad keypad = Keypad(makeKeymap(keys),​ pin_rows, pin_column, ROW_NUM, COLUMN_NUM);​
 </​code>​ </​code>​
-  - Declare global variables for pins, counters, calibration factors, and flags.+ Declare global variables for pins, counters, calibration factors, and flags.
 <​code>​ <​code>​
 const int ultrasonicTrigPin = 12; const int ultrasonicTrigPin = 12;
Line 111: Line 111:
  
   -  Call the ''​setup()''​ function to initialize the settings and configurations of the Arduino board and connected components. Set pin modes, attach interrupts, and initialize the LCD display.\\ ​   -  Call the ''​setup()''​ function to initialize the settings and configurations of the Arduino board and connected components. Set pin modes, attach interrupts, and initialize the LCD display.\\ ​
-<​code>​ 
-void setup() 
-{ 
-  totalMilliLitres = 0; 
-  pinMode(relais_moteur,​ OUTPUT); 
-  pinMode(buzzerPin,​ OUTPUT); 
-  lcd.init(); // display initialization 
-  lcd.clear();​ 
-  lcd.backlight();​ // activate the backlight 
-  lcd.setCursor(0,​ 0); // stand in the front line 
-  lcd.print("​Insert volume:"​);​ 
-  Serial.begin(9600);​ 
-  myServo.attach(servoPin);​ 
-   ​myServo.write(70);​ 
-   ​pinMode(ultrasonicTrigPin,​ OUTPUT); 
-  pinMode(ultrasonicEchoPin,​ INPUT); 
-   ​delay(2000);​ 
-  pinMode(sensorPin,​ INPUT); 
-  digitalWrite(sensorPin,​ HIGH); 
-  attachInterrupt(sensorInterrupt,​ pulseCounter,​ FALLING); //you can use Rising or Falling 
-} 
-<​\code>​\\ ​ 
-  - Enter the ''​loop()''​ function, which is the main execution loop of the program. It continuously checks for inputs from the keypad and performs actions based on the input. It also checks for the presence of a cup using the ultrasonic sensor and controls the servo motor accordingly. 
-  - Read inputs from the keypad within the ''​loop()''​ function and accumulate them to form a volume value. Display the entered volume on the LCD display. 
-  - If the entered volume is within the specified range (1000 mL or less), enter the volume dispensing loop. Activate the water pump and calculate the flow rate using the flow sensor. Display the flow rate and cumulative volume dispensed on the LCD display and serial monitor. 
-  - If the total dispensed volume exceeds the entered volume, stop the water pump, display a message indicating that the desired volume has been reached, wait for a few seconds, and reset the process to allow a new measurement. 
-<​code>​ 
-void loop() 
-{ 
-  if (!objectDetected) { 
-    // Read distance from ultrasonic sensor 
-    delay(2000);​ 
-    int distance = getDistance();​ 
-    // Check if distance is below threshold 
-    if (distance <= thresholdDistance) { 
-      // Move servo to 90 degrees 
-      delay(2000);​ 
-      myServo.write(120);​ 
-      delay(3000);​ 
-      // Reset servo to initial position 
-      myServo.write(70);​ 
-      // Set object detected flag to true 
-      objectDetected = true; 
-    } 
-  } 
- 
-  // Wait for a moment before checking again 
-  delay(100); 
- 
-  /////////////////////////////////////////​ 
-  char key = keypad.getKey();​ 
-  
-  if (key) { // A key on the keyboard is pressed 
-    code += key; 
-    lcd.setCursor(0,​ 1); // stand on the second line 
-    lcd.print(code); ​ // show volume value 
-    delay(100); 
-  } 
-  
-  if (key == '#'​) { // if you press the '​D'​ key 
-    if (code.toInt() <= 1000) { 
-      volume = code.toInt();​ 
-      volumeEntered = true; 
-      if(!beepSequence) 
-      { 
-        playBeepSequence(buzzerPin);​ 
-      beepSequence = true; 
-      } 
-      ​ 
-      ​ 
-  } 
-    else { 
-      lcd.clear();​ 
-      lcd.backlight(); ​ 
-      lcd.setCursor(0,​ 0);  
-      lcd.print("​Insert volume:"​);  ​ 
-    } 
-    code = "";​ 
-  } 
- 
-  if (key == '​*'​) { // if you press the '​*'​ key 
-   ​resetProcess();​ 
-   ​volumeEntered = false; 
-   ​return;​ 
-  } 
- 
-  if(volumeEntered){ 
-     if (totalMilliLitres < volume ) { 
-    digitalWrite(relais_moteur,​ HIGH); // Start the water pump 
-  
-    if ((millis() - oldTime) > 1000) { // Only process counters once per second 
-      // Disable the interrupt while calculating flow rate and sending the value to the host 
-      detachInterrupt(sensorInterrupt);​ 
-   ​flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;​ 
-  
-    oldTime = millis(); 
-  ​ 
-    flowMilliLitres = (flowRate / 60) * 1000; 
-  
-    totalMilliLitres += flowMilliLitres;​ 
-  
-    unsigned int frac; 
-  
-    Serial.print("​Flow rate: "); 
-    Serial.print(flowMilliLitres,​ DEC);  // Print the integer part of the variable 
-    Serial.print("​mL/​Second"​);​ 
-    Serial.print("​\t"​); ​           
-    lcd.clear();​ 
-    lcd.backlight(); ​ 
-    lcd.setCursor(0,​ 0);  
-    lcd.print("​debit:"​);​ 
-    lcd.print(flowMilliLitres); ​ // Show the flow rate on the lcd display ​   
-        lcd.print("​ ml/​s"​); ​   ​ 
-    // Print the cumulative total of litres flowed since starting 
-    Serial.print("​Output Liquid Quantity: "​); ​       ​ 
-    Serial.print(totalMilliLitres,​DEC);​ 
-  
-    Serial.println("​mL"​); ​ 
-    Serial.print("​\t"​); ​     
-        lcd.setCursor(0,​ 1);  
-        lcd.print("​volume:"​); ​           
-        lcd.print(totalMilliLitres); ​ // Show quantity filled ​   
-    ​ 
-    pulseCount = 0; 
-  
-    attachInterrupt(sensorInterrupt,​ pulseCounter,​ FALLING); 
-    } 
-}else  { 
-  digitalWrite(relais_moteur,​ LOW); // Stop the water pump 
-  volume=0; 
-  volumeEntered = false; 
-  if(!beepSequence2) 
-      { 
-        playBeepSequence(buzzerPin);​ 
-      beepSequence2 = true; 
-      } 
-      ​ 
-  lcd.setCursor(0,​ 0);  
-  lcd.print("​Volume reached!"​); ​ 
-   ​lcd.setCursor(0,​ 1);  
-  lcd.print("​Remove cup!"​); ​ 
-  delay(10000);​ 
-  ////int distance2 = getDistance();​ 
-  //​if(distance2 > thresholdDistance) 
-  //{ 
-    objectDetected = false; 
-  //} 
-  delay(10000);​ 
-  resetProcess();​ 
-  return;  ​ 
-  } 
- } 
-} 
-<​\code>​ 
   - Call the ''​pulseCounter()''​ function, which is an interrupt service routine that increments a pulse count variable. It is triggered by the falling edge of the pulse from the flow sensor, indicating the flow of liquid.   - Call the ''​pulseCounter()''​ function, which is an interrupt service routine that increments a pulse count variable. It is triggered by the falling edge of the pulse from the flow sensor, indicating the flow of liquid.
   - Call the ''​resetProcess()''​ function to reset the variables and settings related to the flow measurement process. Clear the LCD display, set it to the initial state, and initialize the necessary variables.   - Call the ''​resetProcess()''​ function to reset the variables and settings related to the flow measurement process. Clear the LCD display, set it to the initial state, and initialize the necessary variables.
Line 287: Line 133:
 In conclusion, the development of the Milky Way Maker coffee maker machine using Arduino has been a successful project. It has demonstrated the potential of integrating electronics and programming into everyday appliances to automate processes and enhance functionality. The user-friendly interface, sensor integration,​ and customization options make it a versatile and enjoyable coffee-making experience. The project has provided valuable learning opportunities and highlights the possibilities for future innovation in home automation.;​-) In conclusion, the development of the Milky Way Maker coffee maker machine using Arduino has been a successful project. It has demonstrated the potential of integrating electronics and programming into everyday appliances to automate processes and enhance functionality. The user-friendly interface, sensor integration,​ and customization options make it a versatile and enjoyable coffee-making experience. The project has provided valuable learning opportunities and highlights the possibilities for future innovation in home automation.;​-)
 ===== Download ===== ===== Download =====
 +An archive containing the source code and the additional libraries used: 
 {{:​pm:​prj2023:​apredescu:​milkywaymaker.zip|}} {{:​pm:​prj2023:​apredescu:​milkywaymaker.zip|}}
 ===== Jurnal Log ===== ===== Jurnal Log =====
  
-  * 15.05: Researched for a project theme +  ​* **15.05**: Researched for a project theme 
-  * 17.05: Decided on Milky Way Maker as the project (reflecting my love for chocolate drinks in general so I knew this was the one for me) +  ​* **17.05**: Decided on Milky Way Maker as the project (reflecting my love for chocolate drinks in general so I knew this was the one for me) 
-  * 18.05: Ordered the components required for the project +  ​* **18.05**: Ordered the components required for the project 
-  * 21.05: Components arrived, began brainstorming the design and took a trip to //IKEA// to purchase a wooden box and recipients +  ​* **21.05**: Components arrived, began brainstorming the design and took a trip to //IKEA// to purchase a wooden box and recipients 
-  * 23.05: Enlisted my dad's help in cutting the wood box and creating necessary indents for the pump hose and other components m( +  ​* **23.05**: Enlisted my dad's help in cutting the wood box and creating necessary indents for the pump hose and other components m( 
-  * 26.05: Finally assembled all the components and completed the Milky Way Maker coffee maker machine+  ​* **26.05**: Finally assembled all the components and completed the Milky Way Maker coffee maker machine
  
-===== Bibliografie/Resurse ​=====+===== Bibliography/Resources ​=====
  
 <​note>​ <​note>​
pm/prj2023/apredescu/milywaymaker.1685446135.txt.gz · Last modified: 2023/05/30 14:28 by mara_sofia.stan
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