Introduction: Liquor Dispenser
As you may have guessed by the title this project is a machine that mixes perfect drinks every time because everybody knows alcohol is the cause of... and solution to... all of life's problems, now this dispenser will include an interactive menu on an LCD display, multiple LEDs and a second drink compartment... why? why not.
Step 1: What You're Gonna Need
-2 DC Peristaltic Pumps
-an LCD Display
-Hoses
-Wires
-Foam Board
-2 Display Boxes
-Whiskey Glasses
-2 MOSFET Transistors
-A Switch and Pressure Sensor
-Potentiometer
- 2 220 Ohm Resistors
- 2 10k Resistors
- liquor
Step 2: LCD
sauder up wires to the first and last six connections of an Arduino 16 connection LCD, later to be attached to our arduino
Step 3: Motors
sauder a wire to both the positive and negative sides of both of your motors
Step 4: Switches
for this step, you will attach wires at the end of both the pressure and push switch and 10k resistors to each negative end of each switch
Step 5: LEDs
wire up miscellaneous LEDs with 220-ohm resistors on their negative ends and wire on both ends, I used 3, two blue and one red
Step 6: Power
use an extension cord to plug in your 5v USB plugin adapter and your 12-volt dc adapter w/ polarity splitter attachment
Step 7: Breadboard #1 Setup
place MOSFET transistors and diodes in place for your motors to run off of
Step 8: Breadboard #2 Setup
add your potentiometer and 220-ohm resistor to your second breadboard
Step 9: Breadboard #2 Power Connection
plug the according polarities from your 12v adapter into your second breadboard
Step 10: Wiring and Heat Shrink
use my attached schematic to attach all of the loose wires to the appropriate spaces on the breadboards and the heat shrink each attached wire
Step 11: Schematic
Attachments
Step 12: Code
#include // include the
library code:
LiquidCrystal lcd(12,11,5,4,3,2); // initialize the library with the numbers of the interface pins
const int switchPin = 13; // the number of the switch pin
const int motorPin = 10; // the number of the motor pin
const int blueLED = 9; // light up the blue led
const int redLED = 8; // light up the red led
int switchState = 0; // variable for reading the switch's status
const int sensorPin = A0; // temperature sensor
const float baslineTemp = 20.0;// initial temperature
const int motorPin2 = 6; // the number of the motor pin
int switchA; //The button that allows you to scroll through the menu
int switchAPin = 7; //The input pin number of the menu scroll button
int i = 1; //Holds the value for the menu
const int blueLED2 = A1;// needed an LED so I added one in A1
void setup() {
// put your setup code here, to run once:
lcd.begin(16, 2);// set up the number of columns and rows on the LCD
lcd.print("Welcome to the");// the first line of my first message
lcd.setCursor(0, 1);// goes to my 2nd LCD line
lcd.print("Shot Blizzard");// more LCD text
// initialize the inputs and outputs
// initialize the motor pin as an output:
pinMode(motorPin, OUTPUT);//my first motor will receive information
pinMode(motorPin2, OUTPUT);//my second motor receives information
// initialize the switch pin as an input:
pinMode(switchPin, INPUT);// this pin gives information
pinMode(blueLED, OUTPUT);// my led will receive info
pinMode(redLED, OUTPUT);// same as blue led but red
pinMode(switchAPin, INPUT); //swith a pin gives info
pinMode(blueLED2, OUTPUT);// just another blue led
digitalWrite(blueLED2, HIGH);
// I always want this on so I figured this was a good spot to put it
Serial.begin(6000);// begins a serial port
delay(5000);// need to give time for my startup
lcd.clear();// erase my LCD
lcd.print("How strong do");// start more text
lcd.setCursor(0,1);// set it again
lcd.print("you want it?"); //more text
delay (5000);//wait for it
}
void loop() {
int sensorVal = analogRead(sensorPin);// temperature pin starts to read
Serial.print("sensor value");//serial port print
Serial.print(sensorVal);//serial port print
float voltage = (sensorVal/1024.0)*5.0;// finding voltage
Serial.print("volts");//serial port text
Serial.print(voltage);//serial port writing
Serial.print("degrees C:");// writing in serial port
float temperature = (voltage - .5)*100;// finding Celsius
Serial.println(temperature);// writing in serial port
// read the state of the switch value://
switchState = digitalRead(switchPin);
// check if the switch is pressed.
switchA = digitalRead(switchAPin);//
if (switchA == HIGH) {
i <= 6;
i == i++;
if (i == 7)
i = 1;
}//
delay(100);//
{
if (i == 1) {
lcd.clear();
lcd.print("We don't use");
lcd.setCursor(0,1);
lcd.print("this option (1)");
}//
if (i == 2) {
lcd.clear();
lcd.print("I can still");
lcd.setCursor(0,1);
lcd.print("drive (2)");
}//
if (i == 3) {
lcd.clear();
lcd.print("Little Tipsy (3)");
}//
if (i == 6) {
lcd.clear();
lcd.print("Where are my");
lcd.setCursor(0,1);
lcd.print("pants? (6)");
}//
if (i == 5) {
lcd.clear();
lcd.print("WEEE!!! (5)");
}//
if (i == 4) {
lcd.clear();
lcd.print("gettin crunk (4)");
}
}
// all my menu options
if (switchState == HIGH) {
// turn motor on:
lcd.clear();
lcd.print("dispensing in 3");
delay(1000);
lcd.clear();
lcd.print("dispensing in 2");
delay(1000);
lcd.clear();//
lcd.print("dispensing in 1");//
delay(1000);
lcd.clear();//
lcd.print("dispensing...");// just some fun and make sure its not instant pour
digitalWrite(motorPin, HIGH);//
digitalWrite(motorPin2, LOW);//
digitalWrite(redLED, HIGH);//
digitalWrite(blueLED, LOW);//
if (i==1)
delay(10000);//
if (i==2)
delay(20000);//
if (i==3)
delay(30000);//
if (i==4)
delay(40000);//
if (i==5)
delay(50000);//
if (i==6)
delay(60000);
//time delays based on (i) from my menu
digitalWrite(motorPin, LOW);//
digitalWrite(motorPin2, HIGH);//
digitalWrite(redLED, HIGH);//
digitalWrite(blueLED, LOW);//
delay(10000);//switch from one motor to the other with all my time delays
digitalWrite(motorPin, LOW);//
digitalWrite(motorPin2, LOW);//
digitalWrite(redLED, LOW);//
digitalWrite(blueLED, HIGH);//
lcd.clear();//
lcd.print("R.I.P Mr. Lahey!");//
delay(6000);// just fun texts on my LCD
lcd.clear();//
lcd.print("How drunk");//
lcd.setCursor(0,1);//
lcd.print("are you now?");//
delay(6000);//
lcd.clear();//
lcd.print("...6 out of 10");//
delay(6000);//
lcd.clear();//
lcd.print(" YOU ARE ");//
lcd.setCursor(0,1);//
lcd.print(" THE LIQUOR"); //
delay(6000);//Quotes from the show
lcd.clear();//
lcd.print("temperature");//
lcd.setCursor(0,1);//
lcd.print(temperature);//
lcd.setCursor(6,1);//
lcd.print("°C");//
delay(7000);//showing my temperature on my LCD instead of just my serial port
}
else {
// turn motor off:
digitalWrite(motorPin, LOW);//
digitalWrite(motorPin2, LOW);//
digitalWrite(redLED, LOW);//
digitalWrite(blueLED, HIGH);//
}
}
// if nothing is activated nothing happens