You are on page 1of 9

Maquina Dispensadora de jugo y caf

Al llevar a cabo el desarrollo de una mquina que suministraba lquidos


(jugo y caf) se utilizaron diferentes materiales y componentes
electrnicos, por mencionar algunos una caja hecha completamente de
madera (material reciclado del proyecto #2). Su funcin es simple
dispensar el lquido requerido por el usuario en una forma apropiada
dependiendo de cul sea la eleccin. Para ello se dispuso de un material
suministrado por el profesor para llevar a cabo el mismo, siendo este
una gua apropiada para facilitar la implementacin del proyecto.
Pruebas de bombas con diodos para as regular la presin del lquido
fueron hechas e implementadas eficientemente. Tambin algunos
ensayos en protoboard del circuito funcional tomando en cuenta que las
bombas fueron remplazadas por Leds para facilitar el funcionamiento en
la placa de pruebas. Ya hechas todas las pruebas pertinentes se llevo a
cabo el montaje fsico del circuito en la caja antes mencionada para La
Mquina Dispensadora de jugo y caf. Sin dejar atrs la programacin la
cual estar completamente detallada en el siguiente punto.

Programacin de la Maquina Dispensadora de jugo y caf


/*
File Name: Jugo_o_Cafe_01e - Rev. 16a 06 15
Recursos: Push_Botton #1 (PB_J) - Jugo = DIO 7 + R = 10K ( Conectado
al Negativo de la fuente )
Push_Botton #2 (PB_C) - Cafe = DIO 8 + R = 10K ( Conectado al "-" )
LED #1 (LED_J) - Jugo = DIO 5 (PWM) + R = 1K ( Conectado al "-" )
LED #2 (LED_C) - Cafe = DIO 6 (PWM) + R = 1K ( Conectado al "-" )
FotoResistencia (FR_V) - Vaso - AIN 5 + R = 3.3K ( Conectado al "+" )
LED #3 (LED_V) - Vaso - DIO 13 + R = 1K ( Conectado al "-" )
Prueba #01d - Verificacin de los Botones (PB) y LEDs (LED)
- Uso de una seal anloga - Fija - con el LED_J & LED_C

- Verifica el valor anlogo de la FR_V + Si hay vaso enciende LED_V


- No activa la seal anloga, si no est presente el vaso...
- Incluye el uso del Monitor Serial...
Button - Prueba los botones - Jugo(7) o Cafe(8)
Turns on (PWM) and off a light emitting diode(LED) connected to digital
pin (PWM) 5,6, when pressing a pushbutton attached to pin 7,8. The
circuit:
* LED attached from pin 5,6 with 1K current lim. res. to ground
* pushbutton attached to pin 7,8 from +5V
* 10K resistor attached to pin 7,8 from ground
===========================================
======================
Pump Motor Control using PWM
Adapted from Basic/Fade example.
===========================================
======================
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,2);
// constants won't change. They're used here to
// set pin numbers:
const int button_J = 7; // # of the pushbutton pin - J=Jugo
const int button_C = 8; // # of the pushbutton pin - C=Cafe
const int M1Pin_J = 9; // # of the LED pin - J=Jugo - Must be PWM pin,
goes to motor (gate)

const int M2Pin_C = 10; // # of the LED pin - C=Cafe - Must be PWM pin,
goes to motor (gate) const int ledPin_J = 3; // # of the LED pin - J=Jugo Must be PWM pin, goes to motor (gate)
const int ledPin_C = 5; // # of the LED pin - C=Cafe - Must be PWM pin,
goes to motor (gate)
const int ledPin_V = 13; // # of the LED pin - V=Vaso
// variables will change:
int buttonState_J = 0; // variable for reading the pushbutton status
int buttonState_C = 0; // variable for reading the pushbutton status
int ledState_V = 0; // variable for reading Led_V status
int intensity = 51*2; // Output Volt: 51*1 = 1 voltio; 51*3 = 3 Voltios
// Actual tension: 12 -12*(255-intensity)/255
// Output Volt / Actual Tension:
// 0,1,2,3,4,5 / 0, 2.4, 4.8, 7.2, 9.6, 12 - Calculado... //(0,1,2,3,4,5 / 0, 3.4,
5.6, 7.7, 9.9, 12 ) - Actual w/ BJT...
int photoresistor=0; //this is where our photoresistor Analog Voltage
Digital Value will be stored
void setup() {
// initialize the LED pin as an output:
lcd.init ();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Maquina de Jugo");
lcd.setCursor(5, 1);
lcd.print("Y Cafe");
pinMode(ledPin_J, OUTPUT);
pinMode(ledPin_C, OUTPUT);

pinMode(ledPin_V, OUTPUT);
pinMode(M2Pin_C, OUTPUT);
pinMode(M1Pin_J, OUTPUT); // initialize the pushbutton pin as an input:
pinMode(button_J, INPUT);
pinMode(button_C, INPUT);
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
delay(1000);
lcd.clear();
}
void loop(){lcd.print(" Bienvenido"); // Imprime "Hola"...
lcd.setCursor(0, 1);
lcd.print(" Inserte el vaso");
photoresistor = analogRead(A0); // Read Analog Input #5 ( ATmega328
Pin# 28 )
// read the state of the pushbutton value:
buttonState_J = digitalRead(button_J);
buttonState_C = digitalRead(button_C);
ledState_V = digitalRead(ledPin_V);
// check if pushbutton_J is pressed.
if (buttonState_J == HIGH && buttonState_C == LOW ) {
for ( int x=1; x<=100; x++ ) {
// delay = 30*100 = 3000 ms = 3 Segundos. Making this too small can
damage the motor
photoresistor = analogRead(A0); // Read Analog Input #5 ( ATmega328
Pin# 28 )

while ( photoresistor < 700 ) {


// Wait... while - photoresistor = "No hay Vaso..!"
analogWrite(ledPin_J, 0); // Turn OFF analog output ( JUGO )
analogWrite(M1Pin_J, 0); //Writes PWM to the motor
digitalWrite(ledPin_V, HIGH); // Turn ON ledPin_V. No hay Vaso.
photoresistor = analogRead(A0); // Read Analog Input #5 ( ATmega328
Pin# 28 )
lcd.print("Inserte vaso Cafe"); // Despliega la DATA en el Monitor Serial
delay(5);
lcd.clear();
}
delay(30); // wait for 0.3 second
analogWrite(ledPin_J, intensity); // Writes PWM to the motor
analogWrite(M1Pin_J, intensity); //Writes PWM to the motor
digitalWrite(ledPin_V, LOW); // ledPin_V = OFF. Hay Vaso.
lcd.print("Sirviendo Cafe"); // Despliega la DATA en el Monitor Serial ***
Comment / Delete this line to reduce Delay Overhead...
delay(5);
lcd.clear();
}
}
// check if pushbutton_C is pressed.
if (buttonState_J == LOW && buttonState_C == HIGH) {
for ( int y=1; y<=100; y++ ) {
// Total Delay = 30*100 = 3000 ms = 3 Segundos. Making this too small
can damage the motor

photoresistor = analogRead(A0); // Read Analog Input #5 ( ATmega328


Pin# 28 ) while ( photoresistor < 700 ) {
// Wait... while - photoresistor = "No hay Vaso..!"
analogWrite(ledPin_C, 0); // Turn OFF analog output ( JUGO )
analogWrite(M2Pin_C, 0); //Writes PWM to the motor
digitalWrite(ledPin_V, HIGH); // Turn ON ledPin_V. No hay Vaso.
photoresistor = analogRead(A0); // Read Analog Input #5 ( ATmega328
Pin# 28 )
lcd.print("Inserte el vaso Jugo"); // Despliega la DATA en el Monitor Serial
delay(5);
lcd.clear();
}
delay(30); // Continue... 0.3 second Delay....
analogWrite(ledPin_C, intensity); // Writes PWM to the motor
analogWrite(M2Pin_C, intensity); //Writes PWM to the motor<
digitalWrite(ledPin_V, LOW); // ledPin_V = OFF. Hay Vaso.
lcd.print("Sirviendo Jugo"); // Despliega la DATA en el Monitor Serial ***
Comment / Delete this line to reduce Delay Overhead...
delay(5);
lcd.clear();
}
}
analogWrite (ledPin_J, 0); // Turn OFF analog output - Jugo
analogWrite(M1Pin_J, 0); //Writes PWM to the motor
analogWrite (ledPin_C, 0); // Turn OFF analog output - Cafe
analogWrite(M2Pin_C, 0); //Writes PWM to the motor

digitalWrite(ledPin_V, LOW); // Turn OFF ledPin_V - Vaso


DisplayDATA (); // Despliega la DATA en el Monitor Serial
}
// Despliega la DATA en el Monitor Serial
void DisplayDATA (void)
{
/* ledState_V = digitalRead digitalRead(ledPin_V);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Btn_J = "); // Text...
lcd.print(buttonState_J); // Button_J State...
lcd.print("/Led_J = "); // Text...
lcd.print(5*buttonState_J*intensity/255); // Output Voltage...
lcd.println("Btn_C = "); // Text...
lcd.print(buttonState_C); // Button_C State...
lcd.print("/Led_C = "); // Text...
lcd.print(5*buttonState_C*intensity/255); // Output Voltage.. lcd.print("
");
lcd.print("Fr_V= "); // Text...
lcd.print(photoresistor); // Photoresistor Value...
lcd.print("/Led_V= "); // Text...
lcd.println(ledState_V); // Led_V State...
*/
Serial.print("Btn_J = "); // Text...
Serial.print(buttonState_J); // Button_J State...

Serial.print(" / Led_J = "); // Text...


Serial.print(5*buttonState_J*intensity/255); // Output Voltage...
Serial.print(" Btn_C = "); // Text...
Serial.print(buttonState_C); // Button_C State... Serial.print(" / Led_C = ");
// Text...
Serial.print(5*buttonState_C*intensity/255); // Output Voltage...
Serial.print(" Fr_V = "); // Text...
Serial.print(photoresistor); // Photoresistor Value...
Serial.print(" / Led_V = "); // Text...
Serial.println(ledState_V); // Led_V State...
}
Tabla # .materiales de la Mquina Expendedora de jugo y caf
Cantidad
1
2
1
2
3
1
2
3
2

Materiales
Fotoresistor
Diodos
Arduino Uno
Darlington Tip 120
Resistores de 10k
Pantalla LCD
Bombas de 12 V @ 1 A
LED
Botones

Observaciones:
En las tabla #4 solo se hace mencin a los componentes electrnicos,
sin embargo en en el desarrollo del proyecto se utilizaron otros
componentes como lo fueron madera y tubera (manguera).

Anexos

You might also like