Table of Contents

Smart Access Control System

Introduction

The Smart Access Control System is an electronic security project designed to manage access to a secure container or room through a digital interface. It utilizes an Arduino Nano as the central processing unit to interpret user inputs from a simplified button interface and control a mechanical locking mechanism.

What it does: It reads a sequence of button presses (passcode) via an analog voltage divider circuit. If the entered code matches the pre-defined secret code, the system triggers a motor to rotate, simulating a lock opening, while providing visual and audio feedback via an LCD and a buzzer. Purpose: The goal is to create a compact, reliable, and modifiable electronic alternative to traditional mechanical padlocks.

The Idea: The project was inspired by the transition from analog to digital security in domestic and industrial environments. Digital systems allow for easy code changes without replacing physical hardware.

Utility: For users, it provides a hands-on platform to learn about integrated systems, motor drivers (H-bridges), and I2C communication. Practically, it can be used to secure lockers, small safes, or as a prototype for larger home automation systems.

General Description

The system is organized into a modular architecture where each component handles a specific aspect of the user interaction or mechanical execution. Block Diagram Modules:

Input Module (Voltage Divider): Connects two tactile buttons to a single analog pin (A0). Pressing different buttons changes the voltage read by the ADC, allowing the Arduino to distinguish between “Button 1” and “Button 2” using minimal pins.

Processing Module (Arduino Nano): It monitors the analog pin, manages the state machine for code entry, verifies the passcode, and coordinates the feedback and motor signals.

Feedback Module (LCD & Buzzer): I2C LCD 1602 displays the current status (“Code:”, “SUCCESS”, “ERROR”) and visual markers for characters entered.

Passive Buzzer: Provides audible signals for keypresses and distinct melodies for success or error states.

Actuation Module (DRV8833 & N20 Motor): Receives control signals from digital pins. The DRV8833 H-bridge directs power to the N20 gear motor to physically actuate the lock.

Hardware Design

The hardware is designed for efficiency, using an I2C interface for the screen and a voltage divider for the buttons to keep most of the Arduino's digital pins free for future expansions.

Component list:

Component Model Interface
Microcontroller Arduino Nano (ATmega328P) GPIO / ADC / I2C
Motor Driver DRV8833 Dual Bridge PWM / Digital Output
Gear Motor N20 DC Gear Motor Analog / DC
Display I2C LCD 1602 (0x27) I2C (SDA/SCL)
Feedback Passive Buzzer Digital (Tone)
Input 2x Tactile Buttons Analog (Voltage Divider)
Resistors 10k (Pulldown), 2.2k (Series) -

Datasheets:

Block diagram:

Wiring diagram:

Software Design

Developement enviorement

Libraries

Algorithms and Implementation:

Analog Button Detection: Instead of using digital inputs, the code reads analogRead(A0):

A value < 20 is interpreted as Button 1 and a value between 40 - 200 is interpreted as Button 2.

Code Verification Logic: An array enteredCode[4] stores user input. Once 4 digits are reached, verifyCode() compares it against secretCode[4] = {1, 1, 2, 1}.

State Management: A waitForRelease boolean ensures that a single physical press doesn't register multiple times (debounce/single-fire logic).

Motor Control: The rotateMotor() function uses analogWrite on the driver pins to set a specific speed (PWM 150) for a duration of 2000ms, ensuring smooth activation of the lock mechanism.

Main Functions:

name description
rotateMotor() Triggers the DRV8833 to drive the N20 motor for a set duration
verifyCode() Compares arrays and triggers the appropriate sound/visual feedback
pressSound() / successSound() / errorSound() Helper functions for different buzzer frequencies