TI Training home
Energy measurement design center for MSP430™ MCUs Energy measurement design center for MSP430™ MCUs: Design a single-phase shunt-based smart appliance
Energy measurement design center for MSP430™ MCUs
Energy measurement design center for MSP430™ MCUs: Design a single-phase shunt-based smart appliance
Hello, everyone. This video demonstrates how the Energy Measurement Design Center, or EMDC, can accelerate your embedded metering design and help you overcome common design challenges.
Today we are designing a single-phase shunt-based smart appliance using EMDC and the EVM430-I2040S based on the MSP430i2041 MCU. First, download and install EMDC on your computer. If you encounter an error during the installation process, please check the dependency section in the EMDC technology guide.
Open EMDC, where you will see a blank design canvas. Create a new project by clicking File, Project New in the Design Center menu bar. Name the new project and then click OK. Start by selecting the MSP430i2041 MCU and click OK. Next, place the MCU by clicking on the design canvas. Because this design is single-phase, we only need one voltage sensor and one current sensor.
Select the voltage sensor and place it on the design canvas. Next, select the shunt current sensor and place it on the design canvas.
Open the EVM430-I2040S user's guide and navigate to the schematic. Here, we see the voltage sensor at the top and the current sensor on the bottom. We will be using these parameters to configure the sensors in the GUI.
Double-click the voltage sensor and enter its parameters. For this design, the maximum RMS is voltage is 230 volts. Looking at the schematic, parameter R1 equals 990 k ohms. Parameter R2 equals 1.5 k ohms. Notice that the maximum output voltage is automatically calculated and converted from RMS to peak for easily comparing the maximum ADC input voltage. Click OK to continue.
Double-click the current sensor and enter its parameters. For this design, the maximum RMS current is 15 amps. According to the user's guide, the shunt resistance is 0.5 milliohms. Again, notice how the maximum output voltage is automatically calculated. Click OK to continue.
Now that we're finished with the sensor configuration, let's move on to the MCU. Double-click the MSP430 controller to configure the MCU. Under Configuration you can easily change between supported MCUs using the device dropdown menu. Below that, there are three main tabs-- Library Configuration, Calibration, and Results. We will cover each tab starting with Library Configuration.
On the Hardware Connections tab, connect the sensors to the MCU's ADC channels. The initial connections are made based on the order of sensor placement. Refer to the schematic in the EVM430-I2040S user's guide for the correct connections. For configurations with many sensors, you can make one of the two connections and then click Auto Assign to automatically complete the connections. The green OK button indicates all connections have been made.
Let's move on to configuring the basic parameters. The meter name can help you differentiate various projects. Here, let's call it Smart Appliance. Next, select the supported sampling frequency from the dropdown menu. There is only one OSR option per sampling frequency, because the MSP430i2041 modulation clock is not adjustable. This also applies to the SMCLA, because the MSP430i2041 DCO frequency is fixed at 16.384 megahertz. EMDC automatically populates options for these three parameters based on the features of the selected MCU.
Next, enter the expected AC Mains input frequency. This can be a value between 40 and 70 hertz. This is a single-phase design, so the number of voltage and current sensors are both 1.
Let's move on to configuring the phases. Here, each pair of ADC voltage and current channels are assigned a unique phase name. This phase name is used during calibration and communication. For polyphase configurations, selecting Total for each phase aggregates the results.
Next, let's move on to selecting the results. To choose all supported results, click Select All, or choose each result manually using the checkboxes. Then click Save before continuing. This automatically checks for any dependencies between the selected results. On the right, there is an estimated CPU load based on the APIs for the selected results.
Let's move on to the pulse's configuration. Since this smart appliance design does not measure active or reactive energy, this tab can be skipped.
Let's move on to configuring the ADC channels. Notice that the gain has been automatically selected based on the sensor output voltages. For the shunt current sensor, the output voltage is lower. So EMDC has selected the maximum gain allowed. However, a lower gain can be selected manually. The DC filters are enabled by default but can be disabled.
Let's move on to the last tab. Looking at the advanced parameters, the Per Phase and Total Startup Currents are not important for this design, because they define when energy starts accumulating. For the Impulses Per Kilowatt Hour parameter, keep the default value of 6,400. Again, this parameter is not important for this design, because it defines the number of energy pulses per kilowatt hour. The same applies to the pulse duration.
The IRA Minimum and Maximum Frequencies are the lower and upper limits for measuring the AC mains frequency. These limits can be adjusted according to the expected frequency range. The IIR Step Size parameter defines the number of steps or resolution between the minimum and maximum frequencies. The IIR filter is used to calculate reactive power, and each step size requires 4 bytes in flash memory.
This concludes the MCU configuration. Next, let's check for configuration errors and generate the code. In the Code Generation section, click Error Status to check for configuration errors. Errors such as missing sensor connections or no results selected will be shown as a red X instead of a green checkmark.
In the Status window, notice that each section matches one of the tabs under the Library Configuration tab for easy reference. After addressing any errors, click OK to continue.
Before generating the code, select where the CCS and IAR projects will be generated by clicking Browse or Keep the default location. Copy the file path to use later when importing the project into CCS or IAR.
Click Generate Code to automatically generate the source code projects and then click OK in the Confirmation window. Congratulations. We have finished our smart appliance design without writing a single line of code.
Now, let's import the generated project into CCS and program the EVM. Open CCS, right-click in the Project Explore window, and select Import CCS Projects. In the Select Search Directory box, paste the previously copied file path from EMDC and hit the Enter key. The EMDC generated project should be discovered. Click Finish to import the project into CCS.
For instructions on importing a project into IAR, please refer to the EMDC technology guide.
Now, let's program the EVM. Connect the MSP-FET debugger to your computer and the EVM. Inside CCS, select Download and Debug to build and program the MSP430i2041 on the EVM. For the first build, it may take a few minutes to rebuild the libraries.
Start the code by clicking the Run button. Stop debugging and then power cycle the EVM. Next, we will calibrate the EVM using the EMDC GUI and an accurate test source. Before calibration, make the communication connections described in the EMDC technology guide. In this diagram we are using the MSP430f5529 launchpad as the USB HiD bridge and the MSP isolation adapter for isolating the high voltage. Instructions for programming the launch pad as the HiD bridge can be found in the EMDC technology guide.
After making the isolated communication connections, ensure the jumpers on the EVM430-I2040S have been configured to use the onboard power supply.
Next, disconnect the MSP-FET from the EVM, because these connections are not isolated. With the test source powered off, make the high voltage connections as described in the EVM430-I2040S user's guide. Next, configure the high voltage test source to output 230 volts and 1 amp, with a 0 degrees phase angle. Turn on the test source to power up the EVM.
Open EMDC and navigate to the Calibration tab in the MSP430 Controller window. In the Target Communications section, click Connected to start communicating with the MCU. If communication is not successful, try closing and reopening EMDC and double check your connections.
Next, begin calibration. For step 1, select Phase A. For step 2, enter the test source parameters. Here we used 230 volts for VRMS, 1 amp for IRMS, and 0 degrees for phase angle. Next, select gain as the calibration type. Click Start to begin gain calibration.
After a few seconds, click Apply to automatically update the gain calibration factors. Click OK to continue. Notice the updated results.
Next, switch from gain calibration to phase calibration. Notice the phase angle in step 2 changes from 0 degrees to 60 degrees automatically. Before continuing, change the phase angle to 60 degrees on the test source manually.
After a few seconds, click Apply to automatically update the phase calibration factors. Click OK to continue. Notice the updated results. Click Stop to finish calibration.
To store the updated calibration factors in flash memory, click Yes to continue. Otherwise, click No. This concludes calibration.
Finally, click the Results tab to view the results selected during library configuration and also the calibration factors.
This concludes the demonstration of designing a single-phase shunt-based smart appliance using the Energy Measurement Design Center, or EMDC. To learn more about or download EMDC, please refer to the link shown. If you have any questions, please post them on our Texas Instruments e2e forum at e2e.ti.com. Thanks for watching.
2019년 12월 6일
This video demonstrates how to quickly configure and calibrate a single-phase shunt-based embedded metering design using the Energy Measurement Design Center (EMDC). You'll start by installing EMDC and creating a new project.