Community project

Estación RFID De Llaves

Photo of Estación RFID De Llaves
Generated with AI

Walter Ernesto Mena Calderon

Published November 23, 2026

La Estación RFID De Llaves es un sistema de control de acceso basado en ESP32 que lee tarjetas RFID para activar un servo motor y desbloquear puertas o cajas. El proyecto integra un módulo MFRC522 para la lectura sin contacto, un servo SG90 para el mecanismo de apertura, sensores magnéticos (YL-99 y KY-025) para monitoreo de estado, y conectividad WiFi para configuración remota.

Esta guía proporciona el diagrama de cableado completo, lista de componentes, firmware Arduino listo para cargar, y pasos de ensamblaje en protoboard. Los usuarios aprenderán a configurar la comunicación SPI con el lector RFID, calibrar el servo, implementar un portal WiFi de configuración segura con contraseña aleatoria, y diagnosticar el sistema mediante monitoreo serial de UIDs de tarjetas y estados de sensores.

Wiring diagram

Wiring diagram for Estación RFID De Llaves
Loading diagram…

Gather all the parts

QtyComponent
1

MFRC522 RFID Module

13.56 MHz RFID reader/writer module based on the NXP MFRC522 IC. Communicates over SPI and is commonly sold as an RC522 breakout with an onboard antenna.

1

SG90 Servo

Micro servo motor (SG90)

1

Push Button

Contacto seco, normalmente abierto

Momentary push button switch

1

LED

Rojo 5 mm

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 Ω, 1/2 W

Through-hole resistor (current-limiting in series with an LED)

1

Breadboard 830 points

A full-size solderless breadboard with 830 tie points (MB-102 size), with socket grids on both sides of a centre channel and red and blue power rails along the long edges. LEDs, buttons, resistors, potentiometers, buzzers and jumper wires push into it without soldering. In a generated housing it rests in a screwless tray and carries those small parts inside the case.

1

Electrolytic Capacitor

470 µF / 10 V, recomendado

Radial aluminium electrolytic capacitor bought by value and voltage rating, such as 10 µF, 100 µF or 1000 µF 10 V. It is polarised: the + lead goes to the higher voltage and the - lead, marked by the stripe on the sleeve, to the lower voltage or ground. It is mostly used for bulk filtering across a power rail, with a voltage rating comfortably above the rail.

1

YL-99

YL-99; conectar según la serigrafía o polaridad medida, no por posición.

1

KY-025

KY-025; conectar según la serigrafía o polaridad medida, no por posición.

1

Fuente DC regulada 5 V / 1 A, barril 5.5 × 2.5 mm

Fuente DC regulada 5 V / 1 A, barril 5.5 × 2.5 mm; conectar según la serigrafía o polaridad medida, no por posición.

1

Adaptador hembra 5.5 × 2.5 mm a bornes (adicional)

Adaptador hembra 5.5 × 2.5 mm a bornes (adicional); conectar según la serigrafía o polaridad medida, no por posición.

Assemble it in 3 steps

1. Preparar la protoboard horizontal

Deja el ESP32 y los módulos fuera de la protoboard. Usa cables desde los pines rotulados a las columnas indicadas en MONTAJE.md. Verifica continuidad de los rieles sin alimentación.

2. Cablear lógica y LED

Distribuye 3V3 y GND. Conecta SPI y los sensores. Monta la resistencia entre E25 y E28; ánodo en D28 y cátodo en D29. El cable de GPIO26 llega a A25. Une A29 a GND.

  • No conectes IRQ ni AO. El pulsador solo se cablea así si es de contacto seco.

3. Conectar la rama del servo

Mide la polaridad real en el adaptador, desconecta la fuente y lleva el positivo al riel exclusivo del servo, y el negativo a GND común. Si montas C1, respeta su polaridad. Alimenta la placa solo por USB.

  • Nunca unir el positivo del barril a VIN, USB ni 3V3. Mantén el brazo sin carga en las primeras pruebas.

Review all connections

1. Connections between "rfid" and "ESP32"

FunctionrfidESP32
spiSDAGPIO 4
spiSCKGPIO 18
spiMOSIGPIO 23
spiMISOGPIO 19
digitalRSTGPIO 22
powerVCC3V3
groundGNDGND

2. Connections between "servo" and "ESP32"

FunctionservoESP32
pwmSIGNALGPIO 25
powerVCC5V
groundGNDGND

3. Connections between "llave" and "ESP32"

FunctionllaveESP32
digitalOUTGPIO 33
powerVCC3V3
groundGNDGND

4. Connections between "puerta" and "ESP32"

FunctionpuertaESP32
digitalDOGPIO 32
powerVCC3V3
groundGNDGND

5. Connections between "boton" and "ESP32"

FunctionbotonESP32
digitalSIGNALGPIO 27
groundGNDGND

6. Connections between "r1" and "ESP32"

Functionr1ESP32
digitalP1GPIO 26
digitalP2 → LED ANODEEXT

7. Connections between "led" and "ESP32"

FunctionledESP32
groundGNDGND

8. Connections between "fuente" and "ESP32"

FunctionfuenteESP32
powerPOS5V
groundNEGGND

9. Connections between "c1" and "ESP32"

Functionc1ESP32
power+5V
ground-GND

Deploy the firmware

#include <Arduino.h>
#include <SPI.h>
#include <MFRC522.h>
#include <WiFiManager.h>
constexpr int CS=4, RST=22, LED=26, KEY=33, DOOR=32, BUTTON=27, SERVO=25;
MFRC522 reader(CS,RST);
WiFiManager wifi;
void setup(){
 Serial.begin(115200);
 pinMode(LED,OUTPUT); digitalWrite(LED,LOW);
 pinMode(SERVO,OUTPUT); digitalWrite(SERVO,LOW); // Sin pulsos: diagnóstico sin apertura
 pinMode(KEY,INPUT); pinMode(DOOR,INPUT); pinMode(BUTTON,INPUT_PULLUP);
 SPI.begin(18,19,23,CS); reader.PCD_Init(); reader.PCD_DumpVersionToSerial();
 WiFi.mode(WIFI_STA); WiFi.begin(); wifi.setConfigPortalTimeout(120);
 Serial.println("Diagnostico: mantener pulsador 2 segundos para configurar WiFi.");
}
void loop(){
 static int key=-1, door=-1; static bool held=false, fired=false;
 static uint32_t start=0;
 int k=digitalRead(KEY), d=digitalRead(DOOR);
 if(k!=key || d!=door){key=k;door=d;Serial.printf("YL99=%d KY025=%d\n",k,d);}
 if(digitalRead(BUTTON)==LOW){
   if(!held){held=true;start=millis();Serial.println("Pulsador LOW");}
   if(!fired && millis()-start>=2000){
     fired=true; char pass[16]; snprintf(pass,sizeof(pass),"LL-%08lX",(unsigned long)esp_random());
     Serial.printf("Portal LlaveLink-Setup, clave %s\n",pass);
     wifi.startConfigPortal("LlaveLink-Setup",pass);
   }
 }else {held=false;fired=false;}
 if(reader.PICC_IsNewCardPresent() && reader.PICC_ReadCardSerial()){
   Serial.print("UID diagnostico: ");
   for(byte i=0;i<reader.uid.size;i++) Serial.printf("%02X",reader.uid.uidByte[i]);
   Serial.println();reader.PICC_HaltA();reader.PCD_StopCrypto1();
 }
 digitalWrite(LED,WiFi.status()==WL_CONNECTED || (millis()%1000)<100);
 delay(20);
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik