王达业

2017 Question K: Single-phase electrical appliance analysis and monitoring device +630648A

 
Overview

 

    Table of contents

1.1 Preface                           

1.2 Personal introduction                      

1.3 Project Analysis                       

1.4 Schematic analysis

1.5 PCB circuit board analysis                           

2.1 Physical picture display                  

3.1 Programming                                     

1.1 Preface 

 
   First of all, I would like to thank everyone from all walks of life for guiding my project. Please correct me if there are any omissions in the article! I have participated in many electronic design competitions, but I have never participated in the National College Student Electronic Design Competition. I wanted to experience the difficulty of the electronic competition, so I made the 2013 Question A DC-DC power supply. Now I am taking advantage of the time to do the 2017 question K: single-phase electrical appliance analysis and monitoring device      . The difficulty level of this question is very suitable for our students with average basic knowledge. In this question, we can learn about high-voltage signal wiring. And how to use current transformers, you can also learn the sampling and processing of alternating current. I hope everyone can learn knowledge from my project.
The video has been uploaded to Bilibili: https://www.bilibili.com/video/BV1YZ4y1c7Qf
 
  Name: Lei Chaolin, English name: Mark Lei, pen name: Fu Lai
  Born in 2000 in Hengyang, Hunan.
  Electronic and electrical major, focusing on integrated circuit testing technology and high-frequency signal processing fields
  Award-winning experience (chronological order)
  Published the paper "Exploration on STM32 and PID Algorithm" in April 2020
  First Prize in the Electronic Design Competition of the Ministry of Science, Technology and Innovation in July 2020 (Host)
  Outstanding students of Lichuang Internet of Things summer practical training camp in August 2020
  First Prize in the Academy’s Embedded Design Competition in September 2020 (Host)
  Provincial first prize in Hunan Province Electronic Design Competition (TI Cup) in October 2020 (host)
  Provincial First Prize in the 2021 Hunan Vocational College Skills Competition (Integrated Circuit Application and Development) (Host)
  First Prize of Lichuang Tuya Smart Joint Training Camp in March 2021
  Second prize in the Hunan Provincial Industrial and Information Technology Skills Competition in October 2021, and the honorary title of National High-end Technical Expert
  To be continued…
 
The picture above shows the work report to the director of Hunan Provincial Department of Science and Technology (first from left)
 
First we get the question and analyze it
The title reminds us that we need to analyze and monitor the power parameters of single-phase electrical appliances, and we can learn to identify various electrical appliances.
At the same time, observe the picture. We need to leave two monitoring points to monitor whether the parameters of our analyzer are correct. We should pay attention to this. The previous stage is AC input, the latter stage is AC output, and the power strip is connected at the same time.
 
 
YzngBqk6bwSkqzVTuoUoGP4xuZvgeEeYuTDYLkZP.png
 
 
From the question, we can learn: Monitoring load types: USB charger (with load), wireless router, electric fan, kettle, switching power adapter, soldering iron.
In learning mode, each single electrical appliance is used in various states. Identify electrical appliances and their working
conditions and store the characteristic parameters of their operating status;
In the analysis and monitoring mode, the category and working status of electrical appliances are indicated in real time.
The operating current of the device in monitoring mode is not greater than 15mA
 
 
u3Zmtn5urlSl36AqLaR7EaJSXCrIKHaF8WHSMQre.png
 
The performance part reminds us that the processing time when learning should not exceed 1 minute, which requires us to sample quickly and accurately.
After knowing the requirements of these questions, our ideas for solving problems will become clearer. Make alternating current samples, process them with a microcontroller, and display them on the screen.
There are also requirements for the power consumption of the entire instrument. 15mA is 220*0.015A=3.3W, and the entire instrument must be below 3.3W.
I plan to use PM01 as the power supply for the entire system. This module is very suitable for small-sized products, AC-DC modules, and the price is acceptable.
 
TfKtCK84pLGwU5w6ZqLh2i7eWxCS0R2IVCiBjWwA.png
 
 
mALipZXnKpiZzdgmopDws4LtFZCHjM1UPUhd8ZkB.png
Looking at its data sheet, the overall power of the entire module is 3W, which meets the requirements of our question.
 
In the AC power sampling part, I plan to use HLW8032 or BL6523, which can not only sample voltage and current, but more importantly, can monitor the phase angle between current and voltage. Why is this important? Because different loads have different power factors, so we can easily determine the type of electrical appliances.
 
 
6yszOOklDINdlm5AJYg0s5Z2ClwAUHvtdUFY2OoG.png
The picture above shows the characteristics of HLW8032 . The price is not very expensive, only a few yuan per piece.
 
Ftv7uzuXZaLw2UQ9n4UiGKdR4JQCOrXsznHh698p.png
The picture above shows the application circuit of non-isolated HLW0832. I use isolated sampling.
 
 
 
CS97Z4uxewKAFkEIGDSC8SRina3wJtBJtmoaABs8.png
 
mTq55UFVraj9UIqYLOWxz35jLytd6TUWjfVB8edz.png
The picture above shows the characteristics and internal functions of BL6523. Taking the two chips into consideration, the peripheral circuit of BL6523 is more complicated and is not suitable for our students with weak foundation, so I used HLW8032
 
 
l09GLZzUF4rdGIzINi3oLzOOcTdHEtASUqbKmsCi.png
I use STC15W4K56S4 as the microcontroller. Why do I use this microcontroller? The first is because the price of STM32 has skyrocketed. The second is because we don’t need to involve too many functions, and I have a source program based on 51, so I chose it.
 
 
I will introduce the main components here, and I will introduce the schematic diagram and PCB later.
 
 

1. Main power circuit

2. MCU circuit

3. Sampling circuit

1. Main power circuit

2SxJuC8mCuodRU6qpClkJZA230rC0zWNsOqlSj0Y.png
The above picture is the main power circuit. U3 is the AC-DC step-down HLK-PM01, U2 is the sampling chip HLW8032 chip, J1 and J2 are the interfaces for the series current transformer, and P1 and P2 are the 220V power output and input.
I connected a large-capacity capacitor in parallel to the PM01 output, and it is a solid capacitor. The latter stage uses a 100nF capacitor to filter high frequencies. At the same time, an LED is used as a power indicator.
Some students may ask why ADC sampling is not used. Let me answer it here: Our circuit needs to sample an AC circuit, and it involves 220V high voltage. We must consider the safety of our subsequent microcontroller, so using an integrated AC sampling chip is The most convenient and safe.
In other words: “You don’t need to raise a cow to drink milk.”
 

2. MCU circuit

O0QhRK14D3Q3dIapXMayBbLKuDqcjgESLDjqo1BL.png

 
 The picture above shows the MCU circuit. The circuit is designed with four buttons and an OLED screen interface. It also retains the serial port download circuit, but does not integrate the USB-TTL circuit on the board because it can save space and reduce costs.
This circuit does not need to be introduced too much. It is the most basic microcontroller and the smallest system. The power supply current of OLED is also very small, which basically meets the requirements.
 

3. Sampling circuit

gnrbOfTqAEar4WVUuypHpTGrGkA7xgSknv7V7uNp.png
 The picture above shows the sampling circuit, which uses a ZMPT107 voltage transformer and a ZMCT103 current transformer. The accuracy of these two transformers is relatively high.
 
AexAXSIdD63EiGrz1oXy6YxcHv2NclTAXBkoH74N.png
The picture above shows the ZMCT103 current transformer, the ratio is 1000:1
 
 
W5CURUPDLDAqUHCGwCrVcWEHKHsYLTnnJ7knU63E.png
The picture above is the official design drawing
1. HLW8032 sampling method: isolated sampling;
2. The output signal of the current transformer in this figure is a current signal, and R2 converts the current signal into a voltage signal;
3. The maximum input range of the current signal acquisition terminal is 30.9mV, and the current transformer output The voltage difference after the current passes through R2R3 is 30.9mV;
4. Current-type voltage transformer, maximum output 2mA, transformation ratio 1000:1000, R8 takes the current limiting function, and the power value of R8 is P=u*u/R;
5 , current transformer, transformation ratio 1000:1;
 
Our peripheral circuits can just follow the official design
 
 
For wiring we can refer to the design guide of HLW0832
M8Nfbh1gNhEGvCk3A4dBoPTRdSevHG3maqClIv1V.png
 
The picture above shows the official design guidance, which tells us to ground at a single point.
 
QXbeZeo0K1D2EqE5mxaFN5wr3jeDEC8mT7dxuW5J.png
 
The picture above shows the PCB board I designed. It has a simple structure. The upper part is the high-voltage part and the lower part is the microcontroller processing part . What we should note here is that the 220V AC power must be provided with slots to prevent electricity creepage.
The way to set the slot is to draw a top line of about 20mil, then right-click and set it to slot
Before designing the PCB of the power supply, we need to understand two things first. The first is that the power supply circuit generally has a large current. Generally, the copper coating on the PCB is 1OZ.
When we design the connection line, it is best to wire it according to the 100mil 5A standard. My power supply is 2-3A.
So I chose 80mil power supply wiring, and the current must first pass through the capacitor and then enter the component, which can greatly improve the efficiency of our circuit. This time I chose semi-circular arc wiring, which is more beautiful!
It is best to leave a little space between each module, which is not only more beautiful but also anti-interference.
Add via holes and large areas of copper to increase current and increase heat dissipation
 
 
 
 
 
EAsqjAMF183BgIB3iOJR5CYE9YgaNthXn2gFUzFI.png
The picture above shows the 3D model of the circuit board
 
 
 

3.1 Programming     

 
In programming, we need to clarify the program ideas and program framework
The figure below is the program flow chart
kix8GUAnZKVJkOGz73lmHncbhOfqzykTgtTtm4x9.png
First, let’s analyze the registers of HLW0832
 
lUGET7dzndNFStnQlQHxFK9pk6OCVQTLdT49mYvG.png
 
5DHSguftr7DIoLCTlURAaH2L9Kvwuk56I2yAr8xC.png
 
4p2MyPRIMddE7Pan4gSbPtsOgC7feQ2jIwNgufdg.png
 
 
The following is part of the HLW0832 register source program

#define u8 unsigned char
#define u16 unsigned int
#define u32 unsigned long

u8 Receive_Data[24]; //Receive data cache, HLW8032 sends 24-byte data every 100ms
u16 Data=0; //Currently received data
u8 Receive_Flag=0; //The status of received data
u8 SumCheck=0; / /Checksum
u32 VParam=0; //Voltage register
u32 VReg=0; //Voltage parameter register
float Cur_Voltage=0; //Current voltage value
u32 IParam=0; //Current register
u32 IReg=0; //Current Parameter register
float Cur_Current=0; //Current current value
u32 PParam=0; //Power register
u32 PReg=0; //Power parameter register
float Cur_WATT=0; //Current power value
float Cur_VA=0; //Current view In power
float Cur_PF=0; //Current PF
u8 DUR7=0; //The seventh bit of the data update register, when the PF register overflows, bit7 is inverted once
float Acc_electricity=0; //The accumulated electric power
u8 Vol_Flag=0;
u8 CUR_Flag =0;
u8 POW_Flag=0;
u8 Err_Flag=0;
u32 PF_Num=0;
u8 StateREGData=0;

static unsigned char Test1[10],Test2[10];

 

After sampling the voltage and current, it is displayed and output to the OLED screen using analog IIC.

After pressing the learning button, the current information is automatically saved to the microcontroller.

When you press the start monitoring button again, the program will automatically search for electrical appliances with matching parameters.

Since the program is too long, I will put the source program in the attachment below.

The picture above shows the working power. Only 0.856W meets the requirements of our question.
 
 
 
 
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-20 06:27:51

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号