当前位置:网站首页>STM32 project design: smart door lock PCB and source code based on stm32f1 (4 unlocking methods)
STM32 project design: smart door lock PCB and source code based on stm32f1 (4 unlocking methods)
2022-06-26 08:22:00 【Turn into dust】
List of articles
Project video
Bleep bleep video link :https://www.bilibili.com/video/BV1fL41177HZ/
Project information
stm32f1 Free information link of smart door lock :
link :https://pan.baidu.com/s/1_au_QM2-59dMhIj4_lP2vQ
Extraction code :wa4y
stm32f1 Complete information link of smart door lock :
V1.1:https://download.csdn.net/download/mbs520/60273691
V1.2:https://download.csdn.net/download/mbs520/80301067
Suggestion plus QQ Access to resources 8 fold :2809786963
Physical purchase link :https://market.m.taobao.com/app/idleFish-F2e/widle-taobao-rax/page-detail?wh_weex=true&wx_navbar_transparent=true&id=662981777123&ut_sk=1.YS8KcP50tCcDANBMdqHJmYUj_21407387_1639226039728.copy.detail.662981777123.2054314811&forceFlush=1

Preface
1、 Because many students feedback now STM32F4 Expensive , The production cost is too high , So I spent nearly a month of my free time to study how to make a car with the lowest cost F4 The smart door lock has the same or more functions
STM32F4 Version smart door lock blog link :https://blog.csdn.net/mbs520/article/details/106987758
One 、 Project brief introduction
( One ) Function Overview
F4 edition :
1、 The fingerprint information of family members can be added, deleted, checked and modified through the fingerprint module , The information about whether the addition, deletion and modification are successful is displayed in OLED On the screen
2、 In the process of fingerprint matching , If the collected fingerprint matches the fingerprint module library ,OLED Show that the match is successful , And rotate the stepper motor for one turn
3、 The smart door lock password can be set by pressing the key , The password can be set to two ( The password has six digits ), If one of the two matches succeeds , You can unlock , You can also change the password by pressing the key , All operating procedures are shown in OLED in
4、 Realization RFID Unlock with mobile phone ( Bluetooth unlock )
5、 Expand : Virtual password unlock ( Virtual password : Own Baidu )
F1 Version added :
1、 Can be entered 10 Cards
2、 Unlock and turn the stepping motor clockwise for one turn , Lock counterclockwise
3、 New buzzer prompt
4、 New unlock error prompt
( Two ) The main technologies used in the project
F4 edition :
1、IIC agreement 、SPI agreement 、 Serial protocol
2、 external flash drive 、SD Card drive
3、FTAFS file system
4、RTC Real time clock
F1 edition :
1、IIC agreement 、SPI agreement 、 Serial protocol
2、GUI Interface design , Chinese character display
3、RTC Real time clock
( 3、 ... and ) Characteristics of the project
1、 Material selection is based on economy
The most expensive material is the fingerprint module 40 element , Single chip computer only 10 element
2、 Reduce unnecessary materials
Like the outside FLASH,SD Card module , Single chip microcomputer crystal oscillator
2、 Use PCB, Reject cumbersome wiring
Easier to make , Learning is easier
3、 Powerful
Have 4 There are two ways to unlock 、 Chinese interface 、 There are modification and entry operations 、 There's a cell phone APP control
4、 High utilization of material functions
MCU pin (48pin) utilization >90%, Single chip memory (64K) utilization >70%
5、 The code is simple and convenient , Strong logic
Show_Str(12,13,128,12," Smart door lock system hzc123",12,0); // Show Chinese characters 、 Character one sentence
Two 、 Material selection
1、 master control STM32F103C8T6 ( Compatible products are available CH32F103C8T6 Instead of )
2、 Stepper motor ( With drive module )
model :28BYJ4+ULN2003

3、4X4 Matrix key 
4、 Fingerprint module AS608( Serial port control )
5、0.96 " OLED display (IIC)
model :7 The needle

6、RFID RC522 Rf module ( Bring a card )
7、 DuPont line 、 Pin 、 resistance 、 capacitance 、 triode 、 Potentiometer, etc
3、 ... and 、 Schematic design
Adopt the simplest hardware circuit , Do more functions
( The screenshot is blurry , Downloadable resource view )
Four 、PCB Design
Use the cheapest two-layer version ,10cm*10cm Design 
5、 ... and 、 Source design
The source code is F4 Version of smart door lock is transplanted from , Some incompatible functions have been modified and new functions have been added
void DisUnLock(void )
{
OLED_Clear();
Show_Str(20,10,128,24," Unlocking ...",24,0);
OLED_Refresh_Gram();// Update display
Walkmotor_ON();
Show_Str(20,10,128,24," Unlocked !",24,0);
OLED_Refresh_Gram();// Update display
delay_ms(1500);
}
void DisLock(void )
{
OLED_Clear();
Show_Str(30,20,128,16," Locked !",16,0);
OLED_Refresh_Gram();// Update display
Walkmotor_OFF();
Show_Str(30,20,128,16," Locked !",16,0);
OLED_Show_Font(56,48,0);// lock
OLED_Refresh_Gram();// Update display
delay_ms(1000);
}
int main(void)
{
u16 set=0;
int key_num;
int time1;
int time2; // Lock screen time
char arrow=0; // Arrow seat
//SysHSI_Init();
delay_init(); // Delay function initialization
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); // Set up NVIC Interrupt grouping 2:2 Bit preemption priority ,2 Bit response priority
uart_init(9600); // The serial port is initialized to 9600
printf(" The serial port function is normal \r\n");
Button4_4_Init(); // Initialize the hardware interface connected with the key
OLED_Init(); // Display initialization
Walkmotor_Init(); // Stepper motor initialization
BEEP_Init(); // Buzzer initialization
usart2_init(usart2_baund); // Initialize the fingerprint module
PS_StaGPIO_Init();
OLED_Clear();
starting();// Boot information logo
RTC_Init(); //RTC initialization
SysPartInit(); // System parameter initialization
while(1)
{
// Lock screen interface
MAIN:
OLED_Clear();
OLED_Show_Font(56,48,0);// Show lock icon
while(1)
{
time1++;Display_Data();// Time to show : Every time 1000ms Update the display data once
if(DisFlag == 1)
{
DisFlag = 0;
OLED_Fill(0,24,16,63,0);
OLED_Refresh_Gram();// Update display
}
if((time1%100)==1)
{
//MFRC522 Unlock
time1=0;
MFRC522_Initializtion();
Error=MFRC522_lock();
if(Error==0)
{
goto MENU;
}
else
{
OLED_Show_Font(56,48,0);// lock
}
// Mobile phone Bluetooth unlock password 1
Error=usart1_cherk((char*)sys.passwd1);
if(Error==0){
OLED_Clear_NOupdate();
Show_Str(12,13,128,20," Bluetooth password 1: correct ",12,0);
OLED_Refresh_Gram();// Update display
delay_ms(800);
DisUnLock();
goto MENU;
}
// Mobile phone Bluetooth unlock password 2
Error=usart1_cherk((char*)sys.passwd2);
if(Error==0){
OLED_Clear_NOupdate();
Show_Str(12,13,128,12," Bluetooth password 2: correct ",12,0);
OLED_Refresh_Gram();// Update display
delay_ms(800);
DisUnLock();
goto MENU;
}
}
// Fingerprint unlocking
if(PS_Sta) // testing PS_Sta state , If there is a finger press
{
while(PS_Sta){
Error=press_FR();// Fingerprinting
if(Error==0)
{
//DisUnLock();
goto MENU; // Skip to the unlock interface
}
else
{
OLED_Show_Font(56,48,0);// lock
}
}
}
// Password lock
key_num=Button4_4_Scan(); // Key scan
if(key_num!=-1)
{
Error=password();// Password unlocking function
if(Error==0)
{
goto MENU; // Skip to the unlock interface
}
else
{
OLED_Show_Font(56,48,0);// lock
}
}
delay_ms(1);
}
/******************** main interface **************************/
MENU:
OLED_Clear();
MENUNOCLR:
OLED_Fill(0,0,20,48,0);
// The home menu displays
if(arrow<3){
Show_Str(5,arrow*16,128,16,"->",16,0);// Show arrows
set=0;}
else {
Show_Str(5,(arrow-3)*16,128,16,"->",16,0);
set=3;}
Show_Str(25,0,128,16,setup[set],16,0);
Show_Str(25,16,128,16,setup[set+1],16,0);
Show_Str(25,32,128,16,setup[set+2],16,0);
Show_Str(0,52,128,12," On Next determine ",12,0);
OLED_Refresh_Gram();// Update display
time2=0;
while(1)
{
// Timeout lock screen
time2++;
if(time2>10000 | key_num==4){
OLED_Clear();
DisLock();
if(time2>10000)beep_on_mode2();
time2 =0;
OLED_Clear();
goto MAIN;
}
// Bluetooth lock of mobile phone
if(memcmp(USART_RX_BUF,"LOCK",4)==0) {
DisLock();
goto MAIN;
}
// Function option selection
key_num=Button4_4_Scan();
if(key_num)
{
if(key_num==13){
if(arrow>0)arrow--;
goto MENUNOCLR;
}
if(key_num==15){
if(arrow<5)arrow++;
goto MENUNOCLR;
}
if(key_num==16){
switch(arrow)
{
case 0:Add_FR(); break;// Recording finger
case 1:Del_FR(); break;// Delete fingerprint
case 2:SetPassworld();break;// Change Password
case 3:Set_Time(); break; // Setup time
case 4:Add_Rfid(); break; // Enter the card
case 5:Massige(); break; // display information
}
goto MENU;
}
}delay_ms(1);
}
}
}
6、 ... and 、 Android APP Design
1、 Icon design 
2、 Main interface design
Usage method :① Get into APP, wait for 3-5 second , Automatically connect the smart door lock
② The upper left corner shows connected , Input password , Click on OK You can unlock
③ When unable to automatically connect , Click the connect button to enter the manual connection interface

3、 Connection interface
Usage method : Double click to connect 
4、 Information interface design 
7、 ... and 、 Finished product display
1、 Boot screen
Insert picture description here 
2、 Lock screen display time 
3、 Unlock the display menu

边栏推荐
- StarWar armor combined with scanning target location
- Chapter VII (structure)
- Uniapp uses uviewui
- Idea auto Guide
- Cause analysis of serial communication overshoot and method of termination
- Use of jupyter notebook
- Test method - decision table learning
- Macro task, micro task, async, await principle of interview
- 2: String insert
- Baoyan postgraduate entrance examination interview - operating system
猜你喜欢
![[postgraduate entrance examination] group planning exercises: memory](/img/ac/5c63568399f68910a888ac91e0400c.png)
[postgraduate entrance examination] group planning exercises: memory

Pychart connects to Damon database

See which processes occupy specific ports and shut down

What if the service in Nacos cannot be deleted?

Chapter VIII (classes and objects)

Go语言浅拷贝与深拷贝

Real machine debugging of uniapp custom base

Chapter II (summary)

WiFi-802.11 2.4G频段 5G频段 信道频率分配表

Rewrite string() method in go language
随机推荐
STM32 porting mpu6050/9250 DMP official library (motion_driver_6.12) modifying and porting DMP simple tutorial
Database learning notes II
Quickly upload data sets and other files to Google colab ------ solve the problem of slow uploading colab files
[postgraduate entrance examination] group planning: interrupted
批量修改文件名
Interview ES6
Discrete device ~ resistance capacitance
optee中支持的时间函数
Flume learning notes
MySQL practice: 4 Operation of data
See which processes occupy specific ports and shut down
1GHz active probe DIY
2020-10-17
. eslintrc. JS configuration
Apple motherboard decoding chip, lightning Apple motherboard decoding I.C
Oracle 19C download installation steps
2022 ranking of bank financial products
"System error 5 occurred when win10 started mysql. Access denied"
1002: easy to remember phone number
Real machine debugging of uniapp custom base