Measuring Power Consumption with PAC1934 Step Step 6: Test Application

Last modified by Microchip on 2023/11/09 08:59

Set Up Tera Term

Open and configure Tera Term for a 9600 Baud rate. This is used to display meter information to Tera Term via the MCU UART.

TeraTermSetup.png


Exercise the Application

Press SW1 to change the display to a different channel. Press SW2 to display all meter parameters.

Turn on the 5-voltage source to the PAC1934 Click board. When R1, R2, R3, and R4 are 150 Ω, the voltage and current ideally should show 5 V and 33.333 mA. Your actual measurements will vary depending on the source impedance of the power supply and component tolerance.

Note: The PAC1934 can handle up to 32 V Vbus voltage range and +/- 100 mV differential voltage range.

TeraTermDisplay.jpg


Results

You observed the application display the voltage, current, power, and energy for four PAC1934 metering IC channels, updated every 200 ms. This information is displayed on Tera Term via the MCP2221 Breakout Module.

Analysis

You have successfully created a PAC1934 metering application using MPLAB Code Configurator and the PAC1934 MCC Library. Your application used all the fundamental elements that go into building a real-time meter application to display critical measurements for multiple power channels. This application continuously reads voltage, current, power, and energy and displays them on OLED W Click and Tera Term utility. Pressing switch S1 selects the next power channel and switch S2 displays all channel information together. You configured SPI1 to display information to the OLED W Click board and to read display status information. You configured I2C2 to read metering data from the PAC1934 Click board and to read status information. You set up UART1 to interface with the MCP2221A USB to UART module to display metering data via Tera Term utility. Finally, you configured GPIO to display sampling activity on LED1, overflow status to LED2, read S1 for channel selection and S2 to send debug information to the PC via Tera Term.

Conclusions

This tutorial provided you with training for configuring a PAC1934 IC to continuously monitor key meter parameters using MPLAB X IDE and MCC. As a next step, you may customize this application to reconfigure the resistor values and display different measurements. The PAC1934 IC is capable of handling up to 32 V Vbus voltage and +/- 100 mV differential voltage range. You can also investigate the APIs available in the TestApp.c file to add functionality from the PAC1934 library to your own application. Ultimately, if you were to use another 16-bit or 8-bit MCU supported by MCC, you can explore a similar solution. Note that the pin configuration would change since the MCU resources will be different.