

INTRODUCCIÓN
Si bien es cierto, ya hemos publicado varias versiones de tarjetas electrónicas para elevadores y ascensores de carga, todas ellas controladas con microcontroladores ATmega.
En esta nueva versión damos un paso importante y utilizamos un cerebro mucho más potente: el ESP32.
Esta es la primera gran mejora.
Gracias a este microcontrolador, ahora disponemos de cuatro entradas adicionales, las cuales pueden utilizarse, por ejemplo, para habilitar un quinto piso o para integrar sensores de seguridad, como el sensor de puerta cerrada.
En total, contamos con 12 entradas digitales de 24 voltios.
Además, incorporamos dos salidas adicionales.
Anteriormente solo teníamos tres salidas, pero ahora, con estas nuevas incorporaciones, ya tenemos la posibilidad de controlar directamente la apertura y el cierre de las puertas del ascensor.
Además, la lógica y el funcionamiento general es mucho más seguro que la anterior versión anterior.
DATOS TÉCNICOS
- Tensión de alimentación……………………….…………24VDC
- Corriente de alimentación………………….……………40mA
- Entadas digitales 12-24VDC……………………….……12
- Pantalla display de 7 seg ……………………………… Sí
- Salidas RLY…………………………………………………………5
-
- Tensión AC…………..……….………………….….……250V
- Corriente AC…………………………………………….5A
- Tensión DC………………………………………………30V
- Corriente DC……………………………………………5A
-
- Entorno de programación………………………..………..Arduino IDE
- Condiciones ambientales min……………………….….-40°
- Condiciones ambientales max…………………..……….80°
- Pulsadores de maniobra…………………………………………..Sí
- Dimensiones……………………………………………………….105x105mm
- Empotrable………………………………….……………………Sí
- Puerto de programación…………………………………………Sí
LISTA DE MATERIALES
| No. | Quantity | Comment | Designator | Footprint | Value | Manufacturer Part | Manufacturer |
| 1 | 1 | 470uF | C1 | CAP-SMD_BD10.0-L10.3-W10.3-LS11.3-FD | 470uF | VT1V471M1010 | ROQANG(容强) |
| 2 | 1 | 1uF | C2 | C1206 | 1uF | CL31B105KBHNNNE | SAMSUNG(三星) |
| 3 | 1 | 330uF | C3 | CAP-SMD_BD6.3-L6.6-W6.6-LS7.6-RD | 330uF | 189RV0016 | KNSCHA(科尼盛) |
| 4 | 33 | 100nF | C4,C5,C6,C7,C8,C9,C10,C11,C12, C13,C14,C15,C16,C17,C18,C19, C20,C21,C22,C23,C24,C25,C26, C27,C28,C29,C30,C31,C32,C33, C34,C35,C36 |
C0603 | 100nF | CC0603KRX7R9BB104 | YAGEO(国巨) |
| 5 | 1 | 2.0-2*4P直简牛 | CN1 | IDC-TH_8P-P2.00_BOOMELE2X4P | 2.0-2*4P直简牛 | BOOMELE(博穆精密) | |
| 6 | 5 | SS210 | D1,D2,D3,D4,D5 | SMA_L4.3-W2.6-LS5.2-RD | SS210 | MDD | |
| 7 | 5 | 1N4148WS | D6,D7,D8,D9,D10 | SOD-323_L1.8-W1.3-LS2.5-RD | 1N4148WS | CJ(江苏长电/长晶) | |
| 8 | 1 | 47uH | L1 | IND-SMD_L7.0-W6.6_FXL0630 | 47uH | FXL0630-470-M | cjiang(长江微电) |
| 9 | 18 | KT-0805G | LED1,LED2,LED3,LED4,LED5, LED6,LED7,LED8,LED9,LED10, LED11,LED12,LED13,LED15, LED16,LED17,LED18,LED19 |
LED0805-R-RD | KT-0805G | KENTO | |
| 10 | 1 | SM420561N | LED14 | LED-SEG-TH_10P-L12.7-W19.0-P2.54-S15.24-BL | SM420561N | ARKLED(方舟) | |
| 11 | 4 | WJ128V-5.0-3P | P1,P2,P3,P4 | CONN-TH_3P-P5.00_WJ128V-5.0-3P | WJ128V-5.0-3P | KANGNEX(康奈克斯电气) | |
| 12 | 6 | WJ128V-5.0-2P | P5,P6,P7,P8,P9,P10 | CONN-TH_2P-P5.00_WJ128V-5.0-2P | WJ128V-5.0-2P | KANGNEX(康奈克斯电气) | |
| 13 | 5 | MMBT3904 | Q1,Q2,Q3,Q4,Q5 | SOT-23-3_L2.9-W1.3-P1.90-LS2.4-BR | MMBT3904 | CJ(江苏长电/长晶) | |
| 14 | 12 | 10kΩ | R1,R2,R3,R4,R5,R6,R7, R8,R9,R10,R11,R12 |
R0805 | 10kΩ | 0805W8F1002T5E | UNI-ROYAL(厚声) |
| 15 | 27 | 10kΩ | R13,R14,R15,R16,R17,R18, R19,R20,R21,R22,R23,R24, R38,R39,R40,R41,R42,R51, R52,R53,R54,R55,R61,R62, R63,R64,R65 |
R0603 | 10kΩ | 0603WAF1002T5E | UNI-ROYAL(厚声) |
| 16 | 18 | 1kΩ | R25,R26,R27,R28,R29,R30, R31,R32,R33,R34,R35,R36, R37,R66,R67,R68,R69,R70 |
R0603 | 1kΩ | 0603WAF1001T5E | UNI-ROYAL(厚声) |
| 17 | 8 | 470Ω | R43,R44,R45,R46,R47,R48, R49,R50 |
R0603 | 470Ω | 0603WAF4700T5E | UNI-ROYAL(厚声) |
| 18 | 5 | 220Ω | R56,R57,R58,R59,R60 | R0603 | 220Ω | 0603WAF2200T5E | UNI-ROYAL(厚声) |
| 19 | 5 | 4.7kΩ | R71,R72,R73,R74,R75 | R0805 | 4.7kΩ | 0805W8F4701T5E | UNI-ROYAL(厚声) |
| 20 | 5 | G5NB-1A-E-24VDC | RLY1,RLY2,RLY3,RLY4,RLY5 | RELAY-TH_G5NB-1A-E-24VDC | G5NB-1A-E-24VDC | OMRON(欧姆龙) | |
| 21 | 3 | TS665CJ | SW1,SW2,SW3 | SW-TH_4P-L6.0-W6.0-P4.50-LS6.5 | TS665CJ | SHOU HAN(首韩) | |
| 22 | 22 | Test-Point | TP1,TP2,TP3,TP4,TP5,TP6, TP7,TP8,TP9,TP10,TP11, TP12,TP13,TP14,TP15, TP16,TP17,TP18,TP19,TP20,TP21,TP22 |
Test-Point-0.5mm | |||
| 23 | 1 | LM2594M-3.3 | U1 | SOP-8_L4.9-W3.9-P1.27-LS6.0-BL | LM2594M-3.3 | UMW(广东友台半导体) | |
| 24 | 17 | EL357N(C)(TA)-G | U2,U3,U4,U5,U6,U7,U8,U9,U10, U11,U12,U13,U18,U19,U20,U21,U22 |
OPTO-SMD-4_L4.4-W4.1-P2.54-LS7.0-TL | EL357N(C)(TA)-G | EVERLIGHT(亿光) | |
| 25 | 2 | SN74HC541PWR | U14,U15 | TSSOP-20_L6.5-W4.4-P0.65-LS6.4-BL | SN74HC541PWR | TI(德州仪器) | |
| 26 | 1 | ESP32-WROOM-32E-N4 | U16 | WIFI-SMD_ESP32-WROOM-32E | ESP32-WROOM-32E-N4 | ESPRESSIF(乐鑫) | |
| 27 | 1 | 74HC595D,118 | U17 | SOIC-16_L9.9-W3.9-P1.27-LS6.0-BL | 74HC595D,118 | Nexperia(安世) | |
| 28 | 2 | 74HC14D,653 | U23,U24 | SOIC-14_L8.7-W3.9-P1.27-LS6.0-BL | 74HC14D,653 | Nexperia(安世) |
FUNCIONAMIENTO DE PULSADORES DE MANIOBRA
¿Para qué sirve?
Modo de control manual para mantenimiento y pruebas.
El ascensor no responde a llamadas automáticas.
Controles
| Botón | Función |
|---|---|
| OK (D2) | Entrar / salir del modo maniobra |
| SUBIR (D15) | Sube mientras se mantiene presionado |
| BAJAR (D4) | Baja mientras se mantiene presionado |
Uso básico
-
Presione OK (D2) → entra en modo maniobra
-
Mantenga SUBIR o BAJAR para mover el ascensor
-
Suelte el botón → el motor se detiene
-
Presione OK (D2) para salir
Seguridad
-
Si no se presiona ningún botón → motor detenido
-
Si se presionan SUBIR y BAJAR juntos → motor detenido
-
El piso detectado se muestra en el display
-
Tiempo máximo: 30 segundos (sale automáticamente)
Al salir del modo
-
El motor se detiene
-
El sistema se reinicia
-
Vuelve al modo automático de forma segura
⚠️ Uso exclusivo para personal técnico
No utilizar con pasajeros dentro.
CODIGO ARDUINO
// ============================================
// CONTROL DE ASCENSOR - MODO NORMAL (SIN MANIOBRA)
// ============================================
// -------- PINES SENSORES DE PISO ----------
#define S1 13
#define S2 12
#define S3 14
#define S4 27
// -------- PINES PULSADORES ----------
#define B1 26
#define B2 25
#define B3 33
#define B4 32
#define CONTINUE_BTN 36
#define DOOR_SENSOR 39
// -------- MOTOR ----------
#define MOTOR_UP 19
#define MOTOR_DOWN 18
// -------- DISPLAY 7 SEGMENTOS ----------
#define DS_PIN 21
#define SH_PIN 22
#define ST_PIN 23
// -------- CONSTANTES ----------
#define INIT_SEARCH_TIME 10000
#define SENSOR_CHECK_INTERVAL 50
// -------- ESTADOS ----------
enum SystemState {
STATE_INITIAL_SEARCH,
STATE_REPOSE,
STATE_MOVING,
STATE_WAITING_CONTINUE
};
SystemState currentState = STATE_INITIAL_SEARCH;
// -------- VARIABLES ----------
int currentFloor = 0;
int targetFloor = 0;
bool directionUp = true;
bool doorsClosed = true;
unsigned long searchStartTime = 0;
unsigned long lastSensorCheck = 0;
// -------- COLA ----------
#define MAX_REQUESTS 8
int requestQueue[MAX_REQUESTS];
int requestCount = 0;
// -------- DISPLAY ----------
byte digitPatterns[5] = {
0b11111100, // 0
0b01100000, // 1
0b11011010, // 2
0b11110010, // 3
0b01100110 // 4
};
// ============================================
// SETUP
// ============================================
void setup() {
Serial.begin(115200);
pinMode(S1, INPUT); pinMode(S2, INPUT);
pinMode(S3, INPUT); pinMode(S4, INPUT);
pinMode(B1, INPUT); pinMode(B2, INPUT);
pinMode(B3, INPUT); pinMode(B4, INPUT);
pinMode(CONTINUE_BTN, INPUT);
pinMode(DOOR_SENSOR, INPUT);
pinMode(MOTOR_UP, OUTPUT);
pinMode(MOTOR_DOWN, OUTPUT);
pinMode(DS_PIN, OUTPUT);
pinMode(SH_PIN, OUTPUT);
pinMode(ST_PIN, OUTPUT);
stopMotor();
updateDisplay(0);
if (checkAnySensorActive()) {
determineCurrentFloor();
currentState = STATE_REPOSE;
updateDisplay(currentFloor);
} else {
startInitialSearch();
}
}
// ============================================
// LOOP
// ============================================
void loop() {
doorsClosed = (digitalRead(DOOR_SENSOR) == HIGH);
switch (currentState) {
case STATE_INITIAL_SEARCH: handleInitialSearch(); break;
case STATE_REPOSE: handleRepose(); break;
case STATE_MOVING: handleMoving(); break;
case STATE_WAITING_CONTINUE: handleWaitingContinue(); break;
}
readFloorButtons();
delay(10);
}
// ============================================
// FUNCIONES DE SENSORES
// ============================================
int readSensor() {
if (digitalRead(S1)) return 1;
if (digitalRead(S2)) return 2;
if (digitalRead(S3)) return 3;
if (digitalRead(S4)) return 4;
return 0;
}
bool checkAnySensorActive() {
return readSensor() > 0;
}
void determineCurrentFloor() {
currentFloor = readSensor();
}
// ============================================
// BÚSQUEDA INICIAL
// ============================================
void startInitialSearch() {
digitalWrite(MOTOR_DOWN, HIGH);
searchStartTime = millis();
}
void handleInitialSearch() {
int f = readSensor();
if (f > 0) {
stopMotor();
currentFloor = f;
updateDisplay(f);
currentState = STATE_REPOSE;
}
}
// ============================================
// REPOSO
// ============================================
void handleRepose() {
updateDisplay(currentFloor);
if (requestCount > 0 && doorsClosed) {
targetFloor = getNextFloor();
directionUp = targetFloor > currentFloor;
startMotor();
currentState = STATE_MOVING;
}
}
// ============================================
// MOVIMIENTO
// ============================================
void handleMoving() {
if (!doorsClosed) {
stopMotor();
currentState = STATE_REPOSE;
return;
}
if (millis() - lastSensorCheck >= SENSOR_CHECK_INTERVAL) {
lastSensorCheck = millis();
int f = readSensor();
if (f > 0) {
currentFloor = f;
updateDisplay(f);
if (f == targetFloor) {
stopMotor();
removeFromQueue(f);
currentState = STATE_WAITING_CONTINUE;
}
}
}
}
// ============================================
// ESPERA CONTINUAR
// ============================================
void handleWaitingContinue() {
if (doorsClosed && digitalRead(CONTINUE_BTN)) {
currentState = STATE_REPOSE;
}
}
// ============================================
// MOTOR
// ============================================
void startMotor() {
stopMotor();
if (directionUp) digitalWrite(MOTOR_UP, HIGH);
else digitalWrite(MOTOR_DOWN, HIGH);
}
void stopMotor() {
digitalWrite(MOTOR_UP, LOW);
digitalWrite(MOTOR_DOWN, LOW);
}
// ============================================
// COLA
// ============================================
void readFloorButtons() {
if (digitalRead(B1)) addToQueue(1);
if (digitalRead(B2)) addToQueue(2);
if (digitalRead(B3)) addToQueue(3);
if (digitalRead(B4)) addToQueue(4);
}
void addToQueue(int f) {
for (int i = 0; i < requestCount; i++)
if (requestQueue[i] == f) return;
if (requestCount < MAX_REQUESTS)
requestQueue[requestCount++] = f;
}
void removeFromQueue(int f) {
for (int i = 0; i < requestCount; i++) {
if (requestQueue[i] == f) {
for (int j = i; j < requestCount - 1; j++)
requestQueue[j] = requestQueue[j + 1];
requestCount--;
return;
}
}
}
int getNextFloor() {
return requestQueue[0];
}
// ============================================
// DISPLAY
// ============================================
void updateDisplay(int n) {
if (n < 0 || n > 4) n = 0;
digitalWrite(ST_PIN, LOW);
shiftOut(DS_PIN, SH_PIN, LSBFIRST, digitPatterns[n]);
digitalWrite(ST_PIN, HIGH);
}