Table of Contents

eSafe

Name: Dascalu Stefan-Nicolae
Group: 331CA

Introduction

eSafe is a digital lockbox implemented on an Arduino Uno. It uses a 4×4 matrix keypad for PIN entry, an SG90 servo for a mechanical latch, a DS1307 real-time clock (I²C) to enforce access windows, and a 16×2 I²C LCD to display status and time. Three wrong PIN attempts trigger an alarm tone and flashing red LED; valid entries drive the servo to unlock, light a green LED, and display “UNLOCKED.”

Hardware Design

Below are both the abstract block diagram and the detailed wiring schematic with an Arduino Uno:

Note on Simulation vs. Real RTC

In Tinkercad I used a generic 7-segment I²C display; the real build uses the DS1307 module on the same SDA/SCL, so no rewiring or code changes are needed.

Hardware Functionality

Pin-out Detail

Component Interface Arduino pin Direction Rationale
Keypad row/col GPIO D2–D9 input Scanned periodically by Keypad library (no interrupts)
Passive buzzer GPIO D11 output direct drive with tone()/noTone()
Red LED GPIO D13 output Built-in LED pin
Green LED GPIO D12 output Digital status LED (no PWM on D12)
Servo SG90 PWM D10 output attach() supports D10
LCD I²C I²C (TWI) A4/A5 bidir Hardware Wire bus
RTC DS1307 I²C (TWI) A4/A5 bidir Shares same TWI bus
ADC (VCC monitor) internal ch 14 input 1.1 V band-gap reference

Bill Of Materials

Photos and video of the eSafe project

esafe1.jpeg esafe2.jpeg esafe3.jpeg

https://youtube.com/shorts/6ttbbS6FWxo

Software Design

Implementation Status

Library Choices

Library Purpose Justification
Wire / RTClib I²C bus & DS1307 driver proven reliability, minimal API for RTC access
LiquidCrystal_I2C HD44780 LCD over I²C reduces wiring and boilerplate, easy print() API
Keypad matrix scan & debounce built-in interrupt support and debounce logic
Servo SG90 control official Arduino, handles PWM timing internally

Novelty & Lab Integration

Architecture

1. updateDisplay()

  1. called once per second (via `millis()`), updates HH:MM:SS, renders PIN asterisks or “Last HH:MM”
  2. never blocks, so UI remains responsive

2. handleKey()

  1. ‘C’ clears entry, digits append to buffer (with asterisks), ‘D’ validates PIN
  2. on correct PIN, calls `unlockDoor()`; on wrong, increments counter or triggers alarm

3. unlockDoor()

  1. moves servo to unlock angle, lights green LED + buzzer for 1 s
  2. sets `lockRestoreMs = millis() + 5000` for non-blocking relock in `loop()`
  3. logs timestamp in `lastUnlock` for display

4. loop()

  1. checks `millis()` vs. `lockRestoreMs` to relock servo without pausing
  2. updates display every second and polls keypad
  3. validated by toggling between allowed/outside hours and using a stopwatch for timing

Calibration & Optimizations

Conclusions

eSafe showcases the seamless integration of three core microcontroller features: PWM (servo latch), ADC (live VCC monitoring), and I²C (RTC + LCD). All time-sensitive tasks are handled with non-blocking `millis()` logic, so the user interface stays responsive while the clock remains accurate.

Bibliography & Resources