With the rapid development of the national economy, the demand for energy in various industries is increasing. The large-scale consumption of non-renewable resources such as coal and oil has reduced the storage capacity, and energy shortages will inevitably affect the development of the national economy. The mining of coal and oil will consume a lot of electricity, especially the mining of oil, where the pumping unit often has the phenomenon of "empty pumping", and a lot of electricity is consumed. Therefore, improving the efficiency and quality of electricity consumption is a way to alleviate the energy crisis, which requires real-time monitoring of the operation status of the power grid. In order to obtain the electrical parameter information of the power grid, this paper uses the power metering chip ATT7022C combined with the ARM microcontroller to design an electrical parameter measurement module. The module can use LCD to display data in real time, and can also transmit the collected electrical parameters to the host computer to monitor the status of the power grid in real time.
1 Introduction to ATT7022C chip
ATT7022C chip is a high-precision three-phase power dedicated metering chip launched by Juquan Optoelectronics Technology (Shanghai) Co., Ltd. It is suitable for three-phase three-wire and three-phase four-wire wiring methods, and its internal structure block diagram is shown in Figure 1. The chip integrates 7-channel second-order sigma-delta ADC, reference voltage circuit and digital signal processing circuit including power, effective value, power factor, energy, etc. The chip has a built-in temperature measurement sensor and provides fundamental active and fundamental reactive meter calibration pulse output; it also has ADC sampling data cache function, the cache length is 240, and the original sampling data can be saved in real time. At the same time, the chip also supports single-channel, dual-channel and three-channel synchronous sampling functions for users to analyze sampling data. The chip provides an SPI interface for data transmission with an external MCU. The external controller only needs to read and write each register through the SPI bus to obtain the value of the three-phase electrical parameters. In order to obtain accurate electrical parameter values, calibration operations must be performed. The chip supports pure software calibration. After calibration, the active accuracy of the instrument can reach up to 0.5 level and the reactive accuracy can reach 2 level.
2 Design of electrical parameter measurement module
The overall structural block diagram of the electrical parameter measurement module is shown in Figure 2. The module is mainly composed of real-time measurement of electrical parameters, LCD display, storage, and communication with the host computer. The LCD is mainly used to display parameters such as voltage, current, energy consumption, power factor, time, and temperature. The module uses RS485 bus or wireless networking transmission to transmit various measured electrical parameters to the host computer, and monitor the operation status of the power grid in real time.
The goal of the module design is to measure and display electrical parameters in real time with low energy consumption, and to be able to communicate with the host computer. This requires the processor to run fast and consume low power. The LPC2138 chip can meet this requirement. It has 2 SPI and I2C interfaces, up to 47 general I/O ports that can withstand 5 V voltage, and a real-time clock module with independent power supply and clock source.
When the energy metering chip is reset, the internal energy register will be reset to 0. If an unexpected power outage occurs, the value in the energy register in the chip will be lost. The AT24C02 chip is selected during the design to save the value of the energy register. In software program design, the memory is refreshed once the load consumes 1 kWh of electricity or other data.
The real-time clock is powered by the ARM system and an external battery. When the system is accidentally powered off, the clock module can be powered by an external battery to ensure the normal operation of the clock. It is worth noting that when the real-time clock is initialized, the clock starts to run correctly after the accurate time is written to the clock chip for the first time. Then the clock initialization function in the program should be removed and the entire program should be loaded again. Otherwise, the clock will be initialized every time the module is reset, so the clock will not run correctly.
[page]
3.1 Module Peripheral Circuit Design
The peripheral circuit of ATT7022C is shown in Figure 3. In order to minimize the ripple and noise of the power supply, 10μF and 0.1μF capacitors are used for decoupling at each power pin of the chip. In Figure 3, V1P/V1N, V3P/V3N, V5P/V5N are the current acquisition channels of the three phases A, B, and C respectively; V2P/V2N, V4P/V4N, V6P/V6N are the voltage acquisition channels of the three phases A, B, and C respectively. When connecting the circuit, connect the SP1 port, SIG, CS, and RESET of ATT7022C to the SPI port, P0.28, P0.29, and P0.30 of LPC2138 respectively for communication. SIG is a handshake signal, and the controller monitors the operating status of the chip through this pin. SEL is the three-phase electrical wiring selection pin. There is a 300 kΩ pull-up resistor inside the energy chip. When the pin is left floating, it is a three-phase four-wire connection. When the pin is grounded, it is a three-phase three-wire connection. When connecting the hardware circuit, it must be noted that the power supply of the energy metering chip and the LPC2138 must share the same ground, otherwise the controller will make errors in reading and writing the chip.
3.2 Signal acquisition module
Voltage and current acquisition uses a double-ended differential signal input method to collect data. The maximum input voltage is ±1.5 V during normal operation. Both pins have ESD protection circuits, and the maximum withstand voltage is ±6V.
The voltage signal can be collected by voltage division or mutual inductance. In order to obtain a more stable signal, this system decided to use a mutual inductor to collect signals. This not only plays the role of electrical isolation. It can also prevent the chip from being burned by excessive current. Since the voltage channel of the energy metering chip has good accuracy and linearity when the secondary voltage of the mutual inductor is 0.5 V, the voltage mutual inductor with the specification of LCTV3JCF-220V/0.5V is selected as the voltage signal acquisition end during design. The voltage acquisition circuit is shown in Figure 4(a). The 1.2 kΩ resistor and 0.01μF capacitor in the circuit form an anti-aliasing filter. The REFO signal is connected to the 2.4 V reference voltage output by the energy metering chip, which acts as a DC bias.
The current signal is collected by connecting the current signal output by the current transformer to an appropriate resistor and collecting the voltage across the resistor to indirectly measure the current value. The chip has good accuracy and linearity when the current channel is collected at a voltage of 0.1 V, so a current transformer with HTTA-5 A/5 mA specifications is selected during design. When the rated current is input, the output current signal is connected to a 20 Ω resistor to obtain a 0.1 V voltage signal. It is worth noting that the selection of the current transformer should be based on the current range in the primary circuit during actual application, and the resistor should also change accordingly to ensure that the input signal is around 0.1 V. The current collection circuit is shown in Figure 4(b).
[page]
4 Software Design
The software design of the module first initializes the communication interface of each part, then calibrates the chip, and then writes the experimental calibration values into each register of ATT7022C. Finally, in the loop statement of the main function, the data of each register of the chip is retrieved for display, storage, and transmission to the host computer.
4.1 SPI interface function of ATT7022C and LPC2138
Figures 5 and 6 are the SPI interface read and write timing diagrams of ATT7022C chip respectively. In the figure, CS is the chip select signal line of the chip; SCLK is the clock signal line; DIN is the serial data input line, which is used to transmit the user's data, commands, and addresses to the ATT7022C chip, and it communicates with the MOSI of the SPI bus of the ARM processor; DOUT is the serial data output line, which is used to read data from the ATT7022C chip, and it communicates with the MISO of the SPI bus of the ARM processor. As can be seen from Figure 5, when writing a byte of data to the ATT7022C chip, the data is ready at the DIN pin when SCLK is high, and one bit of data is written into the chip at a falling edge of the clock. When reading a byte of data from the ATT7022C, the chip will transfer one bit of data to the DOUT pin at a rising edge of the clock, and ARM reads the pin to get one bit of data. When using the ARM SPI bus, the data is valid when the SCLK is high, so the CPOL bit should be set to 0 when setting the SPI control register. The first bit of data transmitted by the SPI is sampled at the second clock edge, and the CPHA bit should be set to 1. When ARM communicates data with the ATT7022C chip, it is necessary to write an 8-bit command word to the ATT7022C chip before reading or writing 24 bits of data through the SPI interface. The high bit comes first during data transmission, and the LSBF bit should be set to 0. During the data transmission process, CS should be kept at a low level, and CS should be pulled high after the transmission is completed. At the same time, set the SPI bus to the master mode and disable the interrupt of SPl.
The SPI interface function is as follows:
[page]
When the program is running, if you want to know whether the communication function is correct, you can judge by reading the calibration data checksum register value. After the chip is reset but before the calibration data is written, the reset data stored in it is a fixed value. Send the command word 0x3E or 0x5F to read 24-bit data. In three-phase four-wire mode, the value is 0x043C73; in three-phase three-wire mode, the value is 0x16BC73. If it is other values, the program is wrong.
4.2 Chip calibration
Calibration is a key link in the design. The chip calibration process is shown in Figure 7. All calibrations are performed under the condition that the calibration register parameter is 0.
The calibration process of the chip is explained by taking the calibration of phase A voltage and current as an example.
(1) Calibration of phase A voltage
The voltage input is 238 V and the power factor is 1. When the calibration register Ugain is 0, the value of the phase A voltage effective value register Vu is read, which is 0x25d75c in hexadecimal and 2 479 964 in decimal. Substituting into the formula, the measured voltage effective value is calculated: Urms=Vu×210/223=Vu/213=2 479 964/8192=302.73. Ur is the actual input voltage effective value read by the standard meter, that is, 238 V. When calibrating the meter, Ur is calculated using twice the voltage value of the standard meter, that is, Ur=2×238=476. Ugain is the value of the calibration register of phase A voltage. When Ugain=Ur/Urms-1=476/302.73-1=0.572 358 207>0, then Ugain=INT(Ugain×223)=4 801 289=0x494309, and finally write 0x494309 into the calibration register of phase A voltage to complete the calibration of phase A voltage. After the calibration is completed, the value read by the processor must be reduced by 2 times to obtain the final measured voltage effective value: Urms=Vu/213/2=Vu/214.
(2) Calibration of phase A current
The current input is 4 A, the power factor is 1, and when the calibration register Igain is 0, read the value of phase A current effective value register Li. The hexadecimal value is 0x56d60, which is converted to decimal as 355 680. Substitute the formula to calculate the measured current effective value: Irms = Ii × 210 / 223 = Ii / 213 = 355 680 / 8 192 = 43.417 968 75. Ir is the actual input current effective value read by the standard meter, that is, 4 A. When calibrating the meter, Ir is calculated by substituting 24 times the current input value, that is, Ir = 4 × 24 = 64. Igain is the value of the correction register of phase A current. When Igain = Ir / Irms-1 = 64 / 43.417 968 75-1 = 0.474 044 084 57 > 0, then Igain = INT (Igain × 223) = 3 976 570 = 0x3cad7a. Finally, write 0x3cad7a into the correction register of phase A current to complete the correction of phase A current. After the calibration is completed, the value read by the processor must be reduced by 24 times to obtain the final measured value, that is, Irms = Ii/213/24 = Ii/217.
The calibration of other parameters must be completed according to the calibration formula of each parameter of ATT7022C, which will not be repeated here. After the calibration is completed, the autocoupler is used to adjust the voltage and current at both ends of the load, and the measured data are listed in Table 1 and Table 2.
Conclusion
The design of the entire module was finally completed through hardware circuit design based on ATT7022C and LPC2138, software programming, calibration and PCB board production. The measurement data error obtained through the experiment is small and within the allowable range of module measurement error. The module has the characteristics of fast data acquisition speed and low energy consumption, and can operate stably for a long time, achieving the expected goal of module design. The module can be used for accurate measurement of electrical parameters such as power systems, mine power grids, and oil pumping units.
Previous article:Measuring fixed bias current
Next article:Button battery charge and discharge test
Recommended ReadingLatest update time:2024-11-17 00:05
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- The DC-DC circuit of Lingte LT3780 is shown in the figure. Who can analyze the specific working principle?
- Clock source design of msp430
- Causes of burnout of temperature control chip (ADN8834)
- KiCAD JLCPCB Tools
- RISC-V MCU Development Practice (Part 3): Porting Hongmeng OS Project
- How to allocate time?
- 【1】First look at Silicon Labs development kit
- The Definitive Guide to Visual Studio Code
- LPC1788--TIMER match interrupt setting--register operation
- Please help explain this circuit, it should be a voltage regulator