top of page

How to Implement Three-Phase Sequence Detection & RMS Voltage Measurement with Nuvoton MS51

Writer's picture: Prashanta ChowdharyPrashanta Chowdhary

Updated: May 14, 2024


Fig - 1

In three-phase Alternating Current (AC) systems, two common fault conditions are phase reversal and single phasing (phase loss). Phase reversal faults usually result from human errors during system installation or maintenance, while single phasing faults occur due to issues like broken wires, mechanical failures, worn contacts, blown fuses, and thermal overload. These faults pose significant risks to the system's operation, potentially causing severe damage and failures, as well as posing a danger to personnel. To address these concerns, a phase-sequence and phase-loss monitoring unit becomes essential for three-phase AC systems. This unit is responsible for detecting faults and promptly notifying the system to take necessary actions to protect the load.

This project details the implementation of a phase sequence and phase loss detection system for a three-phase AC supply. It demonstrates how to detect phase sequence and phase loss faults on emulated three-phase AC systems using the Nuvoton MS51 8 Bit microcontroller. The target board utilized in this project is based on the MS51FB9AE, and the firmware is developed with Keil IDE for 8051.


The project encompasses the following key contents:

Overview of the MS51FB9AE features specifically employed for the three-phase sequence detection applications.

An introduction to the three-phase sequence detection application itself.

An explanation of the three-phase AC supply emulator used in the project.

The firmware was developed to facilitate phase-sequence detection and phase-loss detection.

Nuvoton MS51 Family Overview      

NuMicro® MS51FB9AE is embedded with based on 1T 8051-based CMOS microcontroller, runs up to 24 MHz, features 16 K bytes flash, 1 K bytes SRAM, and 4 K bytes loader ROM for the ISP, also equipped with rich peripherals: 2 sets of UART; 1 set of I2C, and 1 set of SPI, 18 GPIO, 8 channels of 12-bit ADC, Watchdog Timer, Window Watchdog Timer and 6 X 16-bit PWM channel, package is available in TSSOP20.

Key Features:

Operating Characteristics

Voltage range: 2.4V to 5.5V

Temperature range: - 40 ℃ to + 105 ℃

EFT 4 kV

                 

Core

1T 8051-based CMOS microcontroller running up to 24 MHz

                                 

Memories

16 K bytes Flash

Configurable 4 K / 3 K / 2 K / 1 K Bytes of LDROM, which provides flexibility to user-developed Boot Code

1 K bytes SRAM

256 Bytes on-chip RAM

Flash Memory accumulated with pages of 128 Bytes each

Built-in In-Application-Programmable ( IAP )

                                 

Clocks

External clock input ( 32 K body only )

16 MHz high-speed internal oscillator trimmed to ± 1 % when VDD 5.0 V, ± 2 % in all conditions.

24 MHz high-speed internal oscillator trimmed to ± 1 % when VDD 5.0 V, ± 2 % in all conditions

10 kHz low-speed internal oscillator

On-the-fly clock source switch via software

                 

Power management

Brown-out detection ( BOD ) with low power mode available, 4-level selection, interrupt or reset options

Power-on reset ( POR )

                               

Peripherals

Two 16-bit Timers / Counters 0 and 1 compatible with standard 8051

One 16-bit Timer 2 with a three-channel input capture module and 9 input pins can be selected.

One 16-bit auto-reload Timer 3, which can be the baud rate clock source of UARTs.

One 16-bit PWM counter interrupt for the timer

6 x 16-bit pulse width modulator ( PWM ) output, with different modes and Fault Brake function for motor control.

One programmable Watchdog Timer ( WDT )

One dedicated Self Wake-up Timer ( WKT ).

2 full-duplex UART ports with frame error detection and automatic address recognition.

1 SPI port with master and slave modes, up to 12 Mbps when the system clock is 24 MHz.

1 I²C bus with master and slave modes, up to 400 kbps data rate.

8 channels of 12-bit ADC, up to 500 ksps converting rate.

18 general-purpose I / O pins and 1 input-only pin.

Programmable pull-ups and pull-lows.

                                 

Development Tools

Nuvoton Nu-Link with KEILTM and IAR development environment

Nuvoton Nu-Link In-Circuit-Programmer

Nuvoton In-System-Programming ( ISP )

                                 

96-bit Unique ID ( UID )

                                 

128-bit Unique Customer ID ( UCID )

                 

2-Byte ( 16-bit ) PDID

Basics of Phase Sequence Detection

This section gives a brief overview of the three-phase power supply system and its related faults.


Three-Phase Power Supply

The three-phase power supply system stands as the predominant approach for generating, transmitting, distributing, and consuming electric power across the globe. It consists of three alternating phases, typically labeled as L1, L2, and L3. Each phase generates AC voltages with the same amplitude and frequency concerning ground potential. Notably, these three phase voltages exhibit a phase shift of 120° from one another, as illustrated below in Fig - 2.


Fig - 2

Phase Sequence Detection and Phase Reversal

A three-phase power supply comprises three phases, usually labeled as L1, L2, and L3, each reaching their peak voltages periodically in a specific sequence. This sequence of events is known as the phase sequence. On the other hand, phase reversal occurs when two phases of the three-phase supply are mistakenly interchanged from their normal sequence. Such faults can arise during equipment installation, commissioning, or maintenance processes. Detecting phase reversal is essential, and it can be accomplished by monitoring the phase sequence of the three-phase power supply.


Maintaining the correct phase sequence is crucial for the proper functioning of the three-phase AC system. It ensures that the connected load operates as intended. If the phase sequence is incorrect, the three-phase loads may operate in the opposite direction or lead to unintended load operations, possibly causing damage to the system installation.

The phase sequence of a three-phase supply can be categorized into three possibilities:

Positive phase sequence

Negative or reversed phase sequence

Zero-phase sequence

To monitor the phase sequence, the phase shift among the three sinusoidal signals can be measured in units of time. This process allows for accurate detection and correction of phase reversal, ensuring the smooth and safe operation of the system.

Positive Phase Sequence

In the case of a positive phase sequence, the voltage on all three lines of the three-phase supply cycles through 360° where phase L2 lags phase L1 by 120° and phase L3 lags phase L1 by +240°. The sequence L1 – L2 – L3 is termed a positive phase sequence. Fig - 1 shows the positive phase sequence of a three-phase supply, where the phases L1, L2, and L3, attain their respective peak voltages periodically, one after the other in the sequence.


Negative Phase Sequence

In case of a negative/reversed phase sequence, the voltage on all three lines of the three-phase supply cycles through 360° while phase L3 lags phase L1 by 120° and phase L2 lags phase L1 by +240°. The sequence L1 – L3 – L2 is termed a negative or reversed phase sequence. Fig - 3 below shows the negative or reversed phase sequence of the three-phase supply, where phases L2 and L3 are interchanged from the normal sequence.


Fig - 3


Zero Phase Sequence

If the phases L1, L2, and L3 are parallel to each other, the sequence is referred to as a zero-phase sequence. Fig - 4 below shows the zero-phase sequence, where phases L1, L2, and L3 are parallel to each other.


Fig - 4

Phase Loss or Single Phasing Detection

Single phasing, i.e. phase loss, is a very common electrical fault experienced by three-phase systems and it occurs when any phase of the three-phase power supply is lost. The phase loss fault occurs due to a blown fuse, thermal overload, broken wire, wire contact, or mechanical failure. In case of failure to detect phase loss in the three-phase systems in time, the connected loads and infrastructure can be seriously damaged. The phase loss of the three-phase supply can be detected either by measuring the Root Mean Square (RMS) voltage of each phase or by monitoring the zero-crossings of the phases using the ZCD peripheral. If the RMS voltage of any phase of the three-phase supply is 0, it is deemed as phase loss. In the case of ZCD-based implementation, if the zero-crossing is not detected for any of the phases in a specific time duration, it means loss of the phase. Figure 4 shows the signal phasing on a three-phase supply. Phase L2 is lost, phase L3 lags L1 by 240°, and the three-phase signal is 120° out of phase.

Fig - 5

RMS Voltage Measurement

 

The RMS (Root Mean Square) of an AC power supply is the equivalent DC value that would produce the same average power dissipation in a resistive load. It represents the effective measurement of AC power as a DC value. Mathematically, RMS is defined as the square root of the mean square, which is the arithmetic mean of the squares of a set of numbers. For alternating signals, RMS can be expressed as the integral of the squares of the instantaneous values during a cycle. In practical applications, the RMS voltage of a three-phase input signal is determined by calculating the arithmetic mean of the squared values on each phase.


The equations used for calculating RMS voltage are:


Here, n is the number of samples and V1, V2, V3.….Vn are the voltage samples acquired from the input signal using ADC. Fig - 6 shows the signal, which is divided into 24 number of equal samples.

Fig - 6

Exploring the Hardware

CIRCUIT OF THE VOLTAGE SIGNAL CONDTIONER CIRCUIT

The voltage divider circuit serves to reduce the high voltage to approximately 1.8V RMS, equivalent to a peak voltage of 2.54V (Peak Voltage - 1.8 x √2 = 2.54V), which corresponds to a maximum input voltage of 300V RMS. To ensure compatibility with the microcontroller's unipolar ADC, we perform level shifting on the input sinusoidal signal by adding +2.2V to clamp the signal appropriately.

Fig - 7

After shifting the AC signal to the zero level by 2.2V, we can proceed with digitizing the samples to determine the RMS value and frequency. Additionally, analyzing the samples allows us to detect zero crossings, enabling us to measure the phase difference in terms of time (milliseconds).

To ensure accurate RMS value measurement, it is essential to calculate and nullify the offset voltage. We can achieve this by utilizing the same samples and calculating the offset value in real-time during runtime.

3 Digit 7 Segment Display

Due to the limited Io pins available in the controller, we opted for two serial to parallel converter, specifically the 74HCT595, to handle the 3-digit 7-segment display in a cascaded manner while operating in multiplexed mode. To achieve this, we utilized just three IO pins:

DATA

CLK

LATCH

Fig - 8



Fig - 9

Tactile Switches

We have incorporated two tactile switches for several purposes, including:

Parameter Setting

Calibration

Mode Selection

Fig - 10

RELAY INTERFACE

The circuit has been equipped with two relays, enabling the system to function as a three-phase sequence corrector with the utilization of two three-phase contactors.

Fig - 11

MICROCONTROLLER SECTION

Fig -12
  • Pin 1 is assigned to the selection jumper pin with a 10k Pullup resistor for future application.

  • Pin 2 is assigned to a Trim pot Resistance for variable time setting for delay start of the unit using ADC channel 3 for future need.

  • Pin 3 is assigned to R Phase Voltage measurement.

  • Pin 4 is a Power Reset Pin and is also used for code dumping and code debugging.

  • Pin 5 is used for the CLK signal for the Serial to Parallel Converter Interface (74595) for 3 Digit & Segment Display.

  • Pin 6 is connected to an LED via a current-limiting resistor, serving to display the Correct Phase Sequence with a constant glow and indicate an Incorrect Sequence through rapid blinking.

  • Pin 7 is the GND pin of the IC microcontroller.

  • Pin 8 is the ICP Data pin for Code Debugging and code dumping.

  • Pin 9 is the VCC supply.

  • Pin 10 & 14 are connected to RELAY1 & RELAY2.

  • Pin 11 is assigned to the selection jumper pin with a 10k Pullup resistor for future application.

  • Pin 12 & 13 are assigned to the tactile switches.

  • Pin 15 is used for the DATA signal for the Serial to Parallel Converter Interface (74595) for 3 Digit & Segment Display.

  • Pin 16 is used for the DATA signal for the Serial to Parallel Converter Interface (74595) for 3 Digit & Segment Display.

  • Pin 17 is free for miscellaneous use.

  • Pin 18 is the ICP CLOCK pin for Code Debugging and code dumping.

  • Pin 19 is assigned to B Phase Voltage measurement.

  • Pin 20 is assigned to Y Phase Voltage measurement.

In-Circuit Programming Interface for Code Debugging & Code Dumping


Fig - 13

Nu-Link supports ICP (In Circuit Programming) engineering based on SWD signal interface. Users can use Nuvoton NuMicro ICP Programming Tool development software to update chip firmware, and it is also suitable for chip firmware mass production. And support third-party development tools, such as Keil RVMDK, IAR EWARM and CooCox CoIDE. NU-Link In-Circuit Programmer cum Debugger Hardware

Fig - 14

  • USB ⇔ SWD bridge

  • Support ICP (In-Circuit Programming)

  • USB Plug & Play

  • Support Device: NuMicro Families MS51/ N76E003 /N76E616 /N76E885 Series

NuMicro ICP Programming Tool Install this application to dump the hex code into the controller.

Fig - 15



Fig -16

Power Supply Section

We have implemented a Linear power supply utilizing an LM7805T voltage regulator along with a bridge rectifier MB10S equipped with filter capacitors. To mitigate potential electrical noise originating from the transformer, we incorporated a 1 Ohm, 1 Watt resistance (R1).

Fig - 17

Main Hardware

Fig -18



TESTING

Developing a system for 3 Phase application is very critical because we must handle three-phase supply very closely with our instruments, computer, and obviously with our own life.


Working with 3 Phase can be extremely dangerous and could prove very fatal if we do not work under proper guidance and discipline. Theoretical knowledge and common sense are essential when we are going to develop any 3- Phase based embedded application.


During development, we will use a step-down transformer for all three phases to scale down the voltages to approximately 12V AC. For that, we must change the scale-down resistors.


Scale Down Resistor Calculation


For Direct Connection of 3 Phase (without Transformer)



Let us assume the applied phase to neutral voltage be 300V RMS (maximum)

Then, RMS Current (I) through R35, R37, R36 & R38 is.


Since, we have clamped the neutral point at 2.2V, therefore, the effective Vpeak = 2.11 + 2.2 = 4.21V which is well within the ADC reference voltage of 5V. That means that we can measure 300V RMS very accurately. Similar calculation can be used to calculate the value of R38 for a maximum of 12V RMS from the transformer output.


So, we know that RMS voltage should be around 1.4925V for accurate measurement. The same current of 0.995mA should flow through the resistors R35, R37, R36 & R38 with applied 12V RMS to produce 1.4925V across R38. Therefore, the summation value of the resistors R35, R37, R36


Therefore, we can set the value of R35, R37, and R36 to 3.5k which is available very easily.



Proteus Simulation Graphical Result with 12V AC
Proteus Simulation Graphical Result with 12V AC

If you notice the figure 39, we have applied +2.2V to the ref point of R4 to shift the DC level from 0 to 2.2V. For a unipolar ADC can easily capture the samples of the signal voltages for RMS calculation.


See the complete Simulation of Voltage Divider with DC Level Shifting on YouTube Video -  

Calibration


After calculating the RMS Voltage from the accumulated samples, we multiply the raw RMS values by a constant. In the present target application with the hardware constants i.e., the voltage divider resistors, we found that a multiplication factor of 3.3 would make the VRMS value very near to the actual VRMS value.


Once the measured VRMS value is within ±20%, we can use the given equation to precisely calculate the multiplication factor.

In the above piece of code, you will find that the constant is on the denominator and a multiplication factor of 100 in the numerator. The reason is to increase the precision of calibration and to avoid float-type and signed integer-type data which obviously consumes more memory and time.


For any calibration, we need a standard value with respect to which we need to calculate the new constant to make the measured value very close or equal to the standard value. The code is shown below

Calibration Constant Calculation

We will configure the applied voltage to 240V by utilizing a voltage VARIAC along with a highly precise Multimeter operating in Voltage measurement mode.

Furthermore, let's take into consideration that the recorded voltage in our desired unit registers at 234V, and the associated calibration constant is established at 300.

To exhibit a 240V reading in our intended unit, an adjustment to the calibration constant becomes necessary. Our initial step involves computing the correction factor relative to the existing constant.

Given Parameters:

Input Voltage (FEED_VOLTAGE) = 240V

Measured Voltage = 234V

Previous Calibration Constant (OLD CALIBRATION CONSTANT) = 300


With this  (which gets stored in the DATA FLASH), the measured voltage in our target unit becomes 240V.


To cross-check the linearity, we must measure the voltage at four points.

  • 150V

  • 200V

  • 250V

  • 300V

Calibration Process 

For calibration purposes, we make all Three Phase common and feed 240V AC between the phases and the REF point. The power is fed using an Isolation Transformer and a VARIAC (to adjust the applied voltage).


See the complete Calibration Process YouTube Video


Testing Equipment VARIAC AUTO-TRANSFORMER

DIGITAL MULTIMETER


ISOLATION TRANSFORMER




Practical Application

To summarize, this unit basically measures RMS voltages, & the Frequency of Three phases R, Y & B and from the samples of the R, Y & B voltages we detect the zero crossing to measure the phase differences between R-Y & R-B.

Three-phase sequence detectors are primarily used to determine the sequence of phases in a three-phase electrical system. The sequence of phases is important to ensure proper functioning and protection of electrical equipment. The main applications of three-phase sequence detectors include:

Motor Control: In three-phase induction motors, the correct phase sequence is essential for the proper rotation direction. Incorrect phase sequence could lead to motor damage and inefficient operation. Sequence detectors are used to ensure the correct phase sequence is maintained for safe and efficient motor control.

Generator and Alternator Protection: Generators and alternators need to maintain the correct phase sequence to avoid damaging the equipment. A reversed-phase sequence can lead to unbalanced loading and potential mechanical stresses. Sequence detectors help protect these devices from such issues.

Power Distribution Systems: In large power distribution systems, maintaining the correct phase sequence is crucial for balancing loads across different phases. Incorrect phase sequence can lead to uneven loading and potential disruptions in power distribution.

Industrial Machinery: Many industrial machines and equipment, such as conveyor systems and pumps, rely on three-phase power. Ensuring the correct phase sequence is essential for their proper operation and preventing damage.

Transformer Connections: Three-phase transformers need to be connected with the correct phase sequence to ensure proper voltage transformation and balanced loading. Sequence detectors help technicians verify the correct connections during installation and maintenance.

Automation and Control Systems: Some automation and control systems require knowledge of the phase sequence to synchronize various processes and equipment.

Safety and Maintenance: Detecting incorrect phase sequences is crucial for safety, as it can prevent potential hazards caused by equipment malfunction due to incorrect connections.

Overall, three-phase sequence detectors play a crucial role in ensuring the proper functioning, safety, and efficiency of various electrical systems and equipment that rely on three-phase power.


509 views0 comments

Cubix Kits & Projects

©2023 by Cubix Kits & Projects. Proudly created with Wix.com

bottom of page