Three-phase energy meter solution based on STM32 of CORTEX

Publisher:龙腾少年Latest update time:2012-08-04 Source: 21ic Keywords:CORTEX  STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

background

The electric energy meter is an instrument used to measure electric energy, also known as watt-hour meter, fire meter, energy meter, kilowatt-hour meter, which refers to the instrument that measures various electrical quantities. ARM-based solutions have appeared, but the ARM7 TDMI suitable for the application is not satisfactory in performance and has insufficient peripheral resources; while the more advanced ARM9 system is very complex and expensive. Therefore, we need to study a cheap electric energy meter that meets customer needs to fill this gap.

1. About CORTEX-M3 and STM32

The latest generation of ARM v7 core, named Cortex, has a revolutionary breakthrough in architecture compared with ARM7/9/10/11. It uses an efficient Harvard structure three-stage pipeline, reaching 1.25DMIPS/MHz, and the power consumption is 0.06mW/MHz. Cortex-M3 uses the Thumb-2 instruction set, automatic 16/32-bit mixed arrangement. Single-cycle 32-bit multiplication and hardware divider ensure that the computing power of Cortex-M3 is greatly improved. Cortex-M3 includes a nested vector interrupt controller NVIC, with the fastest interrupt response speed of only 6 cycles, an internal integrated bus matrix, and supports DMA operations and bit mapping.

The STM32 system is divided into two different series according to performance: STM32F103 "Enhanced" series and STM32F101 "Basic" series. The clock frequency of the Enhanced series reaches 72MHz, which is the highest performance product among similar products; the clock frequency of the Basic series is 36MHz, which has significantly improved performance than 16-bit products at the price of 16-bit products.

2. Electricity meter solution based on STM32

According to the function and error accuracy requirements of the energy meter, we selected STM32F103xx with a maximum operating frequency of 72MHz.

Block diagram of electric energy meter based on STM32

1. Data collection, processing and calculation

In practical applications, power signals are collected into the energy meter through a transformer, and then converted into digital signals through a 6-channel 16-bit analog front-end processor (AD73360) for A/D conversion and transmitted to the STM32. The AD73360 is a 6-channel synchronous sampling Σ-Δ ADC device with a built-in basic voltage reference and independent PGA for each channel. By adjusting the channel PGA, a suitable dynamic range can be obtained to ensure the measurement accuracy of weak signals.

Electricity meter data acquisition block diagram

The voltage and current input signals first need to be filtered by an RC filter network and sampled, and then A/D converted. AD73360 has an independent clock source and can be configured as an automatic data acquisition and transmission mode, continuously transmitting data to STM32 through the SPI bus. The Cortex-M3 core in STM32 processes the input digital signal, completes digital filtering, zero-crossing detection, obtains basic current and voltage data, and obtains the corresponding electric energy measurement through time integration calculation and conversion.

(II) Sampling circuit and filtering network

Since the sampled signal is a high voltage signal and a high current signal, we need to convert the sampled signal into a bipolar voltage signal with high fidelity so that it can be discretized by the AD circuit. We need to make the input signal be located in the middle of the dynamic range of AD73360. The method used is: define the ADC operating voltage as 5 volts, select the reference voltage as 2.5 volts, connect the negative end of the AD differential input directly to the reference voltage input, and connect the positive end of the differential input to the measured signal. For circuit analysis, refer to Figure 3:

Sampling circuit and filter network [page]

(III) Interface between AD73360 and STM32

In order to minimize the CPU time, the hardware SPI and DMA units inside the STM32 are used to realize data transmission, and the STM32 core obtains basic data in batches and starts the data processing program according to the DMA transmission results. The hardware connection relationship is shown in Figure 4.

Interface circuit between AD73360 and STM32

In the hardware setup program of STM32, it is necessary to turn off all interrupts of SPI, set SPI to slave mode, and select a DMA channel to work with it, automatically saving the data received in SPI slave mode to the specified memory address. In order for AD73360 to collect data correctly, it is also necessary to configure the internal registers of AD73360 according to the usage requirements, so that AD73360 is in data mode and actively sends sampled data to STM32.

3. Calculation of main electrical energy parameters

AD73360 is a fixed-cycle acquisition. We use 150Hz or 160Hz, that is, 150/160 points are collected per cycle. For this reason, the clock used by AD73360 is 6.000MHz or 16.384MHz. The configuration of AD73360 in the system is that the DMCLK division factor is 2048. AD73360 is a differential acquisition, which is very convenient for zero-crossing detection and DC component adjustment to ensure signal amplitude symmetry, thereby reducing system errors.

Voltage measurement (effective value) calculation formula:

formula

Where: U-voltage effective value, n-number of sampling points per cycle, uk —voltage sampling value

Current measurement (effective value) calculation formula:

formula

Where: I-current effective value, n-number of sampling points per cycle, ik-current sampling value

The total power S is calculated based on the effective values ​​of the current and voltage. The active power P is obtained by integrating the current and voltage product over time. The reactive power Q is the difference between the total power S and the active power P. The power factor is the ratio of the active power P to the total power S.

The calculation of active power and reactive power for single device and three-phase four-wire star load is summarized as follows:

The calculation formula of active power of a single element is:

formula

Where: P-active power per unit, n-number of sampling points per cycle, uk-voltage sampling value on the element, ik-current sampling value on the element

The calculation formula of reactive power of a single element is:

Where: Q-unit reactive power, n-number of sampling points per cycle, uk-voltage sampling value on the component, ik-current sampling value on the component (after 90 degrees phase shift)

Three-phase four-wire three-element active power calculation formula: PΣ=Pu+Pv+Pw

Where: PΣ-three-phase active power, Pk -(k=u,v,w) each phase active power

Three-phase four-wire three-element reactive power calculation formula: QΣ=Qu+Qv+Qw

Where: QΣ-three-phase reactive power, Qk -(k=u,v,w) reactive power of each phase

[page]

4. Compensation and correction of nonlinear distortion

The electromagnetic components that may exist in the process of electrical signal acquisition will cause phase distortion and linear distortion between the acquired signal and the actual signal. In order to compensate and correct the errors caused by these distortions, it is necessary to use segmented correction and compensation methods.

The method for obtaining the linearity compensation parameters and phase compensation parameters is as follows:

1. Zero bias calibration: Set all channel inputs to zero and record the zero position of each channel respectively.

2. Voltage calibration: Set the input value of all voltage channels to the standard voltage value of 220V (RMS) and record the voltage calibration parameters of each phase.

3. Current calibration: Set the input value of all current channels to the demarcation point current, and record the calibration parameters of the small current measurement section of each channel. Then set the input value of all current channels to the maximum value, and record the calibration parameters of the large current measurement section of each channel.

4. Phase shift calibration: The input phases of the current and voltage channels are set to differ by 60 degrees respectively, and the current value of the current channel is at the middle point of the phase compensation section. The phase compensation parameters of the compensation section are obtained based on the active energy error.

5. All the compensation parameters obtained are stored in non-volatile memory.

5. Electric energy meter matching circuit

Real-time clock circuit: Intersil's ISL12022M is a high-reliability fully automatic temperature compensation RTC chip with a built-in clock crystal. The RTC relies on factory pre-calibration and automatic temperature compensation in the full industrial temperature range to ensure the timing accuracy of electronic products throughout their life cycle. The RTC also has battery status monitoring, power-on/power-off timestamp recording functions, and a built-in digital temperature sensor function, and can be used in comprehensive power terminal equipment other than electricity meters.

Voltage Reference: Intersil's ISL21009 series is a low-noise, high-stability precision voltage reference used to provide a higher stability (5ppm) reference voltage for the measurement system when the stability of the AD73360 built-in reference (50ppm) is not enough.

Power management circuit: ON Semiconduction's NCP3063 is a low-cost, high-efficiency DC/DC regulator that has simple peripheral circuit requirements and a wide input voltage range of 40 volts. Electric energy meters often operate under a wide input voltage range, so NCP3063 is very suitable for use behind the power frequency transformer of the electric energy meter to perform 5 volt or 3.3 volt DC voltage regulation.

Communication interface circuit: Intersil's ISL3152E is a full-featured RS485 interface chip that has many characteristics that are particularly suitable for the AMR system of electric energy meters, including 1/8 standard load drive (256 nodes), positive and negative 16.5 kV ESD protection, hot-swap function, 20Mbps bus rate, support for star topology network, etc.

Conclusion

The three-phase energy meter solution based on CORTEX's STM32 has a certain reputation in the market, so this solution has successfully solved various existing problems and has high competitiveness in the market. Enterprises will tend to choose this cheap, convenient and fast system.

Keywords:CORTEX  STM32 Reference address:Three-phase energy meter solution based on STM32 of CORTEX

Previous article:Design of an integrated two-phase stepper motor driver based on CAN bus
Next article:Wireless network system design based on STM32L152 and S14432

Recommended ReadingLatest update time:2024-11-16 15:22

STM32 Learning 006_Systick Usage (I)
Systick is a unique system clock in STM32 Systick has two functions: 1. Can generate accurate delay; 2. A separate clock beat can be provided to the system. General delay procedure: DELAY(N) {     for( i=0  ; i =x ; i++ )  ; } For the STM32 series of microprocessors, it only takes tens of ns to execute an instruction.
[Microcontroller]
Tick-tick clock operation to understand STM32 library operation
  The library function operation of STM32 brings many conveniences to design developers. Developers do not need to fully understand the internal registers and hardware mechanisms of STM32. As long as they have a basic understanding of C language, they can complete the development of the microcontroller, which shortens
[Microcontroller]
STM32 serial port + DMA usage 1
        STM32 has 5 serial port resources (USART1, USART2, USART3 and UART4, UART5). Among them, 3 are USART (universal synchronous asynchronous receiver and transmitter); 2 are UART (universal asynchronous receiver and transmitter); As for the difference between USART and UART, if they are only used as serial ports,
[Microcontroller]
Cortex-M3 operating modes and exceptions
1. Working Mode          Thread mode and handle mode. When the processor is in thread mode, it can use both privileged and user levels. On the other hand, handler mode is always privileged. After reset, the processor enters thread mode + privileged level.   2. Exceptions and Interrupts The Cortex-M3 supports a large
[Microcontroller]
Design of electric vehicle battery management system based on STM32 and CAN bus
With the widespread application of battery energy, the depletion of oil resources and environmental pollution, electric vehicles have attracted more and more attention for their advantages of energy saving and environmental protection. In the research and development of electric vehicles, the research and manufacture
[Power Management]
Design of electric vehicle battery management system based on STM32 and CAN bus
stm32 (two) stm32 interrupt priority setting
stm32 priority     1. Priority level:       STM32 users can assign 16 levels of priority, that is, the upper four bits of the priority register NVIC- IP are used to represent the priority of each interrupt.         2. Priority group:       In STM32, the priority of an interrupt is divided into: preemption priority and
[Microcontroller]
stm32 printf output to USART1
/************************head File*****************************************/ #include"stm32f10x_lib.h" //Include all header files #include stdio.h   /*******************************位绑定定义*****************************************/ //#define GPIOA_ODR_A  (GPIOA_BASE+0x0C) //#define GPIOA_IDR_A  (GPIOA_BASE+0
[Microcontroller]
stm32 printf output to USART1
D/A playback of MIT-BIH ECG data based on STM32
0 Introduction The ECG signal is one of the earliest bioelectric signals studied and applied in clinical medicine. The analysis and processing of ECG signals can effectively predict heart diseases. How to use ECG data to develop and research related medical equipment is crucial for researchers. ECG data playback is t
[Microcontroller]
D/A playback of MIT-BIH ECG data based on STM32
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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号