Laser Alarm With RFID Module

by CarlosVoltT in Circuits > Arduino

116 Views, 1 Favorites, 0 Comments

Laser Alarm With RFID Module

portada2-820x461 (1).png

In this project, we build a security alarm using a laser detection system, a laser receiver sensor, a buzzer and an RFID-RC522 module.

In this project, we build a security alarm using a laser detection system, a laser receiver sensor, a buzzer and an RFID-RC522 module, all controlled by an Arduino. The goal is to create a system that can detect the interruption of a laser beam and trigger an audible alarm, as well as allowing the arming and disarming of the alarm using a specific RFID card.


Project Operation:

Laser Detection System:

  • The system relies on a constant laser beam aimed at a laser receiver sensor. This sensor is configured to detect the presence or absence of the laser beam. Under normal conditions, the laser reaches the sensor and the system recognizes this condition as a “safe” state.
  • Laser Detection System:
  • The system relies on a constant laser beam aimed at a laser receiver sensor. This sensor is configured to detect the presence or absence of the laser beam. Under normal conditions, the laser reaches the sensor and the system recognizes this condition as a “safe” state.

Alarm Activation:

  • When the laser beam is interrupted (for example, by a person passing through the beam), the receiving sensor detects the absence of the laser. This change of state is detected by the Arduino, which in turn activates a buzzer to emit an audible alarm. This mechanism acts as a security barrier, alerting of an intrusion or unauthorized access.
  • Alarm Activation:
  • When the laser beam is interrupted (for example, by a person passing through the beam), the receiving sensor detects the absence of the laser. This change of state is detected by the Arduino, which in turn activates a buzzer to emit an audible alarm. This mechanism acts as a security barrier, alerting of an intrusion or unauthorized access.

Arming and Disarming Control with RFID:

  • The project includes an RFID-RC522 module that allows the alarm to be armed and disarmed using a specific RFID card. By presenting the authorized card, the system switches between armed and disarmed states. This means that, when the alarm is armed, any interruption of the laser beam will activate the buzzer. When disarming the alarm, the system will not react to beam interruptions, avoiding false alarms.
  • Arming and Disarming Control with RFID:
  • The project includes an RFID-RC522 module that allows the alarm to be armed and disarmed using a specific RFID card. By presenting the authorized card, the system switches between armed and disarmed states. This means that, when the alarm is armed, any interruption of the laser beam will activate the buzzer. When disarming the alarm, the system will not react to beam interruptions, avoiding false alarms.

Alarm Status Indicator:

  • In addition to the buzzer, a laser connected to the Arduino indicates the alarm status. This laser turns on when the alarm is armed and turns off when the alarm is disarmed, providing a visual indication of the system status.
  • Alarm Status Indicator:
  • In addition to the buzzer, a laser connected to the Arduino indicates the alarm status. This laser turns on when the alarm is armed and turns off when the alarm is disarmed, providing a visual indication of the system status.

Reading and Displaying RFID Card UID:

  • Each time an RFID card is brought close to the module, the system reads its UID (Unique Identifier) ​​and displays it on the serial monitor. This allows verification of whether the presented card is the one authorized to control the alarm or not. Even if the card is not authorized, the UID is displayed to facilitate access monitoring and control.
  • Reading and Displaying RFID Card UID:
  • Each time an RFID card is brought close to the module, the system reads its UID (Unique Identifier) ​​and displays it on the serial monitor. This allows verification of whether the presented card is the one authorized to control the alarm or not. Even if the card is not authorized, the UID is displayed to facilitate access monitoring and control.

Applications and Expansion:

This laser alarm system can be used in a variety of security applications, such as protecting entrances, windows, or restricted areas. In addition, the project is easily expandable; multiple laser sensors can be added to cover a larger area, or more functionalities can be incorporated such as SMS alerts, integration with home automation systems, or even remote monitoring via the Internet.

With this project, you not only learn how to work with components like laser sensors, RFID modules, and Arduino, but you also get a hands-on introduction to security and access control systems. It's a great way to explore the intersection between hardware and software, and how the two can be combined to create practical, effective real-world solutions.

Arduino Nano

The Arduino Nano is a small, full-featured, breadboard-compatible board based on the ATmega328 (Arduino Nano 3.x). It has more or less the same functionality as the Arduino Duemilanove, but in a different package. It only lacks a DC power connector and is powered by a Mini-B USB cable instead of a standard one.

A socket for arduino

Female pins


Dupont cables female male


Module Laser ky-008


This module specially designed for Arduino emits easily, quickly and accurately a laser beam produced by this component

It is a Laser Emitting Diode that operates at 5V and emits at a wavelength of 650nm.

Technical characteristics:

Working voltage: 5V

Wavelength: 650nm

Power 5 mW

Color: Red

Material: PCB

Dimensions: 2.3×1.5×0.9cm

Laser Receiver Module

Description

Detecting the light beam of a laser pointer will now be easier with the help of this sensor.

When light is focused on the sensor, it changes the voltage at its output.

It can be used together with the laser module to build counting systems, intrusion detection, remote data transmission.

TECHNICAL SPECIFICATIONS

  • Operating voltage: 5V DC
  • Salida digital TTL
  • Output high level (5V) when receiving laser signal
  • Low level output (0V) when no laser signal is received

RC522 RFID Module

Rfid Module Rc522 13.56mhz Card And Keychain Arduino

The module uses 3.3V as a supply voltage and is controlled via the SPI protocol, making it compatible with almost any microcontroller, Arduino or development board.

The RC522 uses an advanced modulation and demodulation system for all types of 13.56Mhz passive devices. The device handles ISO14443A and supports Quick CRYPTO1 and MIFARE encryption algorithms.

The RC522 MF circuit is used for 13.56Mhz wireless communication to write or read data for low power, low cost and small size applications. Ideal for portable devices or cards.

Features Model: MF522-ED

Operating current: 13-26mA at 3.3V

Standby current: 10-13mA at 3.3V

Sleep-mode current: <80µA

Peak current: 30mA

Operating frequency: 13.56Mhz

Reading distance: 0 to 60mm

Communication protocol: SPI

Maximum data rate: 10Mbit/s

Dimensions: 40 x 60 mm

Operating temperature: -20 to 80ºC

Operating humidity: 5%-95%

Maximum SPI speed: 10Mbit/s

Descargar PCB –> pcb ardunano

Circuit


Source Code

#include <SPI.h>

#include <MFRC522.h>

//SDA (SS) a Pin 10 del Arduino

//SCK a Pin 13 del Arduino

//MOSI a Pin 11 del Arduino

//MISO a Pin 12 del Arduino

//IRQ a N/C (no conectado)

//GND a GND del Arduino

//RST a Pin 9 del Arduino

//3.3V a 3.3V del Arduino

const int pinReceptorLaser = 8; // Pin digital donde está conectado el receptor láser

const int pinBuzzer = A4; // Pin digital donde está conectado el buzzer

const int pinRST = 9; // Pin RST del módulo RFID-RC522

const int pinSS = 10; // Pin SDA del módulo RFID-RC522

int estadoReceptorLaser = 0; // Variable para almacenar el estado del receptor láser

bool alarmaArmada = false; // Variable para controlar si la alarma está armada

bool alarmaActiva = false; // Variable para controlar el estado de la alarma

const int pinLED = 2; // Pin digital donde está conectado el LED

MFRC522 lectorRFID(pinSS, pinRST); // Crear instancia del objeto MFRC522

// UID de la tarjeta autorizada

byte UIDAutorizado[] = {0xC5, 0x81, 0xB6, 0x35};

void setup() {

pinMode(pinReceptorLaser, INPUT);

pinMode(pinLED, OUTPUT); // Configurar el pin del emisor Laser como salida

pinMode(pinBuzzer, OUTPUT);

Serial.begin(9600); // Iniciar comunicación serial para debug

SPI.begin(); // Iniciar bus SPI

lectorRFID.PCD_Init(); // Iniciar módulo MFRC522

Serial.println("Coloca la tarjeta RFID...");

}

void loop() {

estadoReceptorLaser = digitalRead(pinReceptorLaser); // Leer el estado del receptor láser

Serial.print("Estado del receptor láser: ");

Serial.println(estadoReceptorLaser);

// Verificar si hay una tarjeta RFID

if (lectorRFID.PICC_IsNewCardPresent() && lectorRFID.PICC_ReadCardSerial()) {

digitalWrite(pinLED, HIGH); // Encender el LED cuando la alarma esté armada

if (esAutorizada(lectorRFID.uid.uidByte, lectorRFID.uid.size)) {

alarmaArmada = !alarmaArmada; // Alternar el estado de armado de la alarma

alarmaActiva = false; // Resetear el estado de la alarma

if (alarmaArmada) {

Serial.println("Tarjeta RFID autorizada detectada, alarma armada.");

} else {

Serial.println("Tarjeta RFID autorizada detectada, alarma desarmada.");

digitalWrite(pinLED, LOW); // Apagar el LED cuando la alarma esté desarmada

}

} else {

Serial.println("Tarjeta RFID no autorizada detectada.");

}

lectorRFID.PICC_HaltA(); // Detener lectura de la tarjeta

}

// Activar la alarma si está armada y el receptor láser está en LOW

if (alarmaArmada) {

alarmaActiva = true;

}

// Controlar el buzzer basado en el estado de la alarma

if (alarmaActiva) {

estadoReceptorLaser = digitalRead(pinReceptorLaser); // Leer el estado del receptor láser

if (estadoReceptorLaser == 0) {

digitalWrite(pinBuzzer, HIGH); // Encender el buzzer si la alarma está activa

}

} else {

digitalWrite(pinBuzzer, LOW); // Apagar el buzzer si la alarma no está activa

}

delay(100); // Pequeña pausa para evitar lecturas erráticas

}

bool esAutorizada(byte *uid, byte tamanoUID) {

// Verificar si el UID leído coincide con el UID autorizado

if (tamanoUID != sizeof(UIDAutorizado)) {

return false;

}

for (byte i = 0; i < tamanoUID; i++) {

if (uid[i] != UIDAutorizado[i]) {

return false;

}

}

return true;

}