Design of cycle drop simulator based on 8051 microcontroller

Publisher:心有归属Latest update time:2024-03-12 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

Electromagnetic compatibility (EMC) requires that electronic and electrical devices must have the ability to work normally in a certain electromagnetic environment. Testing and researching anti-electromagnetic interference are inseparable from electromagnetic interference simulators that comply with national standards. In the past, these equipments were imported and expensive. This cycle drop simulator was developed for this purpose. The instrument has precise measurement and can simulate grid voltage interruption or increase/decrease. It has the characteristics of intuitive display, stable output, easy use, and low cost.


working principle

When the power grid or substation equipment fails or the load changes suddenly, it will cause instantaneous voltage drops and short interruptions. In some cases, two or more voltage drops and interruptions will occur in succession. These phenomena are random in nature and are characterized by deviations from the rated voltage that persist over a period of time. However, instantaneous voltage drops and short interruptions are not always sudden, because the rotating motors and protective elements connected to the power supply network have a certain reaction. If a large power supply network is disconnected, the voltage will be due to many rotating motors connected to the power supply network. , but only gradually decreases. In the short term, these rotating electrical machines will operate as generators and deliver power to the grid. To protect data stored in internal memory, large digital processing equipment is equipped with built-in power outage detectors so that when power is restored, the equipment starts up in the correct manner. However, some power outage detectors cannot respond quickly, causing the DC voltage to decrease below the minimum operating voltage before the power outage detector is triggered, causing data to be lost or changed. When the mains voltage is restored, the data processing equipment does not start correctly. The cycle drop simulator discussed in this article consists of four parts: microcontroller and storage display part, voltage sampling and zero-crossing signal detection part, power drive part and related DC operating power supply. The overall structure is shown in Figure 1.

Design of cycle drop simulator based on 8051 microcontroller

Microcontroller system

The 8051 microcontroller is used to coordinate and control the normal operation of each part of the circuit, and the keyboard and color LCD display are used to input and display the set values. The setting values ​​mainly include drop voltage, drop phase, drop time, drop interval and number of drops, etc., and are available in both Chinese and English versions. There are three options for setting values: manual mode, program mode, and standard mode. In order to make full use of the resources of the microcontroller, P1.0 and P1.1 are used to switch the rated voltage and drop voltage; P1.3 detects the voltage zero-crossing signal; P1.4 and P1.5 control the forward and reverse rotation of the motor; P1.6 is used to For changing the screen; P1.7 is connected to the watchdog circuit; P3.3 controls the A/D interrupt; P3.5 selects the strobe switch. In order to process a large amount of data information, error correction solutions and software fault tolerance, a certain amount of RAM is required. Therefore, this instrument uses an expanded 8K external RAM. This cycle drop simulator can not only work alone, but also has an RS-232 communication port to communicate with the host computer. In order to improve the reliability and safety of the equipment and meet the requirements of national standards, this design adopts protection measures in both software and hardware, especially some anti-interference measures. First of all, in terms of protecting the CPU, photoelectric isolators and relays are used to drive the motor to rotate, while transformers and photoelectric isolators are used to sample voltage signals and zero-crossing signals. In this way, the strong current and weak current parts are completely separated. Even if the peripheral circuit is damaged, the CPU will not be damaged. Secondly, in terms of working power supply, the fluctuation of DC voltage is reduced by connecting the inductor coil in series, thus ensuring the stability of the working voltage. Finally, in terms of anti-high-frequency interference, several metal plates are used to separate relevant circuits, so that the entire instrument can reduce high-frequency interference.

In addition, the advantages of the software are also used to purify the signal using various filtering methods, as well as fault-tolerant technologies, such as setting watchdogs.

Voltage sampling and zero-crossing signal detection circuit

Voltage sampling and zero-crossing signal detection circuits are key circuits to improve drop voltage and drop phase accuracy. Voltage sampling mainly includes rated voltage sampling and drop voltage sampling. Here we focus on drop voltage sampling. The specific circuit is shown in Figure 2.

In Figure 2, the 0~255V drop voltage is stepped down by a 6V transformer and becomes a lower AC signal. Since the sampling accuracy of the drop voltage directly affects the test accuracy of the entire instrument, the method of using only one diode for rectification in the past is simple, but the linearity is not good and the error is very large. In the end, compensation can only be added in the software to eliminate the error. , This greatly increases the workload of the software, and the repeatability is not good. Therefore, in order to reduce the error caused by the nonlinearity of the diode in the rectification, this design uses a typical operational amplifier tracking rectifier circuit, which is composed of the operational amplifier mA741 and the diode RF107. Thus the above disadvantages are avoided. Only hardware circuits can meet the accuracy requirements without software compensation.

In Figure 2, electrolytic capacitor C1 and capacitor C2 form a filter circuit. During the debugging process, it was discovered that the selection of the capacitance value of the electrolytic capacitor C1 is very critical, as it directly affects the accuracy of the calibration. Since the drop voltage enters the ADC after sampling and strobe switching, the circuit requires linear scaling of AC 255V corresponding to DC 5V. In this circuit, C1 is 47mF. Resistor R2 is an adjustable precision resistor, and the output sampling signal is very sensitive to its changes during the calibration process. Therefore, in the entire circuit shown in Figure 2, the accuracy of the sampling signal mainly depends on the values ​​of capacitor C1 and resistor R2. The latter operational amplifier mA741 plays an isolation role, mainly to prevent subsequent circuits from affecting the sampling circuit. The entire sampling circuit is not only low in cost, but also has good performance. It has been tested in practice and fully meets the design requirements for drop voltage.

The drop phase is another important parameter of the cycle drop simulator, and the zero-crossing detection circuit is the key circuit to ensure the accuracy of the drop phase. The previous method used was to use the forward conduction and reverse blocking characteristics of the diode to directly detect the zero-crossing signal of AC 220V. This method has a relatively large error because the conduction of the diode is not completely at the zero position of the voltage. Large, certain compensation must be added in the software. In order to overcome these shortcomings, this design uses a zero-voltage comparison method. This method can not only improve the accuracy of the AC zero-crossing signal, but also avoid a series of problems caused by series resistors in the AC 220V line. The specific circuit is shown in Figure 3.

In Figure 3, the AC 220V is reduced to 12V through the transformer, and then enters the voltage comparator LM311 through a clamp circuit composed of two diodes. The output signal is a square wave, and then sent to the P1.3 port of the CPU through photoelectric coupling. Among them, the adjustable precision resistor R2 plays the role of zero-crossing fine-tuning. After practice, this circuit has been proven to fully meet the design requirements of the drop phase.

software

The software of this instrument is divided into two categories: one is execution software, whose main functions are: detecting drop voltage, calculating drop time, drop interval, number of drops, and judging whether the setting value is out of range, etc. The other type is the host computer communication software, whose function is to control the operation of the instrument through the RS-232 interface and is written in VB. Since the hardware can already meet the requirements, software compensation is not added to the sampling of the drop voltage and the detection of the zero-crossing signal, which greatly reduces the software workload. During testing, if the allowed range is exceeded, an error message will be displayed. The main program is divided into four parts: power on and initialize the instrument; execute the function subroutine according to the set value; turn on the driver module and output the required drop voltage and waveform; and communicate with the host computer network. The program flow chart is shown in Figure 4.

Conclusion

The cycle drop simulator developed according to user requirements has now been mass-produced by the Sino-Japanese joint venture Shanghai Sanji Electronics Industry Co., Ltd. The successful development of this testing instrument with independent intellectual property rights has laid a good foundation for the future development of other types of high-precision instruments.


Reference address:Design of cycle drop simulator based on 8051 microcontroller

Previous article:A brief discussion on online upgrade of 8051 programming
Next article:Design of infrared temperature measurement system with C8051F340 microcontroller as the core

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号