Design of AC voltage peak meter based on Modbus-RTU protocol

Publisher:安静的夜晚Latest update time:2013-06-29 Source: dzsc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  0 Introduction

  The peak value of AC voltage refers to the maximum value (positive peak value) or minimum value (negative peak value) of AC voltage, which is a very important parameter in the industrial production process. In order to ensure the safety of electrical equipment, it is of great significance to detect the peak value of the power supply voltage. The main methods for measuring the peak value are oscilloscope method, indirect calculation method, and special peak meter method. Although the oscilloscope can intuitively display the waveform and peak value of the voltage, the oscilloscope cannot be used as a field monitoring device in terms of cost and portability; the indirect calculation method is only applicable to standard sine waves and is not very practical; most special peak meters have the disadvantages of being large in size, inconvenient to carry, and inconvenient to connect to computers or control devices. In view of the above shortcomings, the MSP430 series microcontroller, MAX1270 analog/digital converter, and Modbus-RTU protocol are used to successfully develop a low-cost, portable, and intelligent peak meter device.

  1 Measurement principle

  Due to the fluctuation of the power supply grid and the fact that the voltage waveform of the grid is a non-standard sine wave, its peak value cannot be indirectly calculated by the average value or effective value. The system adopts multiple sampling of the non-standard sine wave in one cycle, and compares the sampling values ​​by the bubble method to obtain the maximum or minimum value of the voltage as its positive peak value and negative peak value. Obviously, as long as the sampling density is appropriate, the true voltage peak value can be obtained. The frequency of alternating current in my country is 50 Hz, and the sampling frequency is set to 10 kHz in the design, that is, 200 samples are sampled in each AC waveform cycle, which is enough to correctly reflect the voltage change and thus determine the voltage peak value.

  2 Hardware Design

  In the design, MSP430F449 single-chip microcomputer and MAX1270 analog/digital converter are the main components. The front-end A/D input uses a resistor voltage divider to reduce the voltage of the AC power; RS 485 chip is used as the communication interface chip. The hardware block diagram is shown in Figure 1.


  2.1 A/D input conditioning protection circuit design

  Taking 220 V AC as an example, its theoretical peak voltage is 311 V, but considering the fluctuation of the power grid, sine wave distortion, etc., the voltage peak is likely to exceed 311 V. At this time, a voltage value can be selected as the maximum value that the voltage may reach based on work experience and actual measurement conditions, assuming it is 500 V. If the input range of MAX1270 is set to ±5 V, the voltage divider ratio of the voltage divider resistor should be set to 100:1. The divided voltage is buffered by the op amp and used as the input of the A/D chip. In order to protect the subsequent A/D conversion chip, two voltage regulator diodes are set to form a limiting circuit. The input conditioning circuit is shown in Figure 2.


  2.2 A/D conversion circuit

  The A/D conversion circuit uses the MAX1270 chip, which is an 8-channel, multi-range bipolar input, serial output, successive approximation 12-bit A/D converter with a maximum sampling rate of 110 kS/s. Under a single +5 V power supply, it can be programmed to achieve ±5 V, ±10 V, 5 V, and 10 V ranges. Among them, the bipolar input is very suitable for AC voltage measurement.

  The MAX1270 conversion circuit is shown in Figure 2. The serial interface of the MAX1270 is controlled by the I/O port line of the MSP430F449. Since the MAX1270 outputs a high level of more than 4.5 V under a 5 V voltage supply, and the I/O port level of the MSP430F449 is 3.3 V, an interface chip must be added to achieve a 5-3.3 V level conversion. Here, the MAX3001 bidirectional level conversion chip is used. The A/D conversion circuit is shown in Figure 3.


  2.3 RS 485 interface circuit

  This design uses RS 485 bus, which can effectively transmit signals thousands of meters through cables or optical fibers. With Modbus-RTU protocol, it can be easily connected to control devices that comply with Modbus-RTU protocol. The design uses MAX3485 chip as RS 485 interface chip, and the circuit is shown in Figure 4.

[page]


  3 Software Design

  In the design, the main software modules include A/D conversion, Modbus-RTU protocol and serial port programming. Serial port programming is not described in detail, and the main focus is on MAX1270 and Modbus-RTU protocol.

  3.1 MAX1270 Programming

  The control word format of MAX1270 is shown in Table 1. The highest START is the start bit, which is kept as "1"; SEL2~SEL0 are input channel selection bits; RNG and BIP are range and polarity selection bits respectively; PD1 and PD0 are power-down and clock mode selection bits. Please refer to the MAX1270 data sheet for the specific meaning of each bit. In this design, MAX1270 is set to: range 10 V, bipolar input (i.e., ±5 V measurement), external clock 25 CLK/s normal operation mode, channel CH0 is used as the input channel, and the control word format is 10000101.





  3.2 Modbus-RTU protocol

  Modbus protocol is a universal language used in electronic controllers. Through this protocol, controllers can communicate with each other, controllers via networks (such as Ethernet) and other devices. Modbus-RTU is a transmission mode of Modbus protocol. In this mode, each 8-bit in the message contains 2 4-bit hexadecimal characters. The core program of Modbus protocol is the writing of CRC check program. The CRC-16 check method is used in this system, and the specific program implementation is as follows: [page]





  3.3 Other important subroutines

  The program uses a timer interrupt to trigger each sampling to ensure the accuracy of the acquisition cycle. At the same time, the zero point is used as the start of data acquisition each time. Both of these points are conducive to improving system accuracy.


  4 Test Results

  By applying standard sine wave, non-standard sine wave and triangle wave test, the peak measurement accuracy of the meter can be higher than level 1, which fully meets the needs of industrial field equipment power supply detection. The meter works well with the industrial control configuration software MCGS. In addition, in addition to measuring the peak value, the meter also expands the calculation of the voltage average value and effective value, and is designed as a multi-functional intelligent meter.

  5 Conclusion

  The design uses MSP430F449 microcontroller and MAX1270 as the core, and writes Modbus-RTU protocol. At the same time, the RS 485 interface can be used to easily transmit data remotely or connect to devices that comply with the Modbus_RTU protocol. The meter is small in size and low in power consumption. It can be powered by batteries or storage batteries. It is very suitable as a portable device that can be carried around. It can also be directly installed as a functional module in industrial field equipment to monitor parameters such as the peak value and effective value of the power supply voltage of the power grid.

References:

[1]. MSP430F449 datasheet http://www.dzsc.com/datasheet/MSP430F449_3.html.
[2]. MAX1270  datasheet http://www.dzsc.com/datasheet/MAX1270+_719122.html.
[3]. MSP430 datasheet http://www.dzsc.com/datasheet/MSP430_490166.html.
[4]. MAX3485 datasheet http://www.dzsc.com/datasheet/MAX3485_858685.html.

Reference address:Design of AC voltage peak meter based on Modbus-RTU protocol

Previous article:Low-power design and testing of handheld RFID readers
Next article:Key application issues and solutions for micro energy harvesting technology

Recommended ReadingLatest update time:2024-11-23 08:14

AC/DC power module design with multiple output DC voltages
1 Introduction With the continuous development of science and technology, the requirements for the detection of equipment status are getting higher and higher, which requires the test equipment to provide high-precision and accurate testing. To achieve high-precision and accurate testing, the voltage signal in
[Power Management]
AC/DC power module design with multiple output DC voltages
Latest Microcontroller Articles
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号