All projects

Smart door lock

Heimdall

A smart door lock built by our graduation team. My part was the Python running on the Raspberry Pi.

  • Python
  • Raspberry Pi
  • Keypad
  • Sensors
  • Camera
  • Firebase
Project
Team graduation project
Contribution
Raspberry Pi side only
Availability
Team project. My part was the Raspberry Pi side.

Overview

Heimdall was our graduation project: a smart door lock. I wrote the Python that runs on the Raspberry Pi, and the Flutter app belonged to the rest of the team. The Pi reads a keypad for the code, watches for anyone standing at the door, takes photos, and drives the lock, the LEDs, and the buzzer.

Architecture

The Pi script is the whole device side. It signs into Firebase Auth with the lock's own account, then streams its node in the Realtime Database and acts on whatever changes. GPIO drives the keypad grid, the lock, the buzzer, the LEDs, and the sensors; Picamera2 feeds frames to OpenCV's Haar cascade for face detection. Alerts go to Firestore and out through an FCM topic named after the lock.

Abdelrahman’s contribution

Raspberry PiPython device software
Keypad
Sensors
Camera

Firebase integration in the device software

Hardware and software overview. The team’s Flutter app is outside this contribution.

What it does

Keypad entry

The Pi scans a 4x4 keypad, compares what was typed against the password stored in Firebase, and opens the magnetic lock when it matches. A wrong code gets three short buzzes.

Control from the app

The Pi subscribes to its node in the Firebase Realtime Database, so the app can open or close the lock, change the password, or move the camera line while the program is running.

Motion and photo capture

Motion at the PIR sensor, the IR sensor, or the ultrasonic sensor within a metre starts a capture. Up to thirty frames containing a face go to Firebase Storage, and a push notification follows with the image links.

The camera line

The app places a line on the camera frame. When a detected face crosses it, the buzzer sounds and a capture is uploaded.

Source code