Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 101 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,110 @@
# Digital Lock

A **Digital Lock** with fingerprint and sms module and has android client to integrate and manage the hardware.
A smart digital door lock built with **STM32** and **FreeRTOS**, supporting multiple authentication methods including **fingerprint recognition**, **PIN keypad**, and **SMS-based remote control**. The project also includes a **Flutter** Android application for managing and interacting with the lock.

## Mind Map

![mind-map](./mindmap.jpg)

---

## Overview

Digital Lock is an embedded systems project that combines hardware, firmware, and mobile software into a complete access control solution.

The firmware runs on an STM32 microcontroller using FreeRTOS to manage concurrent tasks such as user authentication, display updates, GSM communication, and peripheral control. A Flutter-based Android application provides a convenient interface for monitoring and controlling the system remotely.

---

## Screenshots

| Hardware | Android Client |
|----------|----------------|
| <img src="./stm32code/digital-lock/Screenshots/Picture1.jpg" height="200" weight="200"> | <img src="./client/digital_lock/screenshots/Picture1.jpg" height="500" weight="500"> |

---

## Getting Started

* For hardware code see [stm32code](./stm32code/digital-lock/README.md)
* For Android client see [client](./client/digital_lock/README.md)
Each subproject contains its own documentation with build instructions and implementation details.

## Mind Map of this project
* [stm32code](./stm32code/digital-lock/README.md)
* [client](./client/digital_lock/README.md)

![mind-map](./mindmap.jpg)
---

## System Architecture

The project consists of two main parts:

### Embedded Firmware

The firmware is responsible for:

* Managing authentication methods
* Driving the LCD interface
* Communicating with the GSM module
* Processing keypad input
* Interfacing with the fingerprint sensor
* Controlling the locking mechanism

### Mobile Application

The Flutter application provides:

* Remote interaction with the lock
* Device management
* User-friendly interface

---

## Technology Stack

### Embedded

* STM32
* FreeRTOS
* C
* STM32 HAL

### Mobile

* Flutter
* Dart
* Provider
* SQLite

### Communication

* GSM / SMS
* USART
* I2C
* JSON

### Hardware

* Fingerprint Sensor
* DS1307 RTC
* AT24Cxx EEPROM
* Matrix Keypad
* LCD

### Security

* AES
* SHA-256

### Development

* GNU Make
* OpenOCD
* ARM GNU Toolchain
* Android Studio

---

## License

## Screenshot
This project is licensed under the [MIT](./LICENSE) License unless stated otherwise.

The Main Board | The Mobile Client
--- | ---
![hardware-screenshot](./stm32code/digital-lock/Screenshots/Picture1.jpg) | ![main-page](./client/digital_lock/screenshots/Picture1.jpg)
---
88 changes: 71 additions & 17 deletions client/digital_lock/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,90 @@
# Digital Lock Client (Android)
# Digital Lock Client

A client app for integrate and manage the digital lock module.
Flutter-based Android application for managing and controlling the **Digital Lock** system.

## Usage
The application provides an intuitive interface for interacting with the embedded device, allowing users to authenticate, manage settings, and monitor the lock remotely.

### Getting Started
---

You need to install
## Features

* [Flutter](https://docs.flutter.dev/get-started/install)
* [Android Studio](https://developer.android.com/studio/install) (and sdk)
* [VS Code](https://docs.flutter.dev/get-started/editor?tab=vscode) (recommended for code editing)
* User authentication
* Manage registered users
* Configure lock settings
* Communicate with the Digital Lock device
* Modern Material Design interface
* Built with Flutter

For build **Android** app, you must follow [this steps for Sign the app](https://docs.flutter.dev/deployment/android#sign-the-app)
And run:
---

## Technologies

* Flutter
* Dart
* Provider
* SQLite
* Shared Preferences

---

## Requirements

Install the following tools before building the project.

| Tool | Purpose |
| --- | --- |
| [Flutter](https://docs.flutter.dev/get-started/install) | Application development |
| [Android Studio](https://developer.android.com/studio/install) | Android SDK and emulator |
| [VS Code](https://code.visualstudio.com/) | Code editor |

---

## Getting Started

1. Install Dependencies

```bash
flutter pub get
```

2. Build Release APK

> Before creating a release build, configure Android app signing as described in the Flutter documentation.

Then build the application:

```bash
flutter build apk --release
```

The generated APK can be found at:

```bash
flutter build apk --verbose
build/app/outputs/flutter-apk/app-release.apk
```

Then you can see the output apk file in `build/app/outputs/apk/release/app-release.apk`
---

### Format The Code
## Code Formatting

Run this command on base directory:
Format the source code using:

```bash
dart format .
```

---

## Screenshots

Login Page | Main Page | User Page | Settings Page
--- | --- | --- | ---
![login-page](./screenshots/Picture0.jpg) | ![main-page](./screenshots/Picture1.jpg) | ![users-page](./screenshots/Picture2.jpg) | ![settings-page](./screenshots/Picture3.jpg)
| Login Page | Main Page | User Page | Settings Page |
| --- | --- | --- | --- |
| ![login-page](./screenshots/Picture0.jpg) | ![main-page](./screenshots/Picture1.jpg) | ![users-page](./screenshots/Picture2.jpg) | ![settings-page](./screenshots/Picture3.jpg) |

---

## License

This project is licensed under the MIT License unless stated otherwise.

---
1 change: 0 additions & 1 deletion client/digital_lock/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ linter:
test_types_in_equals: true
throw_in_finally: true
unnecessary_statements: true
unsafe_html: true

avoid_escaping_inner_quotes: true
avoid_returning_this: true
Expand Down
4 changes: 2 additions & 2 deletions stm32code/digital-lock/Core/Src/gsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ void gsm_read_sms(uint8_t *gsm, char number[13], char *message, int message_size
gsm_wait_to_get(',');
gsm_get_char();

for (uint8_t i = 0; i < 13; i++) number[i] = gsm_get_char(gsm);
for (uint8_t i = 0; i < 13; i++) number[i] = gsm_get_char();

gsm_wait_to_get(Enter);

for (int i = 0; i < message_size; i++) message[i] = gsm_get_char(gsm);
for (int i = 0; i < message_size; i++) message[i] = gsm_get_char();
message[message_size] = '\0';
}

Expand Down
92 changes: 75 additions & 17 deletions stm32code/digital-lock/README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,104 @@
# Digital Lock Software
# STM32 Firmware

A software that run on digital lock hardware.
Firmware for the **Digital Lock** project, built on **STM32** and **FreeRTOS**.

## Usage
The firmware controls all hardware peripherals including the fingerprint sensor, keypad, LCD, GSM module, and electronic lock while providing a responsive multitasking environment using FreeRTOS.

### Getting Started
---

1. You need to install
## Features

* [Arm Gnu Toolchain](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads)
* [OpenOCD](https://openocd.org/pages/getting-openocd.html)
* [Gnu Make](https://www.gnu.org/software/make/)
* FreeRTOS-based multitasking
* Fingerprint authentication
* PIN authentication via keypad
* LCD user interface
* GSM/SMS communication
* Electronic lock control
* Modular driver architecture
* Makefile-based build system

2. To fetch submodules, run:
---

## Technologies

* STM32 HAL
* FreeRTOS
* C
* I2C
* USART
* DS1307
* AT24Cxx EEPROM
* AES
* SHA-256
* GNU Make
* OpenOCD

---

## Requirements

Before building the project, install the following tools:

| Tool | Purpose |
| --- | --- |
| [Arm Gnu Toolchain](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads) | Cross compiler |
| [OpenOCD](https://openocd.org/pages/getting-openocd.html) | Flashing and debugging |
| [GNU Make](https://www.gnu.org/software/make/) | Build system |
| [Git](https://git-scm.com/) | Clone repository and submodules |
| [clang-format](https://clang.llvm.org/docs/ClangFormat.html) *(optional)* | Source code formatting |

---

## Getting Started

1. Clone the Submodules

```sh
git submodule update --init --recursive
```

3. To Build the project, you must run:
2. Build:

Compile the firmware:

```sh
make
```

4. To Upload code to hardware, you must to connect the programmer to laptop and run:
> The generated binary files will be placed in the build output directory.

3. Flash the Firmware:

Connect an ST-Link (or another supported programmer) to the target board and run:

```sh
make flush
```

### Format The Code
---

## Code Formatting

Install **clang-format** and ensure it is available in your `PATH`.

You need to have `clang-format` in PATH
Then run:

```sh
make format
```

## Screenshot
---

## Screenshots

| Normal Mode | Disable Mode | Add User Mode |
| --- | --- | --- |
| ![normal-mode](./Screenshots/Picture1.jpg) | ![disable-mode](./Screenshots/Picture2.jpg) | ![add-user-mode](./Screenshots/Picture3.jpg) |

---

## License

This project is licensed under the MIT License unless stated otherwise.

Normal Mode | Disable Mode | Add User Mode
--- | --- | ---
![normal-mode](./Screenshots/Picture1.jpg) | ![disable-mode](./Screenshots/Picture2.jpg) | ![add-user-mode](./Screenshots/Picture3.jpg)
---
Loading