newlandmark

2021 Question H - Electrical Appliance Analysis and Identification Device

 
Overview
#2021H Question-Electrical Appliance Analysis and Identification Device### Project Introduction This design is an electrical appliance analysis and identification device for the 2021 Electronic Design Competition h question. All parts of the work have been re-engraved and verified to be correct, and can achieve all the functions required by the question. The detailed requirements of the topic will be discussed below. Using the STM32F407VET6 microcontroller as the control core and combined with the high-precision three-phase energy measurement chip HT7038, a single-phase electrical appliance analysis and identification device is designed and implemented. This device uses a voltage and current transformer to obtain the electrical parameter information of the line, connects to the HT7038 to perform equal-ratio sampling and processing of the current and voltage, and transfers the electrical parameters to the main control chip STM32 through the SPI interface. By measuring the voltage, current, and Analyze and identify electrical parameter characteristics such as phase, active power, and power factor, and send the results to the serial port screen for display. This device has two working modes: learning and analysis and monitoring. In the learning mode, it tests and stores various electrical characteristic parameters of a single electrical appliance on the same line; in the analysis and detection mode, it displays the types and working status of various electrical appliances in real time. . For nonlinear voltage and current, the accuracy can reach 0.1%, and the effective value calculation accuracy of voltage and current can reach 0.2%. In addition, this system has the characteristics of fast response speed and good learning effect. [Watch project demonstration video online](https://qwe199881010.cn.quickconnect.to/vs/sharing/w3EG3WTe#!aG9tZV92aWRlby01MQ==) [Project demonstration video download link](http://gofile.me/6U0Ru/RzgO58QFl ) Since the video needs to be linked to my NAS to download and watch, the loading speed will be slightly slower. The NAS startup time is 11:00-21:50 every day, please watch within this time period. The attachment below contains the compressed version of the video (720p, original 2k), which can also be downloaded and watched from the attachment. - - - ### Project function introduction 1. Design and make a device that analyzes the category of electrical appliances in use based on the electrical parameter information of the power line current. The device has two working modes: learning and analysis and recognition. In the learning mode, the characteristic parameters used to identify each single electrical appliance are tested and stored; in the analysis and recognition mode, the category of the electrical appliance in use is indicated in real time. 2. Basic requirements (1) Electrical appliance current range is 5mA ~10.0A, which can include but is not limited to the following appliances: LED bulbs and 220V light strips, energy-saving lamps, USB chargers (with load), wireless routers, set-top boxes, electric fans, Kettle, induction cooker. (2) Customize the types of electrical appliances that can be identified, the total number is not less than 7, represented by serial numbers. The number of electrical appliances with a current not greater than 50mA is no less than 5, including one homemade electrical appliance, numbered 1 to 5; the electrical appliance numbered 7 has a current greater than 8A. (3) Randomly increase or decrease the electrical appliances in use, and display in real time the characteristic parameters that can identify whether the electrical appliances are in use and the current on the power line. The response time is no more than 2 seconds. The types and properties of characteristic parameters are customized. (4) Use resistors, capacitors and diodes to make your own electrical appliance No. 1. Its current is the same as that of electrical appliance No. 2 but has a different phase and contains harmonics. The current difference between the two is less than 1mA. 3. The play part (1) has a learning function. Clear all characteristic parameters stored in the work, retest and store the characteristic parameters of the specified appliance. The learning time for an electrical appliance is no more than 1 minute. (2) Randomly increase or decrease the electrical appliances in use, and display in real time the characteristic parameters that can identify whether the electrical appliances are in use and the current on the power line. The response time is no more than 2 seconds. (3) Improve the ability to identify electrical appliances with the same current but different other characteristics and the ability to identify small current electrical appliances when large and small current electrical appliances are shared. (4) The operating current of the device in the analysis and identification mode is not greater than 15mA, and wireless transmission to the mobile phone for display can be selected. (5) Others 4. Description A1 and A2 in Figure 1 are used to measure the current of the device and the current of the electrical appliances in use respectively. Test the basic requirements of electrical appliances that come with them and connect the power plugs safely. Failure to meet the basic requirements (2) The requirements for the current of electrical appliances are considered violations and will not be tested. Complete the learning process before submitting your work, and directly demonstrate the basic required functions during the competition area test. **5. Analysis of the topic (key point, this is a pitfall we have stepped on, and it is also the main reason why many groups have not completed it)** ![System block diagram.png]         **According to several key points in the requirements of this topic The device does not exceed 15ma (at 220v) in the recognition state, which limits the power. As a result, we cannot use Raspberry Pi/FPGA, and the power efficiency is slightly higher. Moreover, the question belongs to the mixed direction of artificial intelligence and instrumentation, and requires certain calculations. The amount requires a stronger core chip (I tried STM32F103, but the performance was not enough). We chose stm32f407vet6, and the final effect can complete learning and recognition within 2 seconds. ** **Hardware circuit requirements are more towards instrumentation. For the rapid development and circuit simplicity of the competition, and in order to meet the analysis and identification of harmonics and small currents under large currents (that is, accurate measurement of phase angles) this design is The HT7038 multi-function high-precision three-phase electric energy measurement chip is selected as the core chip of the electrical parameter measurement module. The chip integrates 6-channel second-order sigma-delta ADC, reference voltage circuit and all power, energy, effective value, power factor and frequency. The measured digital signal processing circuit can measure the active power, reactive power, active energy and reactive energy of each phase. It can also measure the current, voltage effective value, power factor, phase angle, frequency and other parameters of each phase. External After 1000:1 current transformer and voltage transformer, the requirements of this topic are fully met. ** **In addition, although the mains power is theoretically 220v, in fact it changes very much. This group designed a self-correction system (actually an expansion requirement) to correct and learn the parameters during the pre-test preparation stage to match the actual situation. Voltage and working conditions are very important. This is why many groups failed to solve this question. ** **There are also some considerations in the selection of electrical appliances. Try to choose electrical appliances with obvious characteristics. The electrical appliances selected by this group are as follows: ** | Number | 1 | 2 | | --- | --- | --- | | Name | Homemade electrical appliance 1 (three 62k4w resistors in parallel) | Homemade electrical appliance 2 (a rectifier bridge plus three 62k4w resistors, and a bbc capacitor in parallel) | | Number | 3 | 4 | 5 | 6 | 7 | | --- | --- | --- | --- | --- | --- | | Name | Raspberry Pi 4b (no fan) | Cuttable light strip (total 50ma current) | 220v5w energy-saving lamp | 220v industrial fan | 2200w electric heater | - - - ### Circuit explanation! [QQ picture 20211108102432.png]         The circuit diagram only has the ht7038 circuit, which is the circuit diagram corresponding to this project. The peripheral circuit design is available in the data sheet. You can go to Lichuang by yourself Check it out in the mall. I won’t go into details here. This design only uses the channel 1 interface for voltage and current. The other excess interfaces can be left unused. Since it is an instrument type, it has higher requirements for small signals. It is recommended to add more filtering and isolation capacitors. , digital ground, power ground, and analog ground should be separated and grounded at a single point. ![pcb.jpg]         There are actually some problems in the design, such as the ground loop problem. The ground generally should not form a loop, which is equivalent to a coil. People receive clutter signals. This board is subject to corrosion due to the time limit of the electronic design competition. It is completed in the form of a board, which is special compared to ordinary circuit boards. If the requirements are higher, you can redraw it yourself. **At the same time, since this is a copper-clad board, there are three wires inside that are not fully connected. These are flying wires, please pay attention to the connections** - - - ### Actual picture! [Large picture of the circuit board.jpg] ! [Full set of coding. jpg] - - - ### The software design idea is shown in the figure: ![Software block diagram.png]         Limited by hardware and time conditions, we did not use adc fft to directly extract harmonic features. Instead, we used active power and reactive power as feature vectors. Because they satisfy the linear superposition principle, we only need to measure each harmonic feature. The characteristic vectors corresponding to 128 different situations can be calculated based on the characteristic vectors of various electrical appliances. 1. Study. The microcontroller receives the learning signal from the serial port screen and stores it in a 2*8 array. One dimension does not have any initial values ​​of electrical appliances and needs to be subtracted during calculation. 2. Identify. First, for 1-7 types of electrical appliances, binary coding is used as 2^1, 2^2, 2^3, 2^4, 2^5, 2^6, 2^7. The current circuit feature vector after mean filtering is compared with the calculated 128 situations to find the value corresponding to the minimum Euler distance, and then binary decoding is performed to obtain the type of electrical appliance contained. The core code is shown below, and the detailed library files and codes are in the attachment``` distance = pow(average[0]/10,2) + pow(average[1]/10,2); class_min = 0; for(i = 1;i < (1 <<(TYPE_NUM-1));i++){ CalcFeature[0] = feature_flash[1][1] * (i &0x01) + feature_flash[2][1] * ((i>> 1)&0x01) + feature_flash[3][1] * ((i>>2)&0x01) + feature_flash[4][1] * ((i>>3)&0x01) + feature_flash[5][1] * ( (i>>4)&0x01) + feature_flash[6][1] * ((i>>5)&0x01) + feature_flash[7][1] * ((i>>6)&0x01) ; CalcFeature[1] = feature_flash[1][2] * (i &0x01) + feature_flash[2][2] * ((i>>1)&0x01) + feature_flash[3][2] * ((i>>2)&0x01) + feature_flash [4][2] * ((i>>3)&0x01) + feature_flash[5][2] * ((i>>4)&0x01) + feature_flash[6][2] * ((i>>5) &0x01) + feature_flash[7][2] * ((i>>6)&0x01) ; temp_f32 = pow(CalcFeature[0]/10 - average[0]/10,2) + pow(CalcFeature[1]/10 - average[1]/10,2); if(temp_f32 < distance){ distance = temp_f32; class_min = i; } } ``` - - - ### Summary (1) Thoughts of four days and three nights is good for the body and It is a huge test of ability. The e-sports competition is not as long-term or as watery as other competitions. In fact, I have never experienced this kind of centralized test when making things or projects before. When making things in the past, you could replace the chip if it burned out, and you could change the plan if it didn't work. But e-sports is different. You don't have so much time to waste, so you have to bite the bullet and get on with it, so the plan at the beginning is very important. At the same time, during the electric competition, each teammate is required to cooperate and do his or her own thing. As long as one person is paddling, it will be very difficult. (2) Problems encountered: The problems encountered are basically encountered when debugging the driver ht7038 chip. Regarding the hardware issue, because I used a self-corroded board, the copper pouring and EDA were done in reverse, and I accidentally marked the pin order of the SPI interface in reverse. I didn't realize it before, and it was stuck for a long time. Because the first generation board did not draw the voltage mutual inductance interface. So I drew another version, but the new version of the board had three places where jumpers were needed, and the unconnected prompt on the EDA was a bit small, which caused one to be missed during soldering and stuck again for a while. There is also the problem of Dupont lines. Since the SPI protocol is used, the requirements for signal lines are relatively high. Dupont lines were used at the beginning, which caused the data to be incorrect. When debugging, I touched the Dupont lines with my elbow and found that the data had changed. , and immediately realized that it was a problem with the DuPont wire (we had encountered a similar situation before), so we immediately soldered the DuPont wire to the board, and the data became normal. ### Wiring table - - - | Category | Function | Wiring serial number | --- | --- | ---- | | UART2 | RX | PA3 | | | TX | PA2 | | RCC | IN | PH0 | | | OUT | PH1 | | SPI | SCK | PE11 | | | NSS | PE12 | | | MOSI | PE13 | | | MISO | PE14 | | UART1 | RX | PA10 | | | TX | PA9 |
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-22 22:04:17

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号