Smart Gate

* Nume si Prenume: Armasu Octavian

* Grupa: 335CA

Introduction

This project aims to implement an access control system using an Arduino board and an NFC card reader. The system works as follows: by default, a red LED is on and the display shows the message “Door Locked”. When a valid NFC card is presented to the reader, the system checks the card's authentication. If the card is valid, the red LED turns off, a green LED lights up, a buzzer emits a sound, and the display shows “Door Open”. After a few seconds, the system automatically “locks” the door again by turning the red LED back on, emitting another buzzer sound, and changing the display message back to “Door Locked”.

Additionally, every valid access is recorded on an SD card along with the exact date and time of the event, using a real-time clock (RTC) module to generate the timestamp.

General Description

This project presents a basic access control system using an Arduino microcontroller and NFC technology. When a valid NFC card is presented to the reader, the system authenticates the user, triggers a visual and audio response (using LEDs and a buzzer), displays the access status on a screen, and logs the event with a timestamp to an SD card. The setup demonstrates simple hardware integration for secure access applications and data logging, combining user feedback, real-time tracking, and storage capabilities in an embedded environment.

Hardware Design

The following table lists the main components used in this project:

Component Description
Arduino Microcontroller
151051RS11000 Red color led
151031VS06000 Green color led
SSD1306 Display
RC522 NFC Reader
PS1440P02BT Buzzer
DS1307 RTC

Electrical schematics:

Note: The OLED display (SSD1306, 0.96”, I2C interface) and the RC522 NFC reader used in this project are represented using generic connector symbols (Conn_01x04 and Conn_01x07) due to the absence of exact component symbols in the library.

OLED Display Pin Mapping (Conn_01x04): • Pin 1 – GND → Ground • Pin 2 – VCC → 5V Supply • Pin 3 – SCL → Arduino A5 • Pin 4 – SDA → Arduino A4

RC522 NFC Reader Pin Mapping (Conn_01x07): • SDA → Arduino D10 (Chip Select / SS) • SCK → Arduino D13 (SPI Clock) • MOSI → Arduino D11 (SPI Data In) • MISO → Arduino D12 (SPI Data Out) • GND → Ground • 3.3V → Arduino 3.3V

Final Product:

Software Design

Purpose of the code

This program implements an access control system using RFID cards, based on an Arduino microcontroller. The system integrates an RC522 NFC reader, an OLED display, a real-time clock module (DS3231), LEDs, and a buzzer. When a card is detected, the system displays the access information, provides visual and sound feedback, and logs the timestamp of the event.

Main Software Components

  1. RC522 RFID Reader
    • The RC522 module is configured to trigger an interrupt signal via its IRQ pin when a card is presented.
    • This interrupt is connected to pin D2 on the Arduino and is handled using attachInterrupt(…).
    • The interrupt service routine cardDetected() sets a global flag (cardInterrupt).
    • The main loop() checks this flag and processes the card only when the flag is true.
    • There are advantages using this method: the microcontroller stays idle until an actual card is detected, reducing unnecessary polling and improving efficiency.
  2. OLED Display
    • It is used to display information for the user.
    • When a card is valid and the “door” opens, on the display it will be showed the following message: “Valid Card\n Timestamp\n Door opened”.
    • When waiting for a card to be provided, the message will be: “Please scan your card…”.
  3. Real Time Clock
    • Provides the current date and time for each access event.
  4. LEDs and Buzzer
    • The red LED indicates the default state (door closed).
    • The green LED and buzzer are activated when a valid card is detected.
    • After a delay of 3 seconds, the system goes back to its default state.

Flow Overview

  • System powers on, displays “System on…”/ “Please scan your card…” and waits for a card.
  • When a RFID card is brought near the reader, it triggers an interrupt via IRQ.
  • The cardInterrupt flag is set to true.
  • In loop(), the card is read only when the flag is active, LEDs and buzzer are activated, the current time is retrieved from the RTC, the OLED displays the message and the timestamp
  • After 3 seconds, the system resets.

For debug reasons, I also print the UID of the card and the message in the serial monitor.

Libraries used: SPI.h, Wire.h, MFRC522.h, RTClib.h, Adafruit_GFX.h, Adafruit_SSD1306.h. These libraries are used to enable communication between the Arduino and external modules such as the RFID reader, OLED display, and RTC clock. SPI.h is used for SPI communication with the RC522 module, Wire.h for I2C communication with the OLED and RTC, MFRC522.h for handling RFID card detection and reading, RTClib.h for accessing real-time data from the DS3231, and Adafruit_GFX.h along with Adafruit_SSD1306.h for displaying text and graphics on the OLED screen.

Conclusions

At first, I wasn’t very enthusiastic about this project because I had no clear idea how to build it and I was afraid I wouldn’t be able to complete it successfully. However, once I got started and broke the problem down into smaller steps, everything became more clear and manageable. I began to understand how each part works and how they connect together, and the process became more interesting and rewarding. I found myself enjoying the development more than I expected. In the end, not only did I manage to complete the project, but I also learned a lot in the process and I’m genuinely proud of what I achieved.

Download

Resources

pm/prj2025/abirlica/octavian.armasu.txt · Last modified: 2025/05/26 10:44 by octavian.armasu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0