1. Project background
The access control system is one of the very important security control systems in modern society. Its function is to provide convenience for legal users while ensuring the safety of buildings. Currently designing an access control system design based on STM32+RC522, the registration, identification and identity verification of user cards are realized through the RFID-RC522 module, and the switch of the door lock is realized by controlling the SG90 steering gear, which has high security and reliability. Experimental results show that the access control system can effectively guarantee the safety of buildings.
The access control system is widely used in various buildings, enterprises and institutions to manage the entry and exit of personnel, control the scope of personnel activities, and realize security monitoring and other functions. Traditional access control systems use password input or swiping cards for identity verification, but there is a risk of being easily cracked. The access control system based on RFID has become a relatively advanced security control scheme.
The STM32+RC522 access control system designed this time registers and identifies the user's card through the RFID-RC522 module to complete the identification and switch the door lock. The system has an OLED display. After entering the user password to log in, you can register new cards, add new cards, and log out unused cards. In the system, the data of the IC card is stored in the internal sector of the card and managed through the internal space of the card.
Version with 5V-stepper motor:
2. System design
The access control system is composed of STM32F103C8T6 microcontroller, RFID-RC522 module, SG90 steering gear, LCD1602 liquid crystal display, keyboard module, etc. Among them, the STM32F103C8T6 single-chip microcomputer is used as the core controller of the system to control the execution of the program; the RFID-RC522 module is used as a device for identifying user cards; the SG90 steering gear is used as a door lock control device; the OLED display screen provides user input information and system information display; the keyboard The module is convenient for users to input password and card information.
2.1 Software Design
【1】RFID card information management
This system uses the internal space of the card to manage the IC card information. Each IC card can be divided into multiple sectors, each sector contains multiple blocks, and each block contains 16 bytes. Sector 0 is reserved by the manufacturer to store the serial number of the card. Sectors 1-15 can be configured by the user to store some private data, such as user identity, license plate number, employee number, etc.
In this system, the management of IC card information mainly includes three aspects: new card registration, card identification and card cancellation.
For the registration of a new card, the user needs to press the "#" key on the keyboard to enter the registration mode, then enter the administrator password, and then put the new card on the RFID reader, the system will read the serial number of the card and record it on the card The user name and password information, etc. are stored in the sector.
For card identification, when the user presses the confirmation key of the access control system, the system will read the card serial number read in the RFID module, and query the user name and password information in the card sector for identity verification. If the card recognition is successful, the system will control the steering gear to rotate one circle to realize the unlocking function.
For card cancellation, the administrator needs to enter the password for identity verification, and then put the card to be canceled on the RFID reader, and the system will clear all the data in the sector of the card.
【2】Access control system security control
The access control system adopts the combination of password verification and card identification, which improves the security of the system. Specifically, the system requires the user to enter a password or swipe a card for identity verification, and only after the verification is successful can the door lock be controlled to open and close. At the same time, the system can also record the time and user information of each unlocking of the door, so that the administrator can carry out security monitoring.
【3】Door lock control
The access control system adopts SG90 steering gear to control the switch of the door lock, which has the advantages of simple structure and convenient control. In the door lock control process, the system finely controls the frequency and duty cycle of the steering gear control signal to achieve accurate switch of the door lock.
2.2 Hardware Design
STM32F103C8T6 single-chip microcomputer is a programmable 32-bit single-chip microcomputer based on Cortex-M3 core launched by ST Company, which is often widely used in industrial control, smart home, embedded control and other fields.
Its main features include:
1. Cortex-M3 core: STM32F103C8T6 uses Cortex-M3 core, which has the characteristics of high performance, low power consumption, hard real-time, etc., and can support multiple serial ports, I2C, SPI, USB and other peripherals, bringing users more flexibility.
2. 32-bit processing capability: STM32F103C8T6 is a 32-bit microcontroller with higher data computing capability, programming flexibility and calculation accuracy than 8-bit and 16-bit microcontrollers.
3. Strong system time management capability: STM32F103C8T6 has an internal RTC real-time clock module, which can realize accurate time management and time stamping functions, and has great advantages in some application scenarios that require time synchronization.
4. Large storage capacity: STM32F103C8T6 has built-in 64K bytes of flash memory and 20K bytes of SRAM, which can meet the storage requirements of large embedded applications.
5. Rich peripheral interfaces: STM32F103C8T6 supports multiple peripheral interfaces, such as SPI, I2C, CAN bus, etc., which is convenient for developers to expand related application scenarios.
6. Strong code portability: Because the chip is widely used, it can be developed with a variety of development tools, such as Keil, STM32CubeMX, etc., and supports a variety of programming languages, such as C language, C++, etc., so the advantages are easy to use in different Implement code porting between platforms and different developers.
The RFID-RC522 module is a low-cost, cost-effective RFID read-write module. It has the characteristics of high precision and fast reading, and is widely used in access control systems, smart card management, logistics tracking and other fields.
The features of the RFID-RC522 module are as follows:
1. High precision: The RFID-RC522 module uses radio frequency induction technology for signal transmission and reading and writing, which has the advantages of high precision and strong stability.
2. Fast reading: The reading speed of the RFID-RC522 module is fast, generally it only takes about 0.1 seconds to complete the reading operation.
3. Support multiple protocols: RFID-RC522 module supports ISO14443A/B, FeliCa and other RFID protocols, which can meet the needs of different applications.
4. Low power consumption: RFID-RC522 module has low power consumption, the working current is 13-26mA, and the standby current is 10A.
5. Simple interface: RFID-RC522 module uses SPI interface for communication, and there are 7 pins on the module, which has good compatibility.
6. Support multiple development languages: RFID-RC522 module supports multiple development languages, such as C++, Python, etc., which is convenient for developers to carry out secondary development.
The use of RFID-RC522 module needs to cooperate with relevant library files, and code writing and development are carried out on development boards such as Arduino and Raspberry Pi. Common usage scenarios include access control systems, smart card management, inbound and outbound management, logistics tracking and other fields.
【3】SG90 steering gear
The steering gear is compact and durable, and can precisely control the opening and closing of the door lock.
SG90 steering gear is a small steering gear with small size, light weight and low price. It is often used in model airplanes, small mechanical arms, toy models and other fields. It uses a DC motor, uses PID control technology, and a precise pinion reducer to control the steering angle.
The features of SG90 steering gear are as follows:
1. Small size: The size of the SG90 servo is 23mm * 12.2mm * 29mm, and the weight is only 9g, which is very suitable for small electronic devices.
2. High precision: The control precision of the SG90 steering gear is relatively high, the controllable angle range is 0 ~ 180 degrees, and the resolution is 1 degree, which can realize accurate control to the angle.
3. Low noise: The SG90 steering gear adopts a precision reduction gearbox, which rotates very smoothly and has very low noise.
4. Low power consumption: The motor of the SG90 steering gear is very power-saving. Generally, it uses a 3V to 6V power supply and only needs 20 mA of current, which can greatly save power consumption.
5. Moderate price: The price of SG90 steering gear is relatively low, which is very suitable for beginners or users with large demand.
The SG90 servo needs to be controlled by PWM signal when in use.
【4】0.96 inch OLED display
The 0.96-inch SPI interface OLED display is a miniaturized screen, which belongs to OLED display technology. It is connected by SPI interface. The appearance size is about 12mm * 12mm, and the resolution is generally 128 * 64 or 128 * 32. It can be used in various small electronic devices such as handheld devices, small instruments, smart home control panels, and more.
OLED is an organic light-emitting diode. Compared with traditional liquid crystal displays, OLED has the advantages of fast response, wide viewing angle, bright colors and high brightness. The SPI interface is a serial peripheral interface, which has the characteristics of simplicity, flexibility, and high speed.
The driver chip of a 0.96-inch SPI interface OLED display is generally SSD1306, which has 128 columns and 64 rows of pixels, and some pixels have 128 columns and 32 rows. Among them, the 128*64 pixel screen has a larger display area, which is clearer and more delicate when displaying images and text. The 0.96-inch SPI interface OLED display has the advantages of compactness, high definition, and high speed, and is widely used in various small electronic devices.
This module allows for easy entry of passwords and card information.
The 4x4 capacitive matrix keyboard module with IIC interface is a capacitive key module based on IIC bus communication, which is often used in industrial control, home appliances, medical equipment and other fields.
Its main features include:
1. Using IIC bus communication: The 4x4 capacitive matrix keyboard module with IIC interface is connected to the MCU through IIC bus communication, which simplifies the connection method and is convenient to use.
2. Capacitive button design: a capacitor is placed on each button, when the finger touches the button, the capacitance value of the capacitor changes, and the button detection is realized by detecting the change of capacitance.
3. 4x4 matrix arrangement design: The 4x4 capacitive matrix keyboard module adopts a matrix arrangement design, with a total of 16 keys, which can meet more complex application scenarios.
4. Simple interface: The 4x4 capacitive matrix keyboard module with IIC interface only needs two lines, SCL and SDA, to connect to the MCU.
5. High sensitivity: The capacitive button design makes the button detection more sensitive, and there will be no accidental touch of the button slightly bouncing, making it more comfortable to use.
6. The code is concise: using this module does not need to write a complicated button scanning program, only need to read the button value on the IIC bus.
The 4x4 capacitive matrix keyboard module with IIC interface is a convenient, easy-to-use, high-sensitivity button module. It realizes the detection and response of buttons through the design of capacitive buttons, and simplifies the connection method through IIC bus communication. It is suitable for many fields, such as industrial control, home appliances and medical equipment, etc., and can bring more convenient and efficient control methods to users' products.
8Mbit Flash Memory
8M Flash Memory
8Mbit Serial Flash Memory
DDR2 128Mx16 PC667 Pb free Ind Temp
DDR2 128Mx8 PC800
DDR2 128Mx8 PC800 Lead Free
8K Serial EEPROM 1Kx8