Skip to main content
Version: FILS English

Magnetic Door System

A IoT door lock mechanism

info

Author: Pică Sebastian
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-SebiP21

Description​

The Smart Magnetic Door Lock System is a security device that lets you open a door using a keypad and checks if the door was opened. If the correct password is entered on the keypad, a servo motor unlocks the door. A magnetic sensor on the door checks if it has actually been opened. When the door opens, an LED turns on and the system sends a message over Wi-Fi. The Raspberry Pi Pico W handles everything and stores the passwords on an SD card.

Motivation​

The reason why I chose this project is because it combines several interesting and useful features: a password-protected door lock, door status detection, and Wi-Fi notifications. I believe that this project is a great way to learn how to use components like a keypad, servo motor, SD card, and magnetic sensor with a Raspberry Pi Pico W.

Architecture​

Architecture
This is the description of the system components and their interactions:

  1. Keypad

    • The keypad is the user input interface.
    • Users input a numeric password which is read by the microcontroller.
  2. Raspberry Pi Pico W

    • Acts as the brain of the system.
    • Reads the keypad input and compares it against a list of valid passwords stored on an SD card.
    • If the password is correct, it sends a signal to open the servo motor.
    • Monitors the magnetic sensor for door state changes.
    • Sends a Wi-Fi message if the door is opened.
  3. SD Card Module

    • Stores one or more valid passwords in a text file.
    • Connected to the Pico via SPI.
  4. Servo Motor

    • Mechanically unlocks the door when the correct password is entered.
  5. Magnetic Sensor (Hall Effect)

    • Detects whether the door is physically opened.
    • Triggers the LED and Wi-Fi alert if the door is open.
  6. LED

    • Lights up when the door has been opened.
  7. Wi-Fi Messaging

    • The Pico W sends a message over Wi-Fi when the door is opened.

Log​

Week 28 - 4 May​

I have started the project following the steps to set-up the gitlab page and I have sketched the documentations

Week 5 - 11 May​

Week 12 - 18 May​

Week 19 - 25 May​

Hardware​

The project uses the following components:

  1. Raspberry Pi Pico W – Central controller.
  2. 4x4 Keypad – User input interface for password entry.
  3. Servo Motor – Controls the door lock mechanism.
  4. Magnetic Sensor – Detects whether the door is open.
  5. LED (5 mm) – Visual indicator for door-open event.
  6. SD Card Module – Stores passwords in a file.
  7. USB – Powers the Pico and servo.

Schematics​

This is the Kicad Schematic: KiCad Schematics Instead of a keypad schematic I have used connection pins to represent the rows and columns of the keypad in the KiCad representation of the project

Bill of Materials​

DeviceUsagePrice
Raspberry Pi Pico WMain microcontroller35 RON
4x4 KeypadUser password input6.99 RON
MG996 Micro ServoControls door lock29.99 RON
LED 5 mmLights up when door opens0.39 RON
SD Card ModuleStores passwords4.39 RON
MicroSD Card (8GB)Stores password file15.99 RON
Breadboard & WiresFor prototyping11.90 RON

Software​

LibraryDescriptionUsage
embedded-sdmmcSD card file system interfaceReads password data
embedded-hal-servoServo controlOpens door on valid password
embassyAsync embedded frameworkPowers the system’s concurrency
panic-haltHandles panic safelyHalts system on unrecoverable errors