Smart Fingerprint Door Lock Based on RT-Thread

This article is authorized to be reposted from the WeChat public account “Embedded Miscellaneous”. This article mainly shares the related content of the smart fingerprint door lock based on RT-Thread.

Original link:

https://gitee.com/hanxiaohu/W600-RT-Thread-door-lock

1 W600-RT-Thread Smart Fingerprint Door Lock

Hardware Circuit:

https://oshwhub.com/hanxiaohu/zhi-wen-men-suo

APP Project:

https://gitee.com/hanxiaohu/SmartLock-Android

1.1 Project Introduction

The main control chip uses the W600 TW-03 WIFI module, and fingerprint recognition uses the FPC1020A. Here, the door is opened using the MG996R servo to unlock the door. The W600 runs the RT-Thread operating system and connects to OneNET for data interaction.

● Uses W600 embedded WiFi chip

● Uses FPC1020A capacitive fingerprint recognition module

● Supports fingerprint recognition to open the door

● Supports NEC infrared remote control to open the door

● Supports OneNET remote door opening

● Supports oneshot web network configuration

● OneNET to check the door-opening status and record the method of opening the door and custom ID

● Network auto-detection to maintain connection status

● Android APP to control door opening and view history records

1.2 Hardware Circuit

Smart Fingerprint Door Lock Based on RT-Thread

Figure 1

The circuit design uses Lichuang EDA, and all hardware information for the project is on the Lichuang open-source hardware platform.

Hardware Project Address:

https://oshwhub.com/hanxiaohu/zhi-wen-men-suo

Smart Fingerprint Door Lock Based on RT-Thread

Table 1

Please refer to the schematic for detailed component lists. Please replace the door opening device based on actual conditions. The control of the fingerprint module and fingerprint enrollment can refer to the detailed information and debugging tools in the FPC1020A SDK. The FPC1020A SDK and all materials for the offline STM32 fingerprint door lock project are available in the attachments on the Lichuang open-source hardware platform.

1.3 W600 Introduction

Chip information: [W600 Documentation Center](https://docs.w600.fun/)

The W600 is an embedded WiFi chip independently developed and designed by Beijing Lianshengde. This series of modules supports the standard 802.11 b/g/n protocol and has a complete TCP/IP protocol stack built-in.

The 600_SoC chip integrates a Cortex-M3 core, built-in Flash, integrated RF transceiver front-end, CMOS PA power amplifier, baseband processor/media access control, and supports SDIO, SPI, UART, GPIO, I²C, PWM, I²S, 7816, and other interfaces, supporting multiple encryption and decryption protocols such as PRNG (Pseudo random Number Generator)/SHA1/MD5/RC4/DES/3DES/AES/CRC, etc.

1.4 Code

The project environment setup and compilation are introduced in the project compilation guide; here, only a brief introduction to the project composition is provided.

Smart Fingerprint Door Lock Based on RT-Thread

Figure 2

Smart Fingerprint Door Lock Based on RT-Thread

Table 2

Press and hold the WIFI button and then reset to enter oneshot network configuration. The device hotspot name is door_wifi_config. After connecting to the AP, open http://192.168.169.1.

1.5 OneNET

Reference materials: [OneNET Documentation Center]

(https://open.iot.10086.cn/doc/multiprotocol)

1.5.1 Create Project

Open the [OneNET Console]https://open.iot.10086.cn/develop/global/product/#/console to enter multi-protocol access.

Smart Fingerprint Door Lock Based on RT-Thread

Figure 3

On the MQTT (old version) page, click to add a product. Ensure that the device access protocol is MQTT, and fill in the other fields arbitrarily.

Smart Fingerprint Door Lock Based on RT-Thread

Figure 4

1.5.2 Get Connection Parameters

After the project is successfully created, you need to obtain three parameters:

● Product ID

● Master-API key

● Device registration code

Smart Fingerprint Door Lock Based on RT-Thread

Figure 5

Smart Fingerprint Door Lock Based on RT-Thread

Figure 6

1.5.3 Configure RT-Thread

Open the rtconfig.h file and paste your three parameters into the corresponding positions.

Smart Fingerprint Door Lock Based on RT-Thread

Figure 7

For convenience, you can directly modify rtconfig.h. If you need to continue developing this project, please use the env tool to modify these three parameters. For the usage method of the env tool, refer to the [Env User Manual](https://www.rt-thread.org/document/site/programming-manual/env/env/).

1.5.4 Data Stream

The device uploads two data streams:

● Door switch status

● Historical door opening methods

Check the device details.

Smart Fingerprint Door Lock Based on RT-Thread

Figure 8

The switch status depends on the sensor that detects the door opening status. Here, a Hall sensor module is used, with a magnet installed on the door frame. When the door is closed, the Hall sensor is close to the magnet and outputs a low level. At this time, the W600 reads the level and uploads it to OneNET.

The historical door opening record consists of type and ID, where the type is defined in applications\user_def.h.

enum {IR_MSG = 1, FP_MSG, REMOTE_MSG};

The infrared type is 1, fingerprint is 2, OneNET remote door opening is 3, infrared ID is the remote control NEC code, fingerprint ID is the ID stored in the module, and remote ID is the ID issued by the user.

1.5.5 Door Opening Test

Here you can manually test the remote door opening function.

Smart Fingerprint Door Lock Based on RT-Thread

Figure 9

The door opening data format is:

{"opendoor":id}

If id!=0, the door opens and reports the method of opening the door and ID.

The verification of the door opening identification code is in applications\onenet_control.c, and you can format the data yourself.

static void onenet_cmd_rsp_cb(uint8_t *recv_data, size_t recv_size, uint8_t **resp_data, size_t *resp_size){
 int open_id = 0; cJSON *root = cJSON_Parse((char *)recv_data);  cJSON_item_get_number(root,"opendoor",&open_id);      if (open_id != 0)    {        rt_sem_release(&door_open_sem);    .....}

1.6 APP

APP Project:

https://gitee.com/hanxiaohu/SmartLock-Android

Control the door opening and check the door switch status and historical opening records through the Android APP connected to OneNET.

Smart Fingerprint Door Lock Based on RT-Thread

Figure 10

Note: If you need to access OneNET for control in other ways, please refer to the [OneNET Documentation Center](https://open.iot.10086.cn/doc/multiprotocol) for development.

2 RT-Thread Project Compilation Guide

2.1 RT-Thread Introduction

RT-Thread is an open-source IoT operating system from China, which has very strong scalability: from a very small kernel that can run on Arm Cortex-M0 chips to medium Arm Cortex-M3/4/7 systems, and even running on MIPS32 and Arm Cortex-A series processors. The source code of the RT-Thread project is hosted on [GitHub repo] (https://github.com/rt-thread).

2.2 Reference Materials

● RT-Thread documentation: RT-Thread Documentation Center

https://www.rt-thread.org/document/site

● W60x reference documentation: W600 Documentation Center

https://docs.w600.fun/?p=rt-thread/start.md

● W60x reference materials: Zhen Dian Yuan Zi W601 IoT Development Board

http://www.openedv.com/docs/boards/iot/zdyz_w601.html

● W60x_RT-Thread source code: GitHub

https://github.com/RT-Thread/W601_IoT_Board

● Serial download tool: Serial Debug Assistant

https://download.w600.fun/tool/%E6%98%9F%E9%80%9A%E6%99%BA%E8%81%94%E4%B8%B2%E5%8F%A3%E8%B0%83%E8%AF%95%E4%B8%8B%E8%BD%BD%E5%8A%A9%E6%89%8B.7z

2.3 Environment Setup

2.3.1 Building the Compilation Environment

● Keil MDK

● Download W60x_RT-Thread SDK source code: GitHub

https://github.com/RT-Thread/W601_IoT_Board

2.3.2 Project Directory Introduction

The directory structure of the W60X SDK is shown in Figure 11:

Smart Fingerprint Door Lock Based on RT-Thread

Figure 11

The docs folder contains reference documents related to W600_RTT. It is recommended to read UM3103-RT-Thread-W60X-SDK Quick Start.pdf and UM3101-RT-Thread-W60X-SDK Development Manual.pdf first.

2.4 Compilation and Burning

2.4.1 Compilation

Clone the repository into the examples folder of the project directory.

Enter the project folder, double-click to open the project.uvprojx project file, and compile directly after opening the project (Note: Make sure to set up the Keil environment first).

Smart Fingerprint Door Lock Based on RT-Thread

Figure 12

The firmware is generated in the Bin folder of the current example directory.

Smart Fingerprint Door Lock Based on RT-Thread

Figure 13

2.4.2 Burning

Open the Xintong Zhili download debugging software and select rtthread_layout_1M.FLS for burning. The model can be left unselected. If the serial port is not connected, reset it. After clicking download, you need to manually reset the W600.

Smart Fingerprint Door Lock Based on RT-Thread

Figure 14

Note:

1. This project uses the W600 chip, and the FLASH version is 1M. Choose rtthread_layout_1M.FLS for burning.

2. For other burning issues, please refer to: [W600 Firmware Burning Guide](https://github.com/w600/docs/blob/master/zh/app/download.md).

Reposted from | Anxins Technology Classroom

Copyright belongs to the original author. If there is any infringement, please contact to delete.


END













关于安芯教育





安芯教育是聚焦AIoT(人工智能+物联网)的创新教育平台,提供从中小学到高等院校的贯通式AIoT教育解决方案。
安芯教育依托Arm技术,开发了ASC(Arm智能互联)课程及人才培养体系。已广泛应用于高等院校产学研合作及中小学STEM教育,致力于为学校和企业培养适应时代需求的智能互联领域人才。


Leave a Comment