Coffee Vending Machine with Arduino

This project involves designing a coffee vending machine controlled by an Arduino UNO. The machine allows users to select a coffee type and size, make payments, and receive coffee through an automated dispensing system controlled by a servo motor. An I2C LCD displays the operation status, and LEDs provide visual feedback.

Coffee Vending Machine with Arduino
Coffee Vending Machine with Arduino

Components used in Coffee Vending Machine:

  1. Arduino UNO – Main microcontroller to control all operations.
  2. Servo Motor – Dispenses the coffee by controlling a valve or opening a chute.
  3. I2C LCD Display (16×2) – Displays user selections and payment details.
  4. Push Button (Enter Button) – Used to confirm selections and proceed with payment.
  5. Sliding Potentiometer – Selects the coffee type.
  6. DIP Switch – Sets the coffee cup size.
  7. LEDs – Indicate machine status (e.g., selection made, payment required, dispensing).
  8. Additional Push Buttons – Used to increment the payment amount.
  9. Buzzer (Optional) – Provides an audible alert when coffee is ready.

Working of Coffee Vending Machine:

. User Selection Process

  • The user adjusts the sliding potentiometer to select one of the four coffee types:
    • MILD
    • BOLD
    • STRONG
    • FULL
  • The selected coffee type is displayed on the I2C LCD.
  • The user then sets the coffee size using the DIP switch settings:
    • Small (100ml)
    • Medium (200ml)
    • Large (300ml)
  • The size selection is also displayed on the LCD.
  • The user confirms the selection by pressing the ENTER button.

2. Payment System

  • The machine requires payment before dispensing coffee.
  • The user pays using incremental push buttons:
    • Each button press adds a fixed amount (e.g., $0.50 per press).
    • The LCD displays the total amount inserted.
  • If the inserted amount is less than the required price, the LCD prompts the user to add more money.
  • If the exact amount is entered, the system proceeds to dispensing.
  • If the user overpays, the extra amount is refunded automatically.

3. Coffee Dispensing Process

  • Once full payment is received:
    • The LED indicator turns GREEN.
    • The servo motor activates and opens the coffee dispensing valve.
    • The machine pours the selected coffee type and amount into the cup.
  • After dispensing is complete:
    • A message is displayed on the LCD confirming the process.
    • The buzzer (if used) sounds to indicate that coffee is ready.
    • The LED blinks to signal completion.

4. Refund Mechanism

  • If an excess amount is inserted, the system calculates the difference.
  • The LCD displays the refund amount, and the system either:
    • Returns the extra amount (if a coin return mechanism is implemented).
    • Gives the user an option for additional purchases.

Circuit Diagram of Coffee Vending Machine:

Circuit Diagram of Coffee Vending Machine with Arduino
Circuit Diagram of Coffee Vending Machine with Arduino

Code for Coffee Vending Machine Project:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>

//LiquidCrystal_I2C lcd(0x27, 16, 2);  // I2C LCD object
LiquidCrystal_I2C lcd(32, 16, 2);  // I2C LCD object

Servo servo;                        // Servo motor object

const int potentiometerPin = A0;    // Potentiometer pin
const int buttonPin = 2;            // Push button pin
const int dipSwitchPin1 = 11;       // DIP switch pin 2
const int dipSwitchPin2 = 10;       // DIP switch pin 1
const int dipSwitchPin3 = 13;       // DIP switch pin 4
const int dipSwitchPin4 = 12;       // DIP switch pin 3
const int ledPin = 4;               // LED pin

const int regularAngle = 45;        // Servo angle for Regular coffee
const int espressoAngle = 90;       // Servo angle for Espresso coffee
const int cappuccinoAngle = 135;    // Servo angle for Cappuccino coffee
const int latteAngle = 180;         // Servo angle for Latte coffee

const int regularPrice = 16;        // Price for Regular coffee (in DKK)
const int espressoPrice = 19;       // Price for Espresso coffee (in DKK)
const int cappuccinoPrice = 25;     // Price for Cappuccino coffee (in DKK)
const int lattePrice = 50;          // Price for Latte coffee (in DKK)

int selectedCoffee = 0;             // Selected coffee type (0: None, 1: MILD, 2: BOLD, 3: STRONG, 4: FULL)
int selectedProduct = 0;            // Selected coffee product (0: Regular, 1: Espresso, 2: Cappuccino, 3: Latte)
int selectedCoins = 0;              // Selected coins (in DKK)
int price=0; 
bool flag=true;
String flavor="";

void setup() {
  lcd.begin();                 // Initialize LCD
  //lcd.init(16, 2);

  // lcd.begin(16, 2);                 // Initialize LCD
  // lcd.init();


  lcd.backlight();                  // Turn on LCD backlight

  servo.attach(3);                  // Attach servo to pin 9

  pinMode(buttonPin, INPUT_PULLUP);
  pinMode(dipSwitchPin1, INPUT_PULLUP);
  pinMode(dipSwitchPin2, INPUT_PULLUP);
  pinMode(dipSwitchPin3, INPUT_PULLUP);
  pinMode(dipSwitchPin4, INPUT_PULLUP);
  pinMode(ledPin, OUTPUT);

  lcd.print("Coffee Machine");      // Display initial message on LCD
  lcd.setCursor(0, 1);
  lcd.print("Press Enter");
}

Working Video of Coffee Vending Machine:

Applications of Coffee Vending Machine:

The coffee vending machine has several practical applications, including:

  • Offices and Workplaces – Provides a quick and automated way for employees to get coffee without needing a barista.
  • Universities and Colleges – Enables students and faculty to get coffee conveniently.
  • Shopping Malls and Public Spaces – Serves customers in high-traffic areas with minimal supervision.
  • Hospitals and Clinics – Provides coffee for patients and staff in waiting areas.
  • Transportation Hubs – Airports, train stations, and bus terminals can use vending machines for travelers in need of refreshment.
  • Hotels and Restaurants – Offers a self-service coffee option to guests.
  • Events and Conferences – Provides an efficient coffee distribution method for large gatherings.

Conclusion:

This project provides an interactive, automated coffee vending machine with user-friendly operation. By using an Arduino UNO, servo motor, LCD display, push buttons, and a potentiometer, the system efficiently manages coffee selection, payment, and dispensing. The refund mechanism ensures a smooth experience for users, making it a practical implementation of embedded systems in vending machines.

Need This Project?

If you need this Project with or without Modifications or Customization then you can contact us through WhatsApp. We can deliver you this Project in the Following Ways.

Project Code:
we can provide you Project Code along with Zoom Assistant, through Zoom meeting for Setup of this Project or any other Arduino Project of your need.

Fully Functional Project with Hardware/Components Shipment:
if you can not make this project yourself then you can use this option. We will assemble the Project and will ship it to your Doorstep with Safe Packaging.

Learn More about the services we offer.

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
YouTube
× Contact us