An Automatic Liquid Filling Machine is a specialized device designed to automatically and accurately fill containers with liquid products in a production line setting. These machines use various mechanisms, such as gravity, pumps, or pistons, to dispense precise volumes of liquids into bottles, cans, or other containers.
Key features include:
Automation: The machine operates with minimal human intervention, often controlled by programmable systems (e.g., PLCs) that regulate fill volume, speed, and container alignment.
Accuracy: It ensures consistent fill levels, reducing waste and maintaining product uniformity.
Versatility: Capable of handling liquids of different viscosities, from water-like substances to thick creams or gels.
Efficiency: Designed to fill multiple containers quickly, enhancing productivity and suitable for large-scale production.
Automatic liquid filling machines are essential in industries like food & beverage, pharmaceuticals, cosmetics, and chemicals, where precise filling is crucial for product quality and compliance.
An Arduino UNO can effectively control an Automatic Liquid Filling Machine using a combination of sensors, a pump, a keypad, a display, and a relay module to automate and manage the filling process. Here’s how each component works together in this setup:
Arduino UNO:
Acts as the main control unit, processing sensor input and executing commands to start or stop the pump based on the user-defined volume.
YF-S401 Flow Sensor:
Measures the flow rate of the liquid in real-time. It generates pulses as liquid flows through it; each pulse is counted by the Arduino to calculate the volume of liquid dispensed.
12V Water Pump:
Responsible for moving the liquid from the reservoir to the container. The Arduino controls the pump’s operation via a relay.
4x4 Keypad:
Allows the user to input the desired fill volume. By pressing numeric keys, users set the amount of liquid (in milliliters) they want to fill into the container.
I2C LCD Display:
Displays user instructions, the set volume, real-time volume filled, and completion status. This makes the interface user-friendly.
Relay Module:
Works as a switch controlled by the Arduino to turn the pump on and off based on the filling requirements.
Connecting Wires:
Jumper wires to connect the different components of system.
Breadboard (Optional):
Useful for setting up a prototype.
5- Power Supply:
You’ll need a 9V power supply for I2C LCD display.
1- Setting the Target Volume:
The process begins when the user inputs the desired fill volume using the 4x4 keypad. Each key press is processed by the Arduino, and the volume is displayed on the LCD for confirmation.
Once the volume is set, pressing a designated "start" button (such as #
on the keypad) tells the Arduino to begin the filling operation.
2- Activating the Pump and Monitoring Flow:
The Arduino commands the relay to close the circuit, activating the 12V water pump and starting the flow of liquid.
As liquid flows through the YF-S401 sensor, it generates pulses proportional to the flow rate. The Arduino uses these pulses, along with a calibration factor, to calculate the cumulative volume of liquid that has passed through the sensor.
3- Displaying Real-Time Filling Data:
The LCD screen continuously updates to show the current volume of liquid filled. This lets the user monitor the filling process in real-time.
4- Automatic Stop at Target Volume:
When the measured volume reaches or slightly exceeds the user-set target, the Arduino deactivates the relay, which turns off the water pump, stopping the flow.
The LCD then displays a “Filling Complete” message, indicating that the operation has successfully reached the desired volume.
Here’s a step-by-step guide on how to set up this system:
1- Flow Sensor (YF-S401):
VCC: Connect to 5V on Arduino.
GND: Connect to Arduino GND.
Signal: Connect to a digital pin (e.g., D2) on the Arduino.
12V Water Pump:
Connect to an external 12V power supply.
Use a relay module to control the pump’s power, connecting the relay's signal pin to an Arduino digital pin (e.g., D3).
Relay Module:
VCC: Connect to 5V on Arduino.
GND: Connect to Arduino GND.
Signal Pin: Connect to a digital pin on the Arduino (D3 in this example).
4x4 Keypad:
Connect each row and column pin to individual digital pins on the Arduino (e.g., D4-D11).
The keypad will be used for setting the desired filling volume.
LCD Display (16x2):
We connect:
the SDA pin of the LCD display to PIN 4 of the Arduino
the SCL pin of the LCD display to PIN 5 of the Arduino
the GND pin of the LCD display to the GND pin of the Arduino
the VCC pin of the LCD display to the (+) terminal of a 9V battery
Here’s a sample code to control the filling process:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
#include <Keypad.h> #include <LiquidCrystal_I2C.h> const int ROW_NUM = 4; //four rows const int COLUMN_NUM = 4; //four columns char keys[ROW_NUM][COLUMN_NUM] = { {'1','2','3', 'A'}, {'4','5','6', 'B'}, {'7','8','9', 'C'}, {'*','0','#', 'D'} }; LiquidCrystal_I2C lcd(0x27, 20, 4); // ligne 8 byte pin_rows[ROW_NUM] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad byte pin_column[COLUMN_NUM] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad Keypad keypad = Keypad( makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM ); int sensorInterrupt = 0; // interrupt 0 int sensorPin = 2; //Digital Pin 2 int solenoidValve = 5; // Digital pin 5 unsigned int SetPoint = 400; //400 milileter String code=""; /*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,volume=0; unsigned long oldTime ; const int relais_moteur = 3; // the relay is connected to pin 3 of the Adruino board void setup() { totalMilliLitres = 0; pinMode(relais_moteur, OUTPUT); lcd.init(); // display initialization lcd.clear(); lcd.backlight(); // activate the backlight lcd.setCursor(0, 0); // stand in the front line lcd.print("donner volume:"); // Initialize a serial connection for reporting values to the host Serial.begin(9600); pinMode(solenoidValve , OUTPUT); digitalWrite(solenoidValve, HIGH); pinMode(sensorPin, INPUT); digitalWrite(sensorPin, HIGH); /*The Hall-effect sensor is connected to pin 2 which uses interrupt 0. Configured to trigger on a FALLING state change (transition from HIGH (state to LOW state)*/ attachInterrupt(sensorInterrupt, pulseCounter, FALLING); //you can use Rising or Falling } void loop() { char key = keypad.getKey(); //lcd.clear(); 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=='D') { // if you press the 'D' key if(code.toInt()<=1500){ volume=code.toInt(); } else{ lcd.clear(); lcd.backlight(); lcd.setCursor(0, 0); lcd.print("donner volume:"); } code=""; } 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); // Because this loop may not complete in exactly 1 second intervals we calculate the number of milliseconds that have passed since the last execution and use that to scale the output. We also apply the calibrationFactor to scale the output based on the number of pulses per second per units of measure (litres/minute in this case) coming from the sensor. flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor; // Note the time this processing pass was executed. Note that because we've // disabled interrupts the millis() function won't actually be incrementing right // at this point, but it will still return the value it was set to just before // interrupts went away. oldTime = millis(); // Divide the flow rate in litres/minute by 60 to determine how many litres have // passed through the sensor in this 1 second interval, then multiply by 1000 to // convert to millilitres. flowMilliLitres = (flowRate / 60) * 1000; // Add the millilitres passed in this second to the cumulative total totalMilliLitres += flowMilliLitres; unsigned int frac; // Print the flow rate for this second in litres / minute 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 lcd.print(" ml"); if (totalMilliLitres > 40) { SetSolinoidValve(); } // 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); } }else { digitalWrite(relais_moteur, LOW); // Stop the water pump volume=0; } } //Insterrupt Service Routine void pulseCounter() { // Increment the pulse counter pulseCount++; } void SetSolinoidValve() { digitalWrite(solenoidValve, LOW); } |
Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.
Zaouiet Kontech-Jemmel-Monastir-Tunisia
+216 92 886 231
medaliprof@gmail.com
Robotic site created by MedAli-Teacher info