Design of power control system for student dormitory

. T his design is based on the residential building of boarding school as the research object. The STC89C52RC single-chip microcomputer is used as the main control chip, and the clock chip, temperature chip, smoke collection module, A/D conversion, LED digital tube display circuit, matrix keyboard, infrared wireless remote control and other controllers are used to control the power system and adjust the access control system. This system is applicable to all kinds of colleges and universities that have strict management on students' electricity consumption. It can automatically control the electricity consumption of students' dormitories according to the school management regulations, and can automatically make emergency response to emergencies such as fire.


Introduction
With the sustained and rapid development of the economy and the remarkable improvement of people's living standards, the requirements of boarding students on the management level of electricity use are also increasing.The intelligentization and humanization of dormitory can improve students' good feeling for dormitory life and improve the quality and safety of dormitory life [1].If we only rely on human resources to achieve the management level required by these requirements, we often need to pay a huge cost.Therefore, the automation of building power system and access control system is particularly important.This design can realize the basic functions of the system, and the cost is low.It can expand the functions according to the needs, and has a certain market prospect and promotion value.

System design scheme
The design uses STC89C52RC as the core control chip, in combination with the work and rest time management regulations of the student dormitory, uses the clock chip as the time basis chip of the power system control, uses the 8-bit common anode 7-segment digital tube as the display circuit, and can display the date, clock and temperature information through *Corresponding author: skdlcy123@163.comhttps://doi.org/10.1051/shsconf/202316601058SHS Web of Conferences 166, 01058 (2023) EIMM 2022 the digital tube, Drive the corresponding relay through the drive circuit to meet the requirements of controlling each circuit (use led lamp to display the working status of each relay).The design can also realize the startup and shutdown of the dormitory access control system, and use the smoke sensor module, photosensitive resistor, A/D conversion and other circuits to realize the emergency plan.3 Hardware design

Minimum system design of single chip computer
STC89C52 is a low-power, high-performance CMOS 8-bit microcontroller produced by STC, full-duplex serial port communication.[2].The minimum system is mainly composed of power supply, reset circuit, oscillation circuit, etc.Since there are many external devices connected to the P0 port of the single chip computer in the later stage, in order to enhance its driving ability and ensure accuracy and stability, 8x10K pull-up resistor is used here.

Power circuit input and output design
The control board of this design adopts DC5V power supply, and directly uses the power adapter with the input Vi of AC220V and the output Vo of DC 5V for power supply.Because STC89C52RC single-chip microcomputer is the core control element, it is easy to be subject to electromagnetic interference.Therefore, several 0.1uF capacitors can be connected in parallel to enhance the filtering ability of the power supply circuit as a protective measure to improve its anti-interference ability.

LED display
In order to visually display the current time, so as to accurately judge the current working state of the controller, you can choose to display the current time using a 8-bit red LED with a total anode.

Clock circuit
DS1302 clock chip is a low-power, high-performance real-time clock chip launched by an American company, with 31 bytes of static RAM attached.It transmits multiple bytes of clock signal and RAM data in a burst mode, and uses SPI three-wire interface to https://doi.org/10.1051/shsconf/202316601058synchronize with MCU [3].The design is powered by the filtered power supply of the power adapter DC5V.At the same time, in order to ensure that the chip can save data in case of power failure, so that it can continue to work when the power supply is restored, the design uses DC3V button battery as the backup power supply energy.

Relay control circuit
Because the single-chip microcomputer system is a DC 5V weak current control system, and the dormitory building is powered by AC 220V and 50Hz current, the single-chip microcomputer cannot be directly used to control the power system and access control system in the dormitory building.In addition, because there are many rooms in the dormitory building of boarding school, the whole dormitory building consumes a large amount of power, reliable isolation technology must be used to separate the mains part from the controller circuit part.This design uses optocoupler isolation technology here.

Matrix keyboard circuit
The matrix keyboard is a keyboard group with a layout similar to the matrix used in the external equipment of the single chip computer.When there are many keys in the keyboard, in order to reduce the occupation of I/O ports, the keys are usually arranged in a matrix form.The keyboard is designed to adjust the manually input DS1302 clock, and also to manually control the access control and power system in case of emergencies.This design uses matrix keyboard instead of directly connecting with P3 pin of single chip computer, which is not only to save the number of I/O ports, but also to prepare for the expansion of functions when necessary later.

3.7A/D conversion circuit
A/D conversion is a circuit that quantizes analog quantity or continuously changing quantity and converts it into corresponding digital quantity.Due to the use of smoke sensors, photoresistors, etc. in this design, the single-chip microcomputer needs to convert the analog signals collected by the smoke sensor module, photoresistors and other sensors into digital signals for analysis through the A/D conversion chip, so that the controller can react to the system.In this design, the AT2402 chip is used as the external memory chip EEPROM, When necessary, it can save the working data that the single chip computer needs to store, which is convenient to call.

Sensor circuit
The sensor can convert the detected danger signal into electrical signal (usually analog value), and then convert it into digital signal that can be recognized by the computer through A/D, and make corresponding response after analysis.In this design, considering that high-power power consumption is likely to lead to sudden fire and other unexpected situations, smoke sensor module, photosensitive resistor and temperature chip are used as sensors for detection, so that emergency response can be made in time in case of special circumstances, and digital tube can be used to display the current temperature condition at a fixed time.

Infrared wireless receiving circuit
Infrared wireless receiving remote control is a widely used means of communication and remote control, which is widely used in real life.The infrared wireless remote control circuit includes a transmitting circuit and a receiving circuit.This design adopts infrared wireless remote control mode, directly uses the single chip computer for decoding, uses the common DIY electronic remote controller as the transmitter, uses the VS838 infrared remote control receiver as the receiver, and transmits the command signal to the single chip computer for analysis and corresponding execution.

Drawing of control board and relay drive board PCB
In order to save space and resources, the control board in this design uses patch packaging.In order to improve the anti-interference ability of PCB design, in addition to basically meeting the frequency characteristics of each device, the PCB board in this design should be arranged as evenly as possible, and large linewidth should be used for wiring.The copper-clad surface of the bonding pad and the bottom layer of the top layer shall be optimized accordingly.

Software design
The design of system software is to make each part of hardware run by writing the program of corresponding module.The corresponding program can be divided into main program and subprogram of each part.In this system, three modes of manual, automatic and infrared wireless remote control can be used to realize the functions of power supply/power off and door opening/closing at the corresponding time.

Conclusion
As an intelligent building power consumption system, the power consumption control system can monitor the temperature, smoke and other conditions of the equipment at all times, and also make emergency response to emergencies such as fire.In addition, the control mode of the system in this design is also very flexible, which can meet the control requirements of the electrical system in the student dormitory.A series of low-power devices are adopted, which has low cost.It not only effectively saves the use cost, but also effectively strengthens the management of the electrical system and access control system in the student dormitory, and ensures the use safety.