Electronics are often designed to work anywhere in the world with local power. An AC source can create the various voltage-frequency combinations used in different countries and even measure the current and power consumption.
Figure 1. A power supply that accepts 100 Vac to 240 Vac.
You can automate the process using Visual Basic for Excel to program an AC6801B AC source. Excel lets you capture and share results in a neatly organized table. In this example, we chose eleven countries to demonstrate the wide variety of voltages and frequencies used around the world. Some countries use multiple voltages and plug types, and those displayed are selected to illustrate a broad range. The table is easily modifiable, and you can add more countries by increasing the rows as well as the country count in cell D6.
Figure 2. An example table of various voltages and frequencies. Row number and column letter shown in red.
The Visual Basic program reads the voltages and frequencies from the table and sets up the AC source to output them. The program pauses for the number of seconds provided in column F, allowing the test device to settle. The AC source then makes several measurements and adds them to each row of the table.
Figure 3. The AC source output is set to 100 Vac at 50 Hz. Three measurements are added to the table after the delay. The process is repeated for each country.
Getting started with Visual Basic for Excel
If you are not currently using Visual Basic for Excel, you need to display the developer tab. It is included in Excel but is not shown by default. You can find instructions online for adding the tab to the version of Excel you use. The second step is adding Keysight IO Libraries Suite. In this example, all the commands are sent to the AC source using the Keysight IO library. With the software installed, open the developer tab and create the global variables.
Figure 4. Opening the VBA project and creating the global variables.
Opening a connection to the AC6801B
The following subroutine creates a connection to communicate with an instrument based on its VISA address. The VISA address is read from the table, making it easy to update. You can use the Keysight Connection Expert, which is installed with the IO Suite to read the instrument address. Watch this YouTube video to see the steps to locate the instrument VISA address and verify the connection.
Figure 5. Subroutine to open a connection to the instrument.
You can insert a button onto the spreadsheet (Developer > Insert > Form Control > Button). You are then prompted to add the name of the subroutine that will run when the button is clicked.
Figure 6. The spreadsheet with the first two controls and the LXI address.
Resetting and configuring the instrument
The subroutine initConfig_Click() has three primary roles: to clear the AC source, to configure DUT protection, and to select the upper range and turn on the AC source with a known voltage. Once the instrument is reset, it is set to output only AC voltage, and the voltage is limited by a min and max value. Obviously, overvoltage can cause damage to a device, but too low a voltage is just as harmful. In the case of a power supply, too low a voltage leads to higher current to meet the power needs of the load. In addition, a current limit is set to protect the DUT from damage due to excessive current. The time required to run the test is reduced by using a single range. The AC6801B is a dual range source and provides additional current in its low range. For our device, the upper range has enough current to test the device. Lastly, a voltage-frequency combination is selected, and the output is turned on. The primary goal of this program is to demonstrate some of the AC source’s capability. With the output turned on, the AC source displays measurements on the front panel.
Step through the list of countries
The createSequence_Click() subroutine populates the table with the power measurements for each country. It uses the number specified in cell D6 to determine the number of loops necessary to complete the table. In each loop, the voltage-frequency is pulled from the table, and the source is set to output the combination. The power measurements are made after the delay in column F, which allows the device to adjust to the new voltage and frequency. Three power measurements were selected from a choice of 17 different measurements. As each measurement is made, the results are added to the table.
Closing the instrument connection
Closing the instrument connection releases the resources. Once the connection closes, an error is generated if you attempt to send commands to the instrument.
Reading instrument errors
The read error subroutine is useful while creating or modifying a program. It pulls the error strings from an instrument one string at a time. You may need to run it multiple times to clear all the errors. It is designed to run independently of the rest of the program. It assigns resources, opens the IO, and then closes the IO.
The universal adapter test program is designed to demonstrate some of the AC6800 Series capabilities and a method to document the measurements using Excel with Visual Basic. Adding a main program to call each of the subroutines simplifies the program because it’s not necessary to connect each routine to a separate control button. The program ran many times over a two-week period using the AC6801B, and the results are repeatable. Often the results are identical when formatted to show a single decimal place. The program is easily modifiable to make additional measurements. A couple of real-world applications are to characterize a group of power supplies and statically determine the max power usage or verify results from a remote facility. Using a second AC source, it is easy to reproduce results with a production facility located on the other side of the globe.