The AVR® DA family of microcontrollers (MCU) are peripheral rich, high performance and low-power 8-bit MCU devices. The built-in Zero-Cross Detector (ZCD), high-resolution Analog-to-Digital Converter (ADC) and timer peripherals are essential for realizing phase sequence detection applications.
The application demonstrator showcases the phase sequence detection and phase loss detection on emulated three phase AC supply using AVR128DA64 microcontroller.
Phase Sequence Detection of Three-Phase AC Supply demonstration and implementation is discussed in the AN3607 - Phase Sequence Detection of Three-Phase AC Supply.
The demonstration is implemented with both AVR128DA64 and AVR128DA48 microcontrollers and is available on Microchip MPLAB® Discover:
- AVR128DA48 Phase Sequence Detection application code example using MPLAB
- AVR128DA48 Phase Sequence Detection application code example using Atmel Studio
- AVR128DA64 Phase Sequence Detection application code example using Atmel studio
- MPLAB® X IDE v6.25 or newer
- MPLAB® XC8 compiler v3.00 or newer
- MPLAB® Code Configurator (MCC) v5.5.3 or newer
- Microchip AVR-Dx Series Device Support v2.7.321 or newer
- MPLAB® Data Visualizer v1.4.1926 or newer
- ADC MCC Melody Driver v5.0.0
- SPI MCC Melody Driver v5.1.0
- TCA MCC Melody Driver v7.1.0
- USART MCC Melody Driver v10.2.1
- VREF MCC Melody Driver v4.1.0
- ZCD MCC Melody Driver v4.0.4
- AVR128DA64
- Curiosity Nano Base for Click boardsTM
- 3x Waveform Clicks
- SMA male cable
- STK600 Board
- Socket card (STK600-TQFP64-2)
- Routing card (STK600-RC064AVR-108)
The following steps explain the procedure for setting up the hardware for three-phase sequence detection using AVR128DA64 microcontroller. The AVR device is connected to the STK600 using an innovative routing (STK600-RC064AVR-108) and socket (STK600-TQFP64-2) card sandwich system, which routes the I/O pins from the device to the appropriate hardware. Figure 1 below the listed instructions shows the hardware setup used for the application demo.
-
Insert AVR128DA64 MCU in the microcontroller slot of the socket card
Note: For proper orientation while inserting the microcontroller, refer to the marking on the AVR128DA64 MCU.
-
Insert three Waveform Click boards in the three mikroBUSTM slots available on Curiosity Nano Base board
-
Connect the SMA output of the Waveform Clicks to the respective microcontroller I/O pins using the SMA connectors. Refer Appendix section in AN3607 for more information about the specific microcontroller I/O pins to be used.
-
Detach the Waveform Click 2 OEN pin from the mikroBUS slot2 PWM2 pin
-
Detach the Waveform Click 3 CS pin from the mikroBUS slot3 CS3 pin
-
Connect the PWM2 pin of mikroBUS slot2 to pin PB5, and CS3 pin of mikroBUS slot3 to pin PB4
-
Connect the Curiosity Nano board to a host computer (PC) using the standard micro B USB cable
-
Using a female-female jumper wire, connect the PC7 pin (PORT C) of the STK600 board to the SW0 pin (Switches) of the STK600 board
-
Using a female-female jumper wire, connect the VTG and GND pins of the STK600 board to the VCC and GND pins of the Curiosity Nano adapter board, respectively
-
Connect the UART 1 pins PC0 and PC1 (Tx and Rx) from the STK600 board to PC through the USB-UART convertor
-
Connect the Micro USB-B cable to power the STK600 board
-
Press the SW0 button on the STK600 board to select the appropriate frequency (50 Hz/60 Hz) for the emulated three-phase AC signal
Figure 1. Demonstration Hardware Setup
The Data Visualizer tool is used as a graphical user interface to demonstrate the application by displaying the emulated three-phase supply waveforms, output status and for receiving the user inputs. The preconfigured data streamer and custom dashboard files are necessary for the Data Visualizer configuration, and can be found in the firmware package. The below steps given for the Data Visualizer configuration use these files to get the setup ready.
The Data Visualizer modules used in the demonstration are:
- Serial Port (Baud Rate – 230400)
- Graph
- Custom Dashboard (Custom Dashboard file is given for the demonstration)
- Element Label
- Element Signal
- Radio Group
- Data Streamer (Data Streamer file is given for the demonstration)
Refer to the Data Visualizer User Guide for more information.
The demo uses an emulated three-phase AC supply to showcase the essential features of the application. To emulate the AC power supply, three waveform clicks are used in the application.
The Data Visualizer custom dashboard is customized for this application. The user input and output elements are listed below:
- Recover three-phase supply from faults
- Insert phase loss fault on L1 phase
- Insert phase loss fault on L2 phase
- Insert phase loss fault on L3 phase
- Insert phase reversal (PR) fault
- Three-phase waveforms (using graphs)
- Phase reversal (using status indicator)
- Phase loss status (using status indicator)
- Operating frequency (using sequence output)
The figure below shows the Data Visualizer custom dashboard, with the input and output elements.
Figure 2. User Inputs and Output Status
- In this dashboard, there are two sections: one for obtaining the user input ('INPUT SIGNALS'), and one for observing the state of the signals ('OUTPUT STATUS').
- The starting frequency is 50 Hz. To change the frequency value to be between 50 and 60 Hz, press the on-board switch after power on.
- For a demo of the phase loss, click L1, L2 or L3 and observe the Phase Loss segment on the graph.
- For a demo of phase reveal, click PR and observe the Phase Reveal segment on the graph.
- After checking out any of the available demos, click RC under Recovery to set everything back to default state.
- Configure the serial port for communication with the Curiosity Nano board.
- Configure the Data Streamer for interfacing the Dashboard window with the serial port by clicking the IMPORT tab. The Data Streamer configuration (
data-streamer-config.txt
) file is available in the example firmware folder. - Configure the graph window for displaying the emulated three-phase supply AC waveforms, generated by the Waveform Clicks.
- Configure the custom dashboard window to display the output and to receive user inputs by clicking the Load option in the dashboard window. The custom dashboard (
custom-dashboard-config
) design file is available in the example firmware folder. - Connect the hardware and prepare the demo setup as per the instructions provided in the Setup section.
- Click the Serial Port Connect button.
- Using push button SW0 on the Curiosity Nano board, select the appropriate frequency for the three-phase signal. The selected frequency is displayed on the custom dashboard window.
- Zoom in or out on the graph from the custom dashboard by clicking the +/- magnifier symbol on the left side of the graph window.
- Insert phase loss fault by clicking the L1 radio button on the dashboard, which disables the L1 signal out of the three-phase signal to emulate phase loss input.
- Insert phase loss fault by clicking the L2 radio button on the dashboard, which disables the L2 signal out of the three-phase signal to emulate phase loss input.
- Insert phase loss fault by clicking the L3 radio button on the dashboard, which disables the L3 signal out of the three-phase signal to emulate phase loss input.
- Insert phase reversal by clicking the PR radio button on the dashboard, which changes the sequence of the three-phase signal.
- The status indicators have two states: Red - phase reversal, phase loss, and Green - no phase reversal, no phase loss.
Figure 3 shows the Data Visualizer dashboard illustrating the Phase Sequence Detection of the three-phase AC supply.