0% found this document useful (0 votes)
207 views

Bottle Filling Machine Code

This Arduino code controls an automatic bottle filling machine. It uses a liquid crystal display (LCD) and button input to guide users through filling 6 bottles. A motor fills each bottle in turn, signaling with a buzzer, while updating the LCD with the bottle number. When complete, it displays a message thanking the user and instructing them to place new bottles.

Uploaded by

Javed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
207 views

Bottle Filling Machine Code

This Arduino code controls an automatic bottle filling machine. It uses a liquid crystal display (LCD) and button input to guide users through filling 6 bottles. A motor fills each bottle in turn, signaling with a buzzer, while updating the LCD with the bottle number. When complete, it displays a message thanking the user and instructing them to place new bottles.

Uploaded by

Javed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

// Automatic bottle filling machine code by

//Engr. Usman Ahmad


//Easy HomeMade Projects
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int stepPin = 3;
const int dirPin = 4;
int buttonPin;
int r;
int buzzer = 10;
int m = 8;

void setup()
{
buttonPin = 11;//whatever pin your button is plugged into
r = 12;
pinMode(buttonPin, INPUT_PULLUP);
pinMode(r, INPUT);

// initialize the LCD


lcd.begin();
// Turn on the blacklight and print a message.
lcd.backlight();
lcd.clear();
lcd.setCursor(2,0); // column, row
lcd.print("Press Start");

// Sets the two pins as Outputs


pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode(m,OUTPUT);

while(digitalRead(r) == LOW)
{
digitalWrite(dirPin,LOW); // Enables the motor to move in a particular direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 400; x++)
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);

if(digitalRead(r) == HIGH)
break;

}
}
void loop()
{

//check button pressed, if so enter program condition (inside if statement)


if(digitalRead(buttonPin) == HIGH) //functions based off of button pulling input
pin LOW
{
tone(buzzer, 800);
delay(1000);
noTone(buzzer);
lcd.clear();
lcd.setCursor(0,0); // column, row
lcd.print("Start Filling");

delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 1/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
tone(buzzer, 1000);
delay(200);
noTone(buzzer);
}
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular
direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 2/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
tone(buzzer, 1000);
delay(200);
noTone(buzzer);
}
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular
direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 3/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
tone(buzzer, 1000);
delay(200);
noTone(buzzer);
}
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular
direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 4/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
tone(buzzer, 1000);
delay(200);
noTone(buzzer);
}
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular
direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 5/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
tone(buzzer, 1000);
delay(200);
noTone(buzzer);
}
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular
direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 6/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
}

lcd.clear();
lcd.setCursor(0,0); // column, row
lcd.print("Job Done! Place");
lcd.setCursor(2,1); // column, row
lcd.print("New Bottles");
tone(buzzer, 1500);
delay(300);
noTone(buzzer);
delay(100);
tone(buzzer, 1500);
delay(300);
noTone(buzzer);
delay(100);
tone(buzzer, 1500);
delay(300);
noTone(buzzer);
delay(100);
tone(buzzer, 1500);
delay(300);
noTone(buzzer);
delay(100);
tone(buzzer, 1500);
delay(300);
noTone(buzzer);
delay(100);

}}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy