ABSTRACT
A milk dispensing machine is a device designed to dispense milk automatically, providing a convenient and hygienic way to serve milk to customers. Milk dispensing machines are commonly used in farms where fresh milk is desired. They appeal to both organizations and consumers due to their many advantages, which include financial savings, increased hygiene, and less waste. It also reduced the need for manual labor and minimizing the risk of contamination. Milk dispensing machines are designed to provide a more efficient and hygienic way to dispense milk compared to traditional methods such as pouring from a jug or carton. They can also reduce waste by dispensing the exact amount of milk needed for each person rather than pouring excess milk that may go to waste.
INTRODUCTION
The Automatic Milk Dispensing System is a cutting-edge system made to effectively handle and deliver milk with the least amount of human involvement. With this approach, milk delivery will be streamlined while maintaining convenience, accuracy, and hygienic conditions. Solenoid valve is used regulate the dispensing mechanism, a microprocessor to analyze data, and flow sensors to measure the amount of milk are the main parts of the system. This technology minimizes contamination hazards and improves overall cleanliness by automating the milk delivery process and reducing manual handling.
Proposed ASSEMBLY DESIGN
TOP VIEW:

OVER VIEW:
.png)
FLOW CHART:

Components
Arduino
The Arduino microcontroller is the brain of the Automatic Milk Dispensing System. It processes inputs from flow sensor (YF-S201) and controls the operation of pumps and relays to dispense the milk accurately.

Sensors
Flow sensor(YF-S201) is used for controlling the flow of milk dispensed by solenoid valve .
Flow sensors(YF-S201)
Solenoid valve
A solenoid valve uses an electromagnetic solenoid to control the flow of liquids by moving a plunger that opens or closes the valve. On this project, it ensures precise control over milk flow, enabling accurate and consistent dispensing.
Relays and Transistors
Relays and transistors act as switches to control the high-power component like solenoid valve based on the low-power signals from the Arduino.
LCD Display
An LCD display is used to provide a user interface for the system, displaying information such as the amount of milk dispensed, remaining quantity, and operational status.
Power
Ensure proper connections to Arduino and other components.
SIMULATION CIRCUIT DIAGRAM
.png)
Code
#include <LiquidCrystal.h>
int sensorInterrupt = 0; // interrupt 0
int sensorPin = 2; // Digital Pin 2
int pumpingMotor = 5; // Digital pin 5
unsigned int SetPoint = 250; // Default to 250 milliliters
int button250Pin = 3; // Pin for 250 ml button
int button500Pin = 4; // Pin for 500 ml button
int button1000Pin = 10; // Pin for 1000 ml button
/* The hall-effect flow sensor outputs pulses per second per litre/minute of flow. */
float calibrationFactor = 90; // You can change according to your datasheet
volatile byte pulseCount = 0;
float flowRate = 0.0;
unsigned int flowMilliLitres = 0;
unsigned long totalMilliLitres = 0;
unsigned long oldTime = 0;
LiquidCrystal lcd(12, 11, 9, 8, 7, 6);
void setup() {
// Initialize a serial connection for reporting values to the host
lcd.begin(16, 2);
Serial.begin(9600);
pinMode(pumpingMotor, OUTPUT);
digitalWrite(pumpingMotor, HIGH);
pinMode(sensorPin, INPUT);
digitalWrite(sensorPin, HIGH);
// Initialize button pins
pinMode(button250Pin, INPUT_PULLUP);
pinMode(button500Pin, INPUT_PULLUP);
pinMode(button1000Pin, INPUT_PULLUP);
/* The Hall-effect sensor is connected to pin 2 which uses interrupt 0. Configured to trigger on a FALLING state change (transition from HIGH to LOW state) */
attachInterrupt(sensorInterrupt, pulseCounter, FALLING); // You can use Rising or Falling
}
void loop() {
// Read button states
if (digitalRead(button250Pin) == LOW) {
SetPoint = 250;
resetFlow();
} else if (digitalRead(button500Pin) == LOW) {
SetPoint = 500;
resetFlow();
} else if (digitalRead(button1000Pin) == LOW) {
SetPoint = 1000;
resetFlow();
}
if ((millis() - oldTime) > 1000) { // Process counters once per second
// Disable the interrupt while calculating flow rate and sending the value to the host
detachInterrupt(sensorInterrupt);
// Calculate the flow rate
flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;
// Update the oldTime to the current time
oldTime = millis();
// Calculate the flow in milliliters for the interval
flowMilliLitres = (flowRate / 60) * 1000;
// Add the milliliters passed in this interval to the cumulative total
totalMilliLitres += flowMilliLitres;
// Print the flow rate for this interval
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Flow rate: ");
lcd.print(flowMilliLitres, DEC); // Print the integer part of the variable
lcd.print(" mL/Sec");
// Print the cumulative total of liters flowed since starting
lcd.setCursor(0, 1);
lcd.print("Liquid Qnty:");
lcd.print(totalMilliLitres, DEC);
lcd.print(" mL");
// Check if the totalMilliLitres has reached the SetPoint
if (totalMilliLitres >= SetPoint) {
SetpumpingMotor();
}
// Reset the pulse counter so we can start incrementing again
pulseCount = 0;
// Enable the interrupt again now that we've finished sending output
attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
}
}
// Interrupt Service Routine
void pulseCounter() {
// Increment the pulse counter
pulseCount++;
}
void SetpumpingMotor() {
digitalWrite(pumpingMotor, LOW); // Stop the pump
}
void resetFlow() {
// Reset flow measurements
totalMilliLitres = 0;
pulseCount = 0;
digitalWrite(pumpingMotor, HIGH); // Ensure the pump is running
}
METHODOLOGY OF PROPOSED WORK
There are several crucial elements in the process of creating the Automatic Milk Dispensing System. To determine system demands, such as dispensing volume and user interface specifications, requirement analysis is first carried out. Next, appropriate parts are chosen, such as an LCD display, relays, solenoid valve , flow sensors, and an Arduino board. Using a schematic diagram and breadboard prototype, the circuit design is developed. Writing Arduino code is a necessary part of software development in order to handle sensor data, to control solenoid valve and communicate with LCDs. Ultimately, all parts are assembled and integrated, guaranteeing a dependable and user-friendly milk pouring system.
Simulation for Milk Dispensing System:
Conclusion
The Automatic Milk Dispensing System improves the efficiency and hygiene of milk distribution through automation. The use of an Arduino microcontroller, along with sensors, solenoid valve, relays, and an LCD display, enables precise control and monitoring. This methodology, encompassing requirement analysis, component selection, circuit design, software development, and integration, ensures the creation of a reliable and user-friendly system. By minimizing manual handling, the system reduces contamination risks and can be adapted for use in dairy farms, vending machines, and homes, providing a modern solution for milk dispensing needs.