aytwartoofyoroo

ESP32 access control system that never runs out of power

 
Overview

It’s still the same old life

An access control system I built when I was in school

Video tutorial of Bilibili: https://www.bilibili.com/video/BV1uT4y1w7F1

Introduction

An IoT access control system based on ESP32.

The door-opening action is controlled by the servo, and ESP32 sends a PWM signal to the servo to open the door.

 

Safety and reliability statement

As with anything electronic, there is unreliability. I personally tested that it can run stably for 1 month without human intervention, that is, without restarting the power, pressing the hardware reset button, or plugging in and out of the battery, etc. , but I strongly recommend keeping the mechanical lock and installing an electronic lock on top of the mechanical lock ( There was news once that a family had a fire and a power outage in the house. However, the electronic lock that his house had just replaced a while ago was still a purely electronic lock. It did not have a mechanical opening and could only be opened by AC power. It did not even have a built-in battery! Then the door couldn't be opened, and the family couldn't escape because the electronic lock failed) and the key was backed up and could be placed in the dormitory next door (this is what I did).

 

Features

  1. Built-in uninterruptible power supply, 24-hour power supply , even if there is no power in the dormitory at night, you will not be afraid of being unable to open the door
  2. Based on Blinker networking, it can also be controlled remotely from outside.
  3. Support fingerprint to open the door, fingerprint supports Touch power-on function
  4. Support Hall induction door switch status
  5. Built-in web, even if the router is powered off at night and there is no network, you can open the door through the web
  6. Support computer bat to open the door
  7. Supports remote control air conditioning function and can customize the remote control code
  8. Supports access to Mijia, Xiaoai voice control, and Tmall Elf voice control
  9. Supports 1.3-inch and 0.96-inch OLED display status

 

1.OLED indication

OLED screens support 1.3 inches and 0.96 inches . The screen definition can be modified through code.
The screen status display has two pages.


1.1 The first page displays various statuses about the Internet.

WIFI icon
: When connected to the Internet, the icon is displayed normally (only the icon is displayed, and the WiFi distance is not displayed). When not connected to
WiFi , an When the connected wifi has a network, the network connection icon will be displayed. When there is no wifi connection or the connected wifi has no network, no network icon will be displayed.
IP address display : When the wifi is connected, the connected IP address will be displayed. You can connect the same through your mobile phone and computer. After accessing the wifi or network, access this IP address to enter the web interface
AP IP display : ESP32 will always send out an AP. Connect your mobile phone and computer to the wifi sent by ESP32 and then enter the IP address displayed by the AP. You can also enter the web interface to control the door. This The IP is generally fixed 192.168.4.1. Generally, the ESP32 cannot connect to the router after the dormitory is powered off, but the door opening
time can still be displayed on the mobile device : the current year, month, day, hour, minute, and second are displayed. When there is no Internet connection, horizontal bars will be displayed.

 

1.2 The second page shows the status of ESP32

The display on the large page is an estimate of the current remaining battery state and voltage , not an exact value. Suggestions for code modification: take multiple samples, remove the maximum and minimum values, and then average. I only sampled once here, so it is not very accurate.

There is also charging status . The capacity of the battery icon on the left will change according to the remaining battery power. There is also door status detection to detect whether the current door is open or closed.

 

1.3 Other displays :

When pressing the fingerprint, the words "Fingerprint Recognition in Progress", "Fingerprint Error", "Recognition Timeout" and other words will be displayed.
When the door is opened, the word "Open the Door " will
be displayed. When the phone is turned on, the word "System Initialization" will be displayed.
When restarting, the word "reboot" will be displayed (the restart function will be introduced below).

 

2.LED indication

The LED indicator light is very bright for some people's eyes at night, but I did not set a hard switch to turn it off. Only the low battery, WIFI and network indicator lights can be turned off through the software, and other lights cannot be turned off.

Battery indicator light: It will light up when the battery power is turned on, indicating that the uninterruptible power supply part is already working.

5V power supply: indicates the 5V supply for the MCU to work

Door power supply: Servo 6.6V on indicator light

Fingerprint power supply: fingerprint 3.3V power on indicator light

Infrared indicator (flashing): Indicates that there is currently an infrared transmission signal being emitted.

Low battery indicator (flashing): Indicates that the battery power is less than 20%

WIFI indicator (flashing): Indicates that there is currently no WIFI connection. The WIFI indicator light is off when connected normally, the WIFI indicator flashes, and the network indicator also flashes.

Network indicator (flashing): Indicates that there is currently no network connection. The network indicator light is off when connected normally.

 

3. Air conditioner infrared

There is a lot of content, please check the B station video, [How to use the code and how to use the remote control function.docx], and cooperate with the attachment [Air conditioning coding template.txt]

 

4.WEB

Normally, this is not used to open the door, but when the power is cut off at night and the ESP32 cannot connect to the Internet, you can connect to the hotspot sent by the ESP32 itself. After connecting, open 192.168.1.1 and enter the WEB to control the door opening, for emergency use.

Both mobile phones and computers are acceptable

 

5.BAT command

Please view the attachment [Batch command usage on PC.docx] and the attachment [Open the door.bat]

Under the same network, click Open Door.bat on the computer to easily open the door. The principle is to call WEB

 

6.Fingerprint

Please note! The fingerprint module can only be powered by 3.3V, not 5V! ! !

Use the attachment [fingerprint module host computer test software.zip] to enter fingerprints through the CH340 tool

Using fingerprint is still much more convenient than Blinker.

Just connect the fingerprint to the PCB according to the wiring color.

The wire in the demo video is relatively short, you can buy a wire to extend it outside the door.

Because it is an optical fingerprint, the fingerprint integrates the Touch function, that is, the light of the optical module will light up only when pressed by your finger. This saves power. However, you can also modify the software to make the fingerprint module light always on, but this is not recommended. Will affect the service life of the fingerprint module.

 

7.Blinker

There is a lot of content, please check out the video at Bilibili and attach it with [Blinker configuration.txt], [Blinker configuration method.docx], [code usage method and remote control function usage method.docx]

After configuration, the interface looks like this

 

8. Door status detection

In fact, it uses Hall sensors and magnets to detect the door status.

It is recommended to put it on top so it won’t get in the way.

However, please note that the DATA pin is directly connected to the MCU. The power supply voltage of this Hall is 6.6V, and the DATA output is 5V. Do not connect the wrong wires. Connecting 6.6V to DATA will burn the MCU.

 

9. About fine-tuning

Because the door handle strength and door opening threshold installed by each user are different. Sometimes, because the PWM rewinding and playback parameters of the servo were not adjusted properly during the configuration, the servo would rewind less and play back more, resulting in the door not being able to open. Therefore, fine-tuning is set, of course clockwise or counterclockwise. Just try and you will find out.

 

10. About restarting

There is a built-in soft restart program, and the restart trigger conditions are:

If the WIFI is not connected, or the WIFI is connected but the network is disconnected, and it exceeds 1800 seconds, that is, half an hour, a soft restart will be triggered.

For example, if it runs normally for 2 hours, it will restart if the network is suddenly disconnected.

For example, if the network has been disconnected for 30 minutes, it will restart.

You can check the code for specific conditions.

The purpose of soft restart is that Blinker will automatically reconnect after being disconnected from the Internet and WIFI for only a few minutes. After the power is disconnected at night and the Internet is connected in the morning, Blinker will not reconnect, so it can only be restarted every half hour to allow Blinker to reconnect. Try to connect to the internet.

Of course, if your dormitory has uninterrupted power and network, I also recommend adding a scheduled soft restart in the early morning, which is good for the machine (the code is not written, you need to add it yourself).

You can also restart by pressing the restart button on the Blinker.

 

11.Others

It is recommended to solder the infrared emission tube. The packaging is 3mm, but 5mm can be used for better emission effect.

There is also a pure plug-in version, which is convenient for handicapped people to weld. The project is being sorted out and will be released later. The code is common and the functions are the same.

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-24 01:39:56

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号