张小哥

Low power consumption fingerprint door opening device

 
Overview

1. Introduction to project functions

    本设计为一款应用于寝室的低功耗指纹锁,让普通宿舍门带有指纹解锁功能,也可以应用于自家的房门,免去我们在日常生活中忘记带钥匙,进不去寝室的烦恼。安全性还欠缺保障,但是并不会因为外部电路的短接之类的开门。
    采用18650电池供电,低功耗设计,安装简单,板载充电接口,设备待机电流22uA,一节锂电池可以使用3-6个月,实测从2021年7月8日正式装上,电池充满电(2000Mah,冲至4.2V),每天开门至少10次以上(寝室6个人),到2021年9月5日止,当前电压为3.86V,使用40%左右电量,实际测试,低功耗达到了要求。

QQ picture 20210712114903.jpg

Instructions:

1. Add fingerprint

  1. Press the rightmost button to wake up the device and light up the display;
  2. Place your finger on the fingerprint sensor and press the leftmost button to add a fingerprint. One finger can be added multiple times (a total of 5 around and in the center, which can increase the accuracy of recognition);
  3. Pressing the middle button will prompt whether to delete all fingerprints;
  4. If there is no operation for a long time, it will enter sleep state.

2. Set the steering gear stroke

  1. First implement the door opening function once in sleep mode. After completion, the rotor of the servo is in the closed state. You also need to confirm the direction of rotation of the servo;
  2. The rotation angle of the fingerprint servo is fixed, but the starting angle when installing the servo arm can be changed. To adjust the starting angle of the servo arm, the main thing is not to let the servo stall, which may easily damage the servo;
  3. Use double-sided foam tape for the device, find a suitable position and stick it on the door (it is easy to use when you put your finger on the fingerprint sensor, the wiring distance is sufficient, and the servo has a suitable position to install);
  4. Use a rope to connect the small hole at the farthest end of the servo arm to the door handle. The rotation of the servo will drive the door handle to rotate. Adjust the starting angle of the servo so that the door can be opened when the servo rotates to the end angle (pay attention to the stress on the servo arm, otherwise the servo will be easily damaged).

2. Difficulties in making

1). Main equipment power consumption control

    低功耗设计不仅仅是体现在主控芯片,也包括了锂电池充电电路,舵机驱动电路,以及OLED显示屏和指纹模块等。
    由于不涉及到大功率的外围设备,而且单片机IO直接驱动更方便,所以采用了PMOS管进行设备供电的管理,在不用到这些设备时能够切断它们的电源,这样就可以有效控制功耗。设备是通过指纹模块的触摸感应进行唤醒,指纹模块的触摸电路工作电流为5uA。

2) Voltage acquisition and power consumption processing

    一般电压采集需要用到两个电阻进行分压,然后再计算实际电压,但是电阻是会产生功率消耗的,假设电源电压3.7V,采用两个10K的电阻分压,根据欧姆定律,电流就有惊人的1.85mA,一节2000Mah的锂电池,从4.2V放电到3.7V,按照80%电量计算只能待机1600/24/1.85=36天,还不包括开门时舵机损耗的电量,所以就需要换一种采集电压的方法。

Initial plan:

    因为STC15W408AS单片机可以通过测量内部的BandGap基准电压值(1.27V)左右,大致计算出输入的电源电压,从而得出电池电压,节省了一个IO口,还进一步节省了功耗。
    用户实现自己的低压检测功能的实现方法:首先用户需要在VCC很精准的情况下(比如5.0V),测量出内部BandGap参考电压的ADC转换值(比如为BGV5),并将这个值保存到EEPROM中,然后在低压检测的代码中,在实际VCC变化后,测量出的内部BandGap参考电压的ADC转换值(比如为BGVx),最后通过计算公式: 实际VCC = 5.0V * BGV5 / BGVx,即可计算出实际的VCC电压值。

However, this solution has flaws. The BandGap voltage of each STC15 microcontroller is different. When downloading each microcontroller, you need to modify the code yourself for adaptation, which is very troublesome. So updated plan 2

Update plan:

    使用STC15单片机自带的AD口测量3.3V稳压芯片输出的电压,读取AD值为V33,我们知道。STC15单片机AD口的最大测量电压就是电源电压,且最大AD值为256,则电源电压与V33就有如下关系:
    VCC/256=3.3/V33
    推导出:VCC=256*3.3/V33,从而就可以较准确得到电池电压。误差与LDO输出的3.3V稳压值有关。

3) Code compression

    代码包括OLED显示、AS608指纹通讯驱动、按键扫描、电压测量、蜂鸣器、eeprom掉电保存、舵机驱动,软件延时等;
    STC15W408AS的程序存储空间只有8K;
    最初整个代码写下来已经超过8K了;后面各种压缩代码,终于达到现在的6、7K;
    最主要的就是不要进行浮点运算,超级占用内存。比如之前计算电池电压,正常步骤:VCC=256*3.3/V33,这样就会有浮点计算的代码;
    而且我们根本用不到精确到小数后6位的电压值,只需要后2位就行。所以我们可以先把要计算的数放大100倍,最后计算结果取整就行比如:VCC=256*330/V33。



3. Project attributes

First published, a fingerprint lock was produced in 2019 (without low-power design, large in size), it has been on a few hot searches, has not won any awards, and has never participated in a school defense.

4. Open source agreement

Source code, schematics, PCB, etc. are all open source. GPL 3.0 Agreement

5. Hardware part

  • The power supply voltage of the fingerprint module and OLED module is 3.3V. The device needs to be woken up by the touch of the fingerprint. Therefore, the touch sensor of the fingerprint needs to be powered all the time, so a low quiescent current linear voltage regulator is needed to reduce power consumption;
  • The overall standby power consumption is measured to be about 22uA, which is mainly the quiescent current of the fingerprint touch sensor and linear LDO. The power-down mode of the STC15 microcontroller can control the current below 0.1uA;
  • TP4057 for lithium battery charging;
  • The servo, OLED, fingerprint main power supply, etc. are all controlled through MOS tubes to achieve ultra-low power standby;
  • The buzzer is mainly used to implement functions such as low-voltage alarm and door-opening prompt.

6. Software part

  1. The baud rate in the code is 115200. Different fingerprint modules have different baud rates. You can modify it by referring to the program routines of the STC-ISP software;
  2. The universal protocol of the fingerprint module is the universal Shengyuan AS608 protocol, C language code written by keil5;
  3. When using STC-ISP to download a program, during cold start, you must not only disconnect the power supply, but also disconnect the TXD and RXD pins. Because the microcontroller is in low power consumption mode, just the leakage current in TXD and RXD can keep the microcontroller from powering off. , failing to meet the cold start requirements may cause code downloading to fail.
  4. It is recommended to use the official software: stc-isp-v6.88F. The specific setting interface is as follows:picture.png
  5. The design project structure is divided into many source files, different functions are written separately, and there are comments in front of each function to indicate the function of the function.picture.png

7. BOM list

See the project for details; Most components can be purchased in Lichuang Mall; The fingerprint module AS608 protocol is universal and currently supports FPC0.5 and sh1.0, both of which are undercover.

8. Contest LOGO verification

23FB746CBC8E0E3693925E9D1032865B.jpg

Demo video

Use demonstration video: https://b23.tv/FoQWJQ Detailed introduction video: https://b23.tv/dYXHFc

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-18 12:16:02

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号