Three-phase multi-function energy meter solution based on Cortex-M3 core STM32

Publisher:MysticalEssenceLatest update time:2016-10-09 Source: eechina Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Background

  As the basic equipment for energy measurement, the energy meter has been paid attention to by the national power department for a long time. The energy meter manufacturers have spared no effort to seek solutions with excellent design and development performance and lower cost. At present, the design of domestic energy meters has gone through the transformation from 8-bit MCU to general DSP and even dedicated DSP. The disadvantage of the application solution of general DSP is that the professional application and embedding level of DSP are not deep enough, and the cost is high; while the functions of dedicated DSP are relatively fixed, which brings difficulties to the design and production of energy meters and the lack of functional differentiation space. ARM-based solutions have also appeared, but the ARM7 TDMI suitable for the application is not satisfactory in performance and has insufficient peripheral resources; while the higher-end ARM9 system is very complex and has a high cost. Choosing a suitable and low-cost microprocessor has become the key to the energy meter industry. Until the emergence of STMicroelectronics (STMicroelectronics, hereinafter referred to as ST) STM32 brought new opportunities and space for the specialization and customization of energy meter design.

  1. About CORTEX-M3 and STM32

  In 2005, ARM released its latest generation of ARM v7 core, named Cortex. Compared with ARM7/9/10/11, it has a revolutionary breakthrough in architecture and a fundamental leap in performance. The Cortex series includes three series, -A/-R/-M. Cortex-M3 is especially targeted at embedded applications that are sensitive to power consumption and price, and has high performance. It uses an efficient Harvard structure three-stage pipeline to achieve 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, and has a very high code density. Single-cycle 32-bit multiplication and hardware divider ensure that the computing power of Cortex-M3 has been greatly improved. In some occasions where the computing power requirements are relatively low and the embedded requirements are relatively high, STM32 has the potential and even advantages to replace traditional DSP. Cortex-M3 includes a nested vector interrupt controller NVIC, with a maximum interrupt response speed of only 6 cycles, an internal integrated bus matrix, and support for DMA operations and bit mapping.

  STM32 is the first product based on the ARM Cortex-M3 core launched by ST in the industry. It inherits the excellent pedigree of the Cortex-M3 core and adds ST's high-performance peripheral resources, FLASH, SRAM memory, rich serial communication interfaces such as IIC, SPI, USART, CAN, USB, etc., as well as 12-bit ADC and DAC modules, and a flexible static memory controller FSMC that supports external memory access.

  2. Electricity meter solution based on STM32

  According to the requirements of the function and error accuracy of the electricity meter, we selected the enhanced series STM32F103xx of ST's STM32, with a maximum operating frequency of 72MHz. In addition to completing fast data processing in program design, correction and compensation for system nonlinear distortion are also carried out.

  The block diagram of the energy meter system is shown in Figure 1:



  (I) Data collection, processing and calculation

  In practical applications, the power signal is collected into the energy meter through a transformer, and A/D conversion is performed through a 6-channel 16-bit analog front-end processor (AD73360), converted into a digital signal and transmitted to the STM32. AD73360 is a 6-channel synchronous sampling Σ-ΔADC device. It has a built-in basic voltage reference and a built-in independent PGA (programmable gain amplifier) ​​for each channel. It is very suitable for synchronous sampling of three-phase current and voltage signals. When the signal is small, the appropriate dynamic range can be obtained by adjusting the channel PGA to ensure the measurement accuracy of weak signals. The data acquisition block diagram of the energy meter is shown in Figure 2. The



  voltage and current input signals first need to be filtered by an RC filter network and data sampled, and then A/D conversion is performed. AD73360 has an independent clock source and can be configured as an automatic data acquisition and transmission mode, and continuously transmits 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 large current signal, we need to convert the sampled signal into a bipolar voltage signal with high fidelity so that it can be discretized by AD circuit. AD73360 is a single-power supply analog front end, so we need to make the input signal located in the middle of the dynamic range of AD73360. The method adopted is: define the ADC operating voltage as 5 volts (dynamic range 0~5V), select the reference voltage of 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. The specific circuit is shown in Figure 3.



  In the actual circuit, the phase current signal is converted into a low voltage signal by CT, and the phase voltage is divided by a high-precision resistor network to obtain a linear low voltage signal. The signal amplitude range must be guaranteed to be within 5V.

  (III) Interface between AD73360 and STM32

  Because the total amount of basic data generated by AD73360 is huge, in order to occupy as little CPU time as possible, it is necessary to use the hardware SPI and DMA units inside STM32 to realize data transmission, and the core of STM32 obtains basic data in batches and starts the data processing program according to the transmission results of DMA. The hardware connection relationship is shown in Figure 4.


  The SE and RESET of AD73360 are controlled by the GPIO of STM32, and an external interrupt input pin is used to monitor the frame synchronization signal, so that the byte correspondence of the data frame content can be guaranteed by the program.

  In the hardware setting 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, and automatically save the data received in SPI slave mode in 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 use requirements, so that AD73360 is in data mode and actively sends sampled data to STM32.

  3. Calculation of main electric energy parameters

  AD73360 is a fixed period 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 DMCLK division factor of 2048. AD73360 is 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:

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

  Current measurement (effective value) calculation formula:

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

  The total power S (i.e. apparent power) is calculated based on the effective value of current and voltage, and 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, and 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:

  Single device active power calculation formula:

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

  Single device reactive power calculation formula:

  In the formula: Q - single element reactive power, n - number of sampling points per cycle, uk - voltage sampling value on the element, ik - current sampling value on the element (after 90 degrees phase shift)

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

  In the formula: PΣ - three-phase active power, Pk - (k=u,v,w) active power of each phase

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

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

  Fourth, compensation and correction of nonlinear distortion

  The electromagnetic components (CT or PT) 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 also necessary to use segmented correction and compensation methods. For example, according to the phase shift curve of CT (PT), two appropriate points are selected to divide the entire range into three sections. When the measured value is in different sections, different phase shift parameters are called to perform phase compensation on the measured value.

  The method for obtaining linearity compensation parameters and phase compensation parameters (calibration process) 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 all voltage channel input values ​​to the standard voltage value of 220V (RMS) and record the voltage calibration parameters of each phase.

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

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

  5. All the compensation parameters obtained are stored in a non-volatile memory, such as the FLASH of STM32.

  5. Electricity meter matching circuit

  In addition to the measurement and metering functions, the energy meter also needs to realize communication, storage and time management functions. The specific procedures and practices will not be repeated here, but in order to realize the complete energy meter function, the selection of its peripheral devices is critical.

  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 the life cycle, eliminating the process of clock calibration of the meter and reducing production costs. The RTC also has battery status monitoring, power-on/power-off timestamp recording functions and built-in digital temperature sensor functions, and can be used in comprehensive power terminal equipment other than the meter.

  Voltage reference: Intersil's ISL21009 series is a low-noise, high-stability precision voltage reference, which is 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 with simple peripheral circuit requirements and a wide input voltage range of 40 volts. The energy meter often works under a wide input voltage range. Therefore, NCP3063 is very suitable for 5 volt or 3.3 volt DC voltage regulation behind the power frequency transformer of the energy meter.

  Communication interface circuit: Intersil's ISL3152E is a full-featured RS485 interface chip. This interface chip has many characteristic indicators that are particularly suitable for the energy meter AMR system. These include 1/8 standard load drive (256 nodes), positive and negative 16.5 kV ESD protection, hot-swap function (node ​​power supply changes do not affect bus communication), 20Mbps bus rate, support for star topology network, etc.

  Conclusion

  The three-phase energy meter solution based on CORTEX's STM32 has proven to be the most advantageous mainstream solution at present, and has been widely praised and recognized by the industry. At present, this solution has been successfully applied in the 0.5S electronic three-phase multifunctional watt-hour meter of a large-scale meter manufacturer.
Reference address:Three-phase multi-function energy meter solution based on Cortex-M3 core STM32

Previous article:Design of a new anti-counterfeiting code reader
Next article:stm32f051(2) system clock setting

Recommended ReadingLatest update time:2024-11-16 13:48

How to generate hex file in IAR using stm32
1In the project options, 2 Select the output converter option. 3 Check the Generate additional output option 4 Select the Intel extended option in Output format 5. Check Override default under Output file to complete. Then there will be ×××.hex in the Exe folder. The above steps are as shown below  
[Microcontroller]
How to generate hex file in IAR using stm32
STM32 - PWM generation
1. Basic concepts of TIMER output PWM Pulse Width Modulation (PWM), short for "Pulse Width Modulation", is a very effective technology that uses the digital output of a microprocessor to control analog circuits. To put it simply, it is the control of pulse width. It is generally used to control the speed of a stepper
[Microcontroller]
Design of ECG Data Acquisition Instrument Based on STM32
  Nowadays, cardiovascular diseases have become one of the major diseases that threaten human health, and a clear and effective electrocardiogram provides a basis for diagnosing such diseases. The electrocardiogram acquisition circuit is the key part of the electrocardiogram acquisition instrument. The electrocardiogr
[Microcontroller]
Design of ECG Data Acquisition Instrument Based on STM32
STM32 TIM1 PWM output problem
I recently encountered a strange problem. The stm32 timer 1 was configured as PWM output. There was waveform output in the simulation and when it was downloaded to the board, there was also waveform output. However, after power-off and reset, sometimes there was waveform output and sometimes there was not. It was very
[Microcontroller]
STM32 external interrupt summary
This article was written after learning about STM32. It is a small understanding of STM32. If there are any errors in the article, please point them out. I would be grateful. STM32 has up to 68 maskable interrupt channels with 16 programmable priorities. For the STM32F103ZE chip, it contains 19 edge detectors to gen
[Microcontroller]
Comparison of register versions and library function versions of several STM32 operations
1. USART1 receiving completion flag detection USART1- SR&0X40 == 0 USART_GetFlagStatus(USART1,USART_FLAG_TC)==RESET 2. USART1 sends data USART1- DR = (u8)ch; USART_SendData(USART1,(u8)ch);
[Microcontroller]
STM32 SysTick
I feel that the 1 second timing is still a little inaccurate. It is just a visual measurement. I will use an oscilloscope to measure it next time. Included Files: (1)Main C language:  Code#14620 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Experimental platform:
[Microcontroller]
STM32 SysTick
Design of TFT digital color screen with STM32 direct driving RGB interface
Introduction With the continuous development of industrial technology, the development and application of human-machine interface are unprecedentedly hot. In order to have a more friendly human-machine interface, TFT digital color screens are widely used, but TFT color screens usually do not have controllers,
[Power Management]
Design of TFT digital color screen with STM32 direct driving RGB interface
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号