

ESPECIFICACIONES TÉCNICAS
- Tensión de alimentación……………………….…………12VDC
- Corriente de alimentación………………….……………120mA
- Entadas digitales 5-12VDC……………………….……8
- Salidas RLY…………………………………………………………4
-
- Tensión AC…………..……….………………….….……250V
- Corriente AC…………………………………………….10A
- Tensión DC………………………………………………30V
- Corriente DC……………………………………………10A
-
- Entorno de programación………………………..………..Arduino IDE
- Comunicación I2C……………………………….……..………..Sí
- Condiciones ambientales min……………………….….-40°
- Condiciones ambientales max…………………..……….150°
- Dimensiones……………………………………………………….120x100mm
- Empotrable………………………………….……………………Sí
- wifi………………………………………………………………………………Sí
- Bluetooth……………………………………………………………………Sí
- Programación directa (PC-Tarjeta electrónica)…………Sí
LISTA DE MATERIALES
| Quantity | Comment | Designator | Footprint | Value | Manufacturer Part | Manufacturer | Supplier Part |
| 2 | 470uF | C1,C10 | CAP-SMD_BD10.0-L10.3-W10.3-LS11.3-FD | 470uF | VT1V471M1010 | ROQANG(容强) | C310845 |
| 2 | 1uF | C2,C11 | C1206 | 1uF | CL31B105KBHNNNE | SAMSUNG(三星) | C1848 |
| 15 | 100nF | C3,C4,C5,C6,C7,C8,C12,C13, C15,C16,C17,C18,C19,C20,C21 |
C0603 | 100nF | CC0603KRX7R9BB104 | YAGEO(国巨) | C14663 |
| 2 | 220uF | C9,C14 | CAP-SMD_BD6.3-L6.6-W6.6-LS7.2-R-RD | 220uF | RVE1C221M0607 | ROQANG(容强) | C99836 |
| 5 | HCZZ0126-4 | CN1,CN2,CN3,CN4,CN5 | CONN-TH_XH-4A-1 | HCZZ0126-4 | HC(虹成电子) | C7433754 | |
| 1 | PJ-3136-B | CN6 | AUDIO-TH_PJ-3136-B | PJ-3136-B | XKB Connectivity(中国星坤) | C381131 | |
| 6 | SS210 | D1,D2,D3,D4,D5,D6 | SMA_L4.3-W2.6-LS5.2-RD | SS210 | MDD | C14996 | |
| 4 | 1N4148WS | D7,D8,D9,D10 | SOD-323_L1.8-W1.3-LS2.5-RD | 1N4148WS | CJ(江苏长电/长晶) | C2128 | |
| 1 | BSMD1206-100-24V | F1 | F1206 | BSMD1206-100-24V | BHFUSE(佰宏) | C910830 | |
| 2 | 68uH | L1,L2 | IND-SMD_L7.1-W6.6-1 | 68uH | PSPMAA0605H-680M-IGF | PROD(谱罗德) | C2983094 |
| 13 | KT-0805G | LED1,LED2,LED3,LED4,LED5, LED6,LED7,LED8,LED9,LED10, LED11,LED12,LED13 |
LED0805-R-RD | KT-0805G | KENTO | C2297 | |
| 4 | WJ128V-5.0-2P | P1,P4,P5,P6 | CONN-TH_2P-P5.00_WJ128V-5.0-2P | WJ128V-5.0-2P | KANGNEX(康奈克斯电气) | C8269 | |
| 6 | WJ128V-5.0-3P | P2,P3,P7,P8,P9,P10 | CONN-TH_3P-P5.00_WJ128V-5.0-3P | WJ128V-5.0-3P | KANGNEX(康奈克斯电气) | C8270 | |
| 6 | MMBT3904 | Q1,Q2,Q3,Q4,Q5,Q6 | SOT-23-3_L2.9-W1.3-P1.90-LS2.4-BR | MMBT3904 | CJ(江苏长电/长晶) | C20526 | |
| 12 | 2.2kΩ | R1,R2,R3,R4,R5,R6,R21 ,R22,R53,R54,R55,R56 |
R0805 | 2.2kΩ | 0805W8F2201T5E | UNI-ROYAL(厚声) | C17520 |
| 21 | 10kΩ | R7,R8,R9,R10,R11,R12, R23,R24,R25,R26,R32,R35, R36,R37,R38,R39,R40,R45, R46,R47,R48 |
R0603 | 10kΩ | 0603WAF1002T5E | UNI-ROYAL(厚声) | C25804 |
| 21 | 1kΩ | R13,R14,R15,R16,R17,R18, R19,R20,R27,R28,R29,R30, R31,R33,R34,R49,R50,R51, R52,R57,R58 |
R0603 | 1kΩ | 0603WAF1001T5E | UNI-ROYAL(厚声) | C21190 |
| 4 | 330Ω | R41,R42,R43,R44 | R0805 | 330Ω | 0805W8F3300T5E | UNI-ROYAL(厚声) | C17630 |
| 4 | SRD-12VDC-SL-C | RELAY1,RELAY2,RELAY3 ,RELAY4 |
RELAY-TH_SRD-XXVDC-XL-C | SRD-12VDC-SL-C | 松乐 | C30431 | |
| 1 | EC11E18244AU | SW1 | SW-TH_EC11XXXXXXXX | EC11E18244AU | ALPSALPINE(阿尔卑斯阿尔派) | C202365 | |
| 8 | EL357N(C)(TA)-G | U1,U2,U3,U4,U5,U6, U10,U11 |
OPTO-SMD-4_L4.4-W4.1-P2.54-LS7.0-TL | EL357N(C)(TA)-G | EVERLIGHT(亿光) | C29981 | |
| 1 | LM2594M-5.0 | U7 | SOP-8_L4.9-W3.9-P1.27-LS6.0-BL | LM2594M-5.0 | UMW(友台半导体) | C2904795 | |
| 1 | U8 | mp3 player | |||||
| 1 | LM2594M-3.3 | U9 | SOP-8_L4.9-W3.9-P1.27-LS6.0-BL | LM2594M-3.3 | UMW(广东友台半导体) | C3029048 | |
| 1 | CH340C | U12 | SOP-16_L10.0-W3.9-P1.27-LS6.0-BL | CH340C | WCH(南京沁恒) | C84681 | |
| 4 | EL3H7(B)(TA)-G | U13,U14,U15,U16 | SOP-4_L4.4-W2.8-P1.27-LS7.0-TL | EL3H7(B)(TA)-G | EVERLIGHT(亿光) | C32565 | |
| 1 | ESP32-WROOM-32D-N4 | U17 | WIFIM-SMD_39P-L25.5-W18.0-P1.27-BL | ESP32-WROOM-32D-N4 | ESPRESSIF(乐鑫) | C473012 | |
| 1 | USB-TYPE-C-018 | USB1 | USB-C_SMD-TYPE-C-31-M-12 | USB-TYPE-C-018 | DEALON(德艺隆) | C2927038 |
CODIGO
//#include "Arduino.h"
#include <LiquidCrystal_I2C.h> // Debe descargar la Libreria que controla el I2C
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
// ENTRADAS DIGITALES EXTERNAS NEGATIVOS
const int in1 = 26; // Sensor de flujo
const int in2 = 34; // dispensador de monedas
const int in3 = 33; // sensor capacitivo
const int in4 = 32; // pulsador de lavado
const int in5 = 35; // pulsador de start
//const int in6 = 34; // pausa/reanudar
const int in7 = 14; // free
const int in8 = 27; // free
// ENTRADAS ROTARY SWITCH
const int left = 18;
const int right = 19;
const int intro = 23;
// SALIDAS RELAYS
const int M_LAV = 15; // BOMBA PARA LAVADO
const int M_AGUA = 2; // BOMBA PARA AGUA
const int MONEDERO = 4; // BOMBA PARA ESTERILIZADO
const int Reserva = 5; // SALIDA DE RESERVA
volatile double flujo; // variable que guarda los pulsos
int filling = 0; // variable para captar esos pulsos del sensor de flujo
int coin = 0; // señal de monedero
int B_lav = 0; // señal pulsador lavado
int B_est = 0; // señal pulsador esterilizado
int star = 0; // señal de start
int sen_p = 0;
boolean B_lavAct = false;
int audio_act = false;
int STOP = 0; // para la lectura del Pulsador STOP
int STOP_VALUE1 = 0;
int STOP_VALUE2 = 0;
int t1 = 0;
int t2 = 0;
int t3 = 0;
int t_lav = 3; // definir tiempo de lavado - ahora 3 seg
int t_est = 4; // definir tiempo de esterilizado - ahora 4seg
int t_thx = 5; // tiempo mensaje final 5seg
int LAST_C_P = 0;
byte money = 0; // aqui almacena la cantidad de monedas ingresadas
boolean E0, E1, E2, E3, E4, E5 = false; // VARIABLES DE ESTADOS
boolean T01, T12, T23, T34, T45, T50 = false; // VARIABLES DE TRANSICIONES
int valorsoles = 0;
int valortemporal = 0;
int valortemporal1 = 0;
int durMsL;
int durationL;
int contadorPulsos = 0; // Variable para contar los pulsos
int acumuladoSoles = 0; // Variable para el monto acumulado en dólares
void setup() {
// Serial.begin(115200);
lcd.init();
lcd.backlight();
lcd.clear();
pinMode(in1, INPUT);
pinMode(in2, INPUT);
pinMode(in3, INPUT);
pinMode(in4, INPUT);
pinMode(in5, INPUT);
// pinMode(in6, INPUT);
pinMode(in7, INPUT);
pinMode(in8, INPUT);
flujo = 0;
attachInterrupt(in1, flujo_pulse, FALLING); //DIGITAL Pin 2: Interrupt 0
// attachInterrupt(in2, coin_pulse, RISING); //DIGITAL Pin 2: Interrupt 0
pinMode(M_LAV, OUTPUT);
pinMode(M_AGUA, OUTPUT);
pinMode(MONEDERO, OUTPUT);
pinMode(Reserva, OUTPUT);
}
void loop() {
coin = digitalRead(in2); // señal que viene del monedero
sen_p = digitalRead(in3); // sensor de presencia
B_lav = digitalRead(in4); // boton lavado
star = digitalRead(in5);
// STOP = digitalRead(in6);
if (coin != LAST_C_P) {
if (coin == LOW) {
if (acumuladoSoles < 7) {
contadorPulsos++;
}
}
}
LAST_C_P = coin;
/* if (digitalRead(in2) == 1) {
if (acumuladoSoles < 7) {
contadorPulsos++;
lcd.clear();
}
}*/
if (E0 == true || E1 == true) {
if (contadorPulsos == true) {
acumuladoSoles += contadorPulsos;
contadorPulsos = 0;
}
}
//INICIALIZACION***************************
if ((!E1 && !E2 && !E3 && !E4 && !E5) == true) {
E0 = true;
}
//TRANSITION*********************************
//from
if (E0 == true && (acumuladoSoles >= 1 && acumuladoSoles <= 7)) {
lcd.clear();
T01 = true;
T50 = false;
}
if (E1 == true && B_lav == true && B_lavAct == true) {
lcd.clear();
T12 = true;
T01 = false;
}
if (E2 == true && t1 == t_lav) {
lcd.clear();
T23 = true;
T12 = false;
}
if (E3 == true && star == true) {
lcd.clear();
T34 = true;
T23 = false;
}
if (E4 == true && (filling == 1 || filling == 2 || filling == 7 || filling == 10)) {
lcd.clear();
T45 = true;
T34 = false;
}
if (E5 == true && t3 == t_thx) {
lcd.clear();
T50 = true;
T45 = false;
}
//ETAPA**************************************
if (E0 && T01 == true) {
E0 = false;
E1 = true;
}
if (E1 && T12 == true) {
E1 = false;
E2 = true;
}
if (E2 && T23 == true) {
E2 = false;
E3 = true;
}
if (E3 && T34 == true) {
E3 = false;
E4 = true;
}
if (E4 && T45 == true) {
E4 = false;
E5 = true;
}
if (E5 && T50 == true) {
E5 = false;
E0 = true;
}
//ACTUADORES*********************************
// REPOSO************************************************** E0
if (E0 == true) {
digitalWrite(M_LAV, 0);
digitalWrite(M_AGUA, 0);
flujo = 0;
filling = 0;
if (acumuladoSoles == 0) {
lcd.setCursor(0, 0);
lcd.print("****BIENVENIDOS*****"); // aqui cambiar la bienvenida
lcd.setCursor(0, 1);
lcd.print("INSERTE MONEDAS");
lcd.setCursor(0, 2);
lcd.print("SEGUN LOS PRECIOS");
lcd.setCursor(0, 3);
lcd.print("FIJADOS.");
}
}
// ACUMULANDO MONEDAS & PRESS LAVADO ********************** E1
if (E1 == true) {
lcd.setCursor(3, 0);
lcd.print("TIENE UN SALDO");
lcd.setCursor(0, 1);
lcd.print("DE: S/ ");
lcd.print(acumuladoSoles);
if (acumuladoSoles == 1 || acumuladoSoles == 3 || acumuladoSoles == 5 || acumuladoSoles == 7) {
B_lavAct = true;
if (acumuladoSoles == 1) { // cambiar el valor si desea
lcd.setCursor(10, 1);
lcd.print("= 0.4 L.");
lcd.setCursor(0, 2);
lcd.print("Presione lavado");
lcd.setCursor(0, 3);
lcd.print("PARA CONTINUAR");
}
if (acumuladoSoles == 3) {
lcd.setCursor(10, 1);
lcd.print(" = 1.5 L.");
lcd.setCursor(0, 2);
lcd.print("Presione lavado");
lcd.setCursor(0, 3);
lcd.print("PARA CONTINUAR");
}
if (acumuladoSoles == 5) {
lcd.setCursor(10, 1);
lcd.print(" = 7 Ltrs.");
lcd.setCursor(0, 2);
lcd.print("Presione lavado");
lcd.setCursor(0, 3);
lcd.print("PARA CONTINUAR");
}
if (acumuladoSoles == 7) {
lcd.setCursor(10, 1);
lcd.print(" = 10 Ltrs");
lcd.setCursor(0, 2);
lcd.print("Presione lavado");
lcd.setCursor(0, 3);
lcd.print("PARA CONTINUAR");
}
} else {
lcd.setCursor(0, 2);
lcd.print("Cantidad no valalido");
lcd.setCursor(0, 3);
lcd.print("INSERTE MAS MONEDAS");
B_lavAct = false;
}
}
// LAVANDO ************************************************** E2
if (E2 == true) {
digitalWrite(M_LAV, 1);
lcd.setCursor(1, 1);
lcd.print("***** LAVANDO ****");
t3 = 0;
t1++;
delay(1000);
}
// PRESIONE START PARA LLENAR ******************************* E3
if (E3 == true) {
digitalWrite(M_LAV, 0);
lcd.setCursor(5, 0);
lcd.print("Press START ");
lcd.setCursor(1, 2);
lcd.print("PARA LLENAR AGUA");
flujo = 0;
}
// LLENANDO AGUA********************************************* E4
if (E4 == true) {
if (STOP && STOP_VALUE1 == 0) {
STOP_VALUE2 = 1 - STOP_VALUE2;
}
STOP_VALUE1 = STOP;
if (STOP_VALUE2 == 0) {
digitalWrite(M_AGUA, 1);
} else if (STOP_VALUE2 == 1) {
digitalWrite(M_AGUA, 0);
}
if (acumuladoSoles == 1) {
lcd.setCursor(5, 0);
lcd.print("LLENANDO...");
lcd.setCursor(0, 1);
lcd.print("0.4 Litro de agua");
lcd.setCursor(0, 3);
lcd.print("PROCESO Ltrs. = ");
lcd.print(flujo);
if (flujo >= 0.4) {
filling = 1;
}
}
if (acumuladoSoles == 3) {
lcd.setCursor(5, 0);
lcd.print("LLENANDO...");
lcd.setCursor(0, 1);
lcd.print("1.5 Litros de agua");
lcd.setCursor(0, 3);
lcd.print("PROCESO Ltrs. = ");
lcd.print(flujo);
if (flujo >= 1.5) {
filling = 2;
}
}
if (acumuladoSoles == 5) {
lcd.setCursor(5, 0);
lcd.print("LLENANDO...");
lcd.setCursor(3, 1);
lcd.print("7 Litros de agua");
lcd.setCursor(0, 3);
lcd.print("PROCESO Ltrs. = ");
lcd.print(flujo);
if (flujo >= 7.0) {
filling = 7;
}
}
if (acumuladoSoles == 7) {
lcd.setCursor(5, 0);
lcd.print("LLENANDO...");
lcd.setCursor(3, 1);
lcd.print("10 Litros de agua");
lcd.setCursor(0, 3);
lcd.print("PROCESO Ltrs. = ");
lcd.print(flujo);
if (flujo >= 10.0) {
filling = 10;
}
}
}
// COMPLETADO ************************************************** E5
if (E5 == true) {
digitalWrite(M_AGUA, 0);
lcd.setCursor(1, 0);
lcd.print("COMPLETO, LLENO");
lcd.setCursor(3, 2);
lcd.print("MUCHAS GRACIAS");
acumuladoSoles = 0;
t1 = 0;
t2 = 0;
t3++;
delay(1000);
}
}
void flujo_pulse() {
flujo += 1.0 / 500.0; // este es para ir ajustando la cantidad de litros
}