Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 3, No. 2, 2022 182 Design and Implementation of Single‐phase Electrical Analyzer Jilong Chen, Yuling Chen* School of Shenyang Institute of Technology, Fushun, 113122, China Abstract: This design is a single-phase electrical analysis and monitoring device, mainly composed of measurement module, control module, display module, power module, communication module. The measurement module uses RN8209 to realize the measurement of voltage and current and the sending of data, the display module uses inch TFTLCD, the communication module is Bluetooth communication, and through the control module STM32F103C8T6 coordinate all the chip work, can realize the real-time measurement and display of voltage, current, power and power factors. Keywords: STM32, LCD Liquid Crystal Display, The Bluetooth Communication. 1. Introduction Single-chip computer technology is more and more widely used in the intelligent measurement and control equipment and instrumentation, bring to People's Daily life is convenient, for single chip microcomputer principle and working characteristics of research, storage capacity for MCU study attempts to explore more and more, design a can understand electricity situation, prevent fire, remind consumer power, It plays a certain role in promoting the low carbon, environmental protection, energy conservation and emission reduction widely advocated by the current society[1]. 2. System Scheme Design This system is mainly composed of single chip microcomputer control module, measurement module, display module, communication module, power module, the following respectively demonstrate the selection of these modules. 2.1. Comparison and selection of main control chip schemes Scheme 1: using STC89C51 single chip microcomputer STC89C51 is a kind of microcontroller, has the characteristics of low power consumption, high performance, with system programmable (ISP) characteristics, and then with PC control program can download the user's program code to the MCU internal, and the speed is fast, but STC89C51 has only one serial port, does not meet the requirements of sending and receiving two serial ports. Scheme 2: Using STM32 single chip microcomputer STM32 series can meet the requirements of high performance, low cost and low power consumption. The SCM program has the characteristics of modularity, so its interface is relatively simple, and because of its own multi-function, the work speed is also fast, and STM32 has two serial ports, in line with the design requirements. It has precision, reliability and safety[2]. Comprehensive comparison of the above schemes, considering the working principle of the design scheme, scheme two is more suitable for this design. 2.2. Comparison and selection of measurement system scheme Scheme 1: Adopt ADE7755 ADE7755 It is a high accuracy electric energy metering integrated circuit, which can output the active power information in the form of frequency, and has very low sensitivity to temperature. The ADE7755 also uses only analog circuits in the ADC and reference source. All other signal processing uses digital circuits, so it can maintain extremely high accuracy and long-term stability. Scheme 2: Use RN8209 RN8209 can not only be applied to the measurement of active power, reactive power, active energy and non- functional quantity, but also can provide two independent active power and RMS value, RMS value of voltage, line frequency, zero crossing interruption, etc., can realize flexible anti-power theft scheme[3]. After comprehensive comparison of the above schemes, considering the stronger function of RN8209, scheme 2 is chosen. 2.3. Comparison and selection of communication system schemes Scheme 1: Adopt RS232 interface RS232 interface is a full-duplex data communication mode, in which data cannot be sent and received at the same time, which can ensure no conflict between data receiving and receiving. In hardware, it is realized by direction switching, but RS232 has limited and low disadvantages. Scheme 2: Use an RS485 port The interface signal level of RS485 is lower than that of RS232, which avoids the damage of the interface circuit chip. Moreover, the level is compatible with the TTL level, and it is convenient to connect with the TTL circuit. RS485 interface is half duplex data communication mode, so its transmission distance is much farther than RS232 transmission distance. The maximum data transmission rate can also reach 10Mbps. Comprehensive comparison of the above schemes, scheme 2 is more suitable for the design requirements. 183 3. System Structure and Working Principle 3.1. Overall system schematic diagram The overall design scheme of the system is shown in Figure 1. Each module plays a certain role in the whole hardware system. The RS485 communication module realizes the communication between STM32 microcontroller and measurement module. When the measurement module input data, STM32 MCU will send the data through the RS485 communication module. The data of the measurement module can also be transmitted to the microcontroller through the RS485 module, and then the data can be displayed on the LCD screen through Bluetooth communication. Figure 1. System overall design block diagram 3.2. Design of each module of the system Measurement module design: The measurement module samples the voltage, live line current and zero line current by RN8209, and measures the power and energy. Sender: First sends a specific data packet to the acquisition module. If it is successfully received, it sends the data packet through Bluetooth. If it fails to receive, it returns to the receiver. Receiver: First initialize the received file, then read and process the data. Then, if the learn key is pressed, the data will be read and it will be determined which key is 1-7. The data will be stored in the storage space. If the key is stopped, the judgment position will be returned. If it continues, the data is read and the judgment is processed. If you do not press the "Learn" button, you will enter the preset link. If there is A preset, you will store A,B... GD data; If not, read the data and determine the specific electrical appliance, determine which number 1-7 to press through key detection, and then display the overall situation on the overall interface, and return to the data reading end. Interface design: STM32 adopts TTL level, and a 485 to TTL circuit is needed to realize the communication between the measurement module and CPU. RS485 is the use of differential signal logic, interface signal is low, not easy to damage the interface circuit chip, and RS485 interface using balance driver and differential receiver combination, anti noise interference is good, can use half duplex working mode. 4. Test Results and Analysis First press Initialize, then press Learn. If key 1 is pressed, it is stored in block A, if key 2 is pressed, it is stored in block B, and so on. The data is then recorded on the LCD display. The recorded data are shown in Table 1. Table 1. Test table Test times power/W I/mA U/V Electrical equipment 1 0 2 238.64 Equipment are not pick up 2 7 57 238.64 LED lamp 3 59 250 238.64 Soldering iron1 4 58 247 238.64 Soldering iron2 5 7 57 238.64 Mobile phone charger After comprehensive analysis, the detection equipment can analyze the electrical equipment, and record the designed voltage and current, power consumption. 5. Summary In this system, 220V AC is first processed into hundreds of millivolt AC signals through current and voltage transformers, and then converted into digital signals by CS5463 chip and sent to 51 MCU through SPI serial communication, and finally processed by MCU and displayed on LCD12864. The system has strong function, small size, low power consumption, cheap price, reliable work, easy to use and other characteristics, so it can be widely used in automatic control, intelligent instruments, instrumentation, data acquisition, military products and household appliances and other fields. References [1] Yunfeng zheng. Design of spacecraft electrical load monitoring system based on STM32[J],Computer measurement and control, 2021(04):130-132. [2] Kai Wang.Design and implementation of non-intrusive load monitoring terminal,Computer knowledge and technology, 2020, 16(10):50-52. [3] Jiatian Zhang, Dianyan Wang.Design of programmable controller for DC stabilized power supply based on STM32,Industrial control computer,2020,33(12):130-132.