From IC to Instrument
Brian discovered an Analog Devices chip that enables you to perform impedance spectroscopy—in other words, it can measure impedance over a range of frequencies. In this article, he explores the technology, circuit design and software that serve these efforts.
I’ve built and serviced many instruments for university chemistry teaching labs. Some of them involve electrochemistry. As a result, I’ve designed many voltammographs and conductivity meters over the years. I recently came across a chip made by Analog Devices that performs nearly all the functions needed to do impedance spectroscopy.
Impedance spectroscopy is the measurement of a device’s impedance—or resistance—over a range of frequencies. For electronics enthusiasts, common uses would be measuring the impedance of transducers such as speakers and microphones. However, it can also be used to measure electrochemical processes, in which case it is called Electrochemical Impedance Spectroscopy (EIS). In the biomedical field, its uses include detection and identification of specific forms of viruses in blood samples.
EIS is also useful for monitoring corrosion in metals, such as aluminum and steel. In situations where it’s difficult to use the common visual inspection method, EIS can be used instead. Such measurements can be particularly viable if the EIS instrument is made at a low cost and miniaturized. I am guessing that this last use case was what Analog Devices engineers had in mind when they designed the AD5933 Impedance Converter chip.
The Analog Devices AD5933 contains almost everything you need to do impedance spectroscopy for certain applications. However, for other applications, its excitation output amplifier has some shortcomings, as does the transimpedance amplifier used for the current-measuring input. Later, I’ll discuss the additional circuitry that can be added to the AD5933 to minimize these shortcomings.
The basic AD5933 functional block diagram is shown in Figure 1. The AD5933 generates the required excitation sine wave using a Direct Digital Synthesis (DDS) block. Analog Devices makes DDS devices that can produce sine wave signals up into the hundreds of megahertz range. The 100,000 Hz upper frequency limit of the AD5933’s DDS would have been a cinch for them to design.
For impedance spectroscopy, you generally don’t need an extremely accurate excitation waveform frequency. Therefore, the AD5933 contains an internal 16.776 MHz oscillator to clock the DDS block. This internal oscillator is quite accurate. The datasheet shows that when quantities of the chips were tested at 25°C, the least-accurate samples were all greater than 16.6 MHz and less than 16.95 MHz. The oscillator’s temperature coefficient is 30 ppm/°C. If better frequency accuracy is needed, there is an internal MUX switch, which allows an external, crystal-derived clock signal to be selected under program control. The maximum clock speed in this case is also 16.776 MHz.
The DDS block’s phase accumulator is 27 bits wide, but the Start Frequency register is only 24 bits wide to facilitate loading it as three 8-bit bytes. Even with this 24-bit limitation, the DDS can generate frequencies up to 100,000 Hz with a resolution of 0.1 Hz.
The equation for the Start Frequency is:
Example: using the 16.776 MHz internal clock, to generate a Start Frequency of 10 kHz would require the following Start Frequency code:
The 24-bit word corresponding to the Frequency Increment value is similarly derived using Equation (1), but substituting the Incremental Frequency for the Starting Frequency. The maximum number of frequency increments per sweep is a 9-bit number loaded into Register address 0x88 and 0x89 and is a maximum of 511 points.
The digital output of the DDS block is fed into a DAC. The analog output from the DAC is fed into a programmable-gain output amplifier, with the voltage ranges shown in Table 1. Figure 2a shows the DAC’s output at a frequency of 12.8 kHz. In Figure 2b, you can see that the DDS is producing a much less accurate sine wave at 119 kHz. At 119 kHz, there will only be about 35 samples per cycle, given that the DDS is being clocked at 4.194 MHz.
For chemical and biological purposes, impedance spectroscopy is performed using voltages less than 2 Vpp, so the AD5933’s output voltage ranges are well-suited to the task. However, as I’ll discuss later, the AD5933’s input transimpedance amplifier (TIA) is referenced to VDD/2, which is generally 3.3 V /2 or 3.0 V /2. What this means is that you cannot use all four output voltage ranges directly, since the sine wave signal being generated is referenced to one of the four different bias values shown in Table 1. You could use Range 1 (bias of 1.48 V) when VDD = 3.0 V (making VDD/2= 1.50 V), but all other ranges wouldn’t work properly, because the TIA is referenced to VDD/2. I’ll discuss the external circuitry needed to handle this later.
The current passing through the device under test (DUT) is fed directly into the negative input of the AD5933’s input amplifier (Vin pin). A feedback resistor from the amplifier’s output must be connected to the Vin pin. This amplifier’s positive input is connected to VDD/2, so the incoming sine wave signal must be referenced to this VDD/2 voltage. In this configuration, the input op amp acts as a current-to-voltage converter or TIA. Following this is a programmable gain amplifier, with x1 and x5 amplification options. The amplified sine wave signal is then fed into a low-pass filter to remove any high-frequency noise beyond the Nyquist frequency dictated by the ADC’s 1 MHz sample rate.
The amplified, filtered signal is then fed to a 12-bit ADC. The ADC has a full-scale range equal to AVDD. The ADC’s digital output is fed into a Discrete Fourier Transform function (DFT) performed by an on-chip DSP. This is a 1,024-point DFT—that is, 1,024 samples of the current waveform are processed for each frequency sample. Both the Real and Imaginary portions of the current are available as 16-bit two’s-complement numbers. A window function is performed on the data before they undergo the DFT operation. No details of this window function are given in the datasheet, but in general—with signals whose period is not equal to the sample time for the 1,024 samples—a window function will improve the accuracy of the DFT result.
The built-in oscillator has a known temperature dependence of 30 ppm/°C. For higher accuracy, this could be compensated for if you knew the temperature of the AD5933. To address this, Analog Devices includes an on-die temperature sensor with a ±2°C accuracy. All communications with the AD5933 are via a standard I2C port. Its I2C address is 0x0D. The AD5933 is powered by a single power supply that can range from 2.7 to 5.5 V. Its operating current is typically 10 mA at 3.3 V up to 17 mA at 5.5 V.
IMPROVING THE I/O CIRCUITS
As discussed in the previous section, the AD5933 can implement the measurement part of a complete impedance spectrometer all on its own. However, for most use cases, it can be enhanced considerably with some additional analog circuitry. This topic is covered in Analog Devices CN-0217 Circuit Note. Briefly, there are two main limitations to the AD5933 when used on its own:
1. Since the device uses only a positive power source, its AC excitation waveform must be biased at some point between AVDD and ground. The TIA amplifier is internally referenced to AVDD/2, so it would make sense for the excitation waveform to be biased there as well. From Table 1, this criterion is met for Output Range 1, but all three other ranges are biased differently. Because you generally need to use all four ranges, external circuitry is needed to correct this.
2. Both the excitation amplifier and the TIA must be able to handle enough current to measure the device under test at its minimum expected impedance. For example, using the 0.97 Vpp excitation voltage, a DUT with a minimum impedance of 100 Ω would require an excitation current of 9.7 mA. Not only would the excitation amplifier be required to supply this, but its effective output impedance would have to be much lower in value than 100 Ω, or it would adversely affect the accuracy of the impedance reading. The AD5933’s output amplifier has, at best, a 200 Ω output impedance on Range 1, with significantly higher values on the other ranges. Also, it can only supply ± 5.8 mA on Range 1—and much less on the other ranges.
Because it would be difficult for me to solder the AD5933’s 16-pin SSOP packages to a PCB by hand, I had to find some form of evaluation/breakout board that contained an AD5933 and preferably the external analog circuitry needed to offset the above limitations.
Two such boards are available. Analog Devices sells the EVAL-AD5933EBZ and Digilent sells a PmodIA impedance analyzer board. Both boards contain the additional analog circuitry—recommended by Analog Devices—to address the two limitations listed above. I’ll discuss this analog circuitry later, but first I’ll outline the other features and disadvantages of each board. Incidentally, both boards are not a whole lot more expensive than the price of the AD5933 chip alone, which was a pleasant surprise.
The EVAL-AD5933 board contains a Cypress Semiconductor CY7C68013 MCU, which was specifically designed to interface a USB bus to a high-speed parallel port and an I2C port. This chip is somewhat unique in that it runs firmware downloaded from the host PC via the USB port, after which time the MCU is reset and the firmware is executed. It’s somewhat like an FPGA in that regard, except the CY7C68013 gets its firmware from USB rather than the SPI EEPROM chip that FPGAs typically use for program storage.
The CY7C68013’s I2C port interfaces to the AD5933 directly. Analog Devices provides a Windows driver for the CY7C68013 MCU. They also provide a DLL to allow your PC application to download the CY7C68013 firmware, along with a hex file containing that firmware. The Analog Devices PC application software is written in Visual Basic 6 (VB6), which is outdated and has long been superseded by VB.NET. This would be a problem for most people, but I have used VB6 for a decade or so and am familiar with it. However, their sample program uses some custom third-party components that AD doesn’t supply. I had no luck finding the source of these components. The example program that Analog Devices provides would not compile without these components being in place and licensed.
The CY7C68013 is used in many devices—notably Saleae’s Logic Pro 16 logic analyzer and its many clones. If you already have experience interfacing the CY7C68013 to your PC applications, then the EVAL-AD5933 might be a good choice for you.
The external TIA circuit on the EVAL-AD5933 includes only a single current-to-voltage conversion range. I feel that this is too limiting. It may be possible to remove the feedback resistor on the board, and circuitry added to support two (or more) TIA conversion ranges. I didn’t have this board to try this however. This board contains a 16 MHz crystal module to provide the AD5833’s clock signal, and has jumpers to allow another clock source to be used. The board is relatively large, and although it uses SMD components, it appears that some components could be swapped for alternate values—if desired.
I chose to use Digilent’s PmodIA Impedance Analyzer module. It does not contain an MCU controller, which was an advantage for me. For that functionally, I prefer to use a Teensy LC development module from PJRC, which contains both a USB and I2C ports—and enough GPIO to perform some other functions. The PmodIA is less expensive than the EVAL-AD5933, even adding in the cost of the Teensy MCU module.
The external TIA circuit on this module has two ranges. The two feedback resistors are switched by an ADG849 SPDT MUX switch with an extremely low on-resistance of 0.5 Ω. To handle a wide range of impedances, this two-range TIA is a necessity so I’m glad Digilent added it. The module contains two SMA sockets, which makes it easy to add two coaxial cables to connect to the DUT. At 1.6″ × 0.8″, the module is very small—I wanted to change one of the TIA range resistors, and it happened to be a large enough SMD package for me to unsolder easily. That said, nearly all the other resistors and capacitors are so tiny that it would be difficult or impossible to swap them out by hand for a different value. Figure 3 shows the PmodIA module.
EXTERNAL ANALOG CIRCUITRY
Refer to Figure 4 for the project’s schematic. Apart from the Teensy LC module, a 24LC256 EEPROM and a few LEDs, all the other circuitry is contained on the Digilent PmodIA module. The AD5933’s excitation sine-wave output is capacitor-coupled (C7) to an AD8606 unity-gain output buffer. The AD8606’s input is biased at AVdd (regulated 3.0 V from U3) divided by two. The capacitor coupling removes the AD5933’s output bias, which varies with the chosen output voltage range. The AD8606 has a 10 MHz bandwidth and a very low output impedance of 1 Ω up to 1 MHz.
Rather than using the AD5933’s input amplifier in a TIA configuration, an external TIA is used (the second section of the AD8606). It is similarly biased at AVdd/2 by R6, R7. The current-to-voltage conversion factor is determined by feedback resistors R4 (100 kΩ) or R5 (220 Ω)—depending upon the value of the logic signal presented to the ADG849’s IN pin (which is connected to the Teensy D1 GPIO pin). I changed the PmodIA factory value of R5 from 20 Ω to 220 Ω, because that provided a better resolution for the impedance ranges I wanted.
The external TIA output signal is connected to the AD5933’s input amplifier, which is now configured as an inverting voltage amplifier with a gain of 1. All the external analog circuitry, together with the analog circuitry within the AD5933 is powered by a low-noise, 3.0-V regulator (ADP150-3.0). Note that the part designations that I used for Figure 4 are not the same as those found in Digilent’s PmodIA schematic. Also, note that the Teensy USB port is not shown on the diagram. The micro USB socket is mounted directly on the Teensy LC module. It does not appear on the Eagle library part that I used for the Teensy LC. The Calibration arrays are stored in U5, an I2C EEPROM chip.
TEENSY LC CONTROLLER
In the case of the EVAL-AD5933 board, the CY7C68013 MCU was basically just a dumb USB to I2C bridge. All control and measurement functions were handled by the host PC. I decided to use a Teensy LC module and have its firmware do all the control/measurement functions. In this case, the PC only performs the user interface/graphical display and data file storage functions.
At $11, the Teensy LC is the lowest-cost Teensy module. It features an Arm Cortex-M0 MCU and a USB port. It runs at 48 MHz and contains 62 KB of flash storage. Its 8 KB of RAM is enough for this application, since the array of calibration values are stored in an external I2C EEPROM (24LC256). The Teensy LC module is shown in Figure 5.
The “raw” impedance values provided by the AD5933 at each frequency point must be multiplied by a calibration factor. This calibration factor varies with frequency, and is also affected by the excitation output voltage range, the TIA conversion factor and the AD5933’s internal PGA gain setting. My instrument has six discrete ranges, from 100 Ω to 1 MΩ. For each frequency sweep range, I decided that 200 data points were sufficient. Therefore, I needed six ranges × 200 calibration values. These are single-precision floating point values, each occupying 4 bytes in memory, for a total of 4,800 bytes of EEPROM storage. Currently, my software calculates impedance but not phase. A phase calibration array would take up another 4,800 bytes of EEPROM space—still well within the 32 KB of EEPROM storage.
The Teensy LC’s USB port is enumerated by the PC host as a USB serial device, so no special Windows drivers are necessary. The Teensy LC also controls two LEDs. A bi-color LED glows RED when the instrument is idle and turns to GREEN during both the standard frequency sweep and a calibration run.
The firmware running on the LC is basically a command interpreter, accepting commands/parameters through the USB-emulated Serial port. All commands consist of a single ASCII character followed by a single parameter expressed in string format. A few commands need no parameter. The command character and the parameter (if required) are echoed back to the host. This simple protocol makes it easy to test out the instrument by running a Serial Monitor on the PC, and simply typing in the commands/parameters. In the case of both the frequency sweep and calibration commands, the respective data arrays are sent back using an ASCII string format, with one line per frequency sample. Here again, it’s easy to quickly determine if the data being returned “look right” during early debugging.
Table 2 shows the complete command protocol. The P, R, K and Z commands enable you to set parameters individually. However, specifying the calibration range using the B command will set up all the P, R, K and Z parameters for that range simultaneously. The Teensy firmware refers to the calibration ranges as “Bands”—hence the “B” command designator.
SOME MATH EQUATIONS
For each frequency point in the data collection sweep, the AD5933 returns two 16-bit, two’s-complement values corresponding to the Real and Imaginary portions of the DUT’s impedance at that specific frequency. Note that at this stage, these are only relative numbers, which must be multiplied by a gain factor that has been pre-determined and stored in the calibration array. There is a separate gain factor for each 500 Hz section within the 1,000 to 101,000 Hz sweep range (200 values). Also, there is a separate gain factor array for each of the six calibration ranges between 100 Ω and 1 M Ω.
The impedance is defined as follows:
The firmware running in the Teensy LC returns the “raw” Real and “raw” Imaginary terms, along with the actual impedance—calculated using Equation (2) and the proper Gain Factor from the calibration array. During the calibration procedure—performed on each of the six calibration bands—a known 1% tolerance resistor is connected as the DUT. Equation (2) can be rearranged. Substituting the known resistor’s value for impedance, the Gain Factor can be determined for each 500 Hz section of the 1,000 to 101,000 Hz range. The 200 single-precision floating-point Gain Factor values are stored in the EEPROM using 4 bytes per value.
You might wonder why I chose to make the Teensy LC calculate and store (in external EEPROM) all the calibration data. It would be easier to let the host PC do that, with the calibration data stored in disk file(s). Most of my instrument designs are targeted at chemistry under-graduate teaching labs. I’ve built multiple instruments of that type, each of which is later connected to any one of many PCs located on the lab benches. With that in mind, it’s important that the instrument’s calibration data remain within the instrument itself.
Figure 6 is a graph of the Gain Factor versus Sweep Frequency for calibration band 4 (10 kΩ full-scale). This is basically a straight line with a slight upward slope, if you ignore the “damped oscillation” at the extreme left. This “oscillation” occurs on all impedance ranges. It results from the ADC’s sampling at a fixed 1 MSPS rate and the DFT’s operating on 1,024 samples. With a 1,000 Hz excitation, the 1,024 -point DFT will be sampling a little more than one complete cycle. With a 500 Hz frequency increment per sample—over the next few thousand hertz—the DFT will be sampling a non-integral number of cycles and there will be an error introduced. As you can see, this error decreases rapidly as the frequency increases. I would guess it’s a sinc rate, because that function comes up frequently in Fourier transforms on sampled data.
While the calibration provides a Gain Factor correction—at the lower end of the frequency sweep where the “oscillation” occurs—the accuracy of the data won’t be as good as it is in the higher-frequency regions of the sweep. The only way to overcome the low-frequency accuracy issue is to feed the AD5933 with an MCLK of a lower frequency than the 16.776 MHz internal clock. This reduces the ADC’s sample rate and drops the sinc “oscillation” proportionately lower in frequency. Slowing down MCLK would not be particularly hard to do, given that the PmodIA board has provisions on the bottom of the board for mounting an external SMD crystal module. This can be switched in/out by sending the appropriate command to the AD5933. The lower MCLK signal could alternately be provided by the Teensy LC.
Another issue arises, however, if you try to extend the low-frequency limit too much lower than 1,000 Hz. Referring to Figure 4, you can see that C7—labeled C6 on the PmodIA datasheet’s schematic—is a 47 nF capacitor. At 1 kHz, this has a reactance of 3,386 Ω, which then feeds R1/R2 and presents a 24.95 kΩ load to the signal. At 1 kHz, C7’s 3,386 Ω series reactance will attenuate the signal somewhat and introduce some phase shift. If you try to extend the instrument’s lower frequency limit significantly below 1 kHz, the value of C7 would need to be increased proportionately.
In practice this is very hard to do, as this capacitor is too tiny to swap out by hand. Additionally, the low-pass filter contained in the AD5933 is designed to filter out signals beyond the ADC’s Nyquist frequency. The datasheet doesn’t provide any details about this low-pass filter, but I assume it is designed to work when the ADC is running at 1 MSPS (with MCLK= 16 MHz). When you slow down MCLK, the ADC slows down proportionately, and I think that an external low-pass filter of a proportionately lower frequency would need to be added.
Although I didn’t need it for my project’s application, the phase can also be calculated using the “raw” Real and Imaginary values:
The arctangent function returns the correct standard phase angle only when both the sign of the Real and Imaginary values are positive. When they’re not, you must correct the phase angle accordingly. This is described in Table #7 in the AD5933’s datasheet. Also, Equation (3) returns the phase angle in rads, which would generally be expressed as degrees (1 rad = 57.2958 degrees).
The AD5933 device itself has four excitation voltage ranges and two ADC PGA gain settings. Also, the external TIA has two ranges. With this combination of excitation voltage and current measuring ranges, I settled on six discrete impedance ranges. A separate calibration run is performed for each of these ranges. You can see the full-scale impedances for the six ranges, ranging from a low of 100 Ω up to 1 MΩ, in Table 3. For each of the six ranges, there is a combination of TIA feedback resistor, DAC voltage range (excitation voltage) and PGA gain. Each range’s combination is chosen to present the ADC with about two-thirds of its full-scale range—3.0 V with the PmodIA. This gives the best possible resolution, while still providing some “headroom” for the ADC, so that it doesn’t saturate from an over-range input current.
The calibration can be performed by sending the required commands to the instrument, using a serial monitor application or by using the PC application that I wrote to perform both calibration and measurements. I’ll describe the first option here. First, the desired range is selected using the “B x” command. This command sets up the excitation voltage, PGA gain, TIA feedback resistor selection and specifies the value of the “calibration” resistor that you will be connecting up as the DUT.
I decided to have the calibration done over a frequency range of 1,000 to 101,000 Hz, in 500-Hz increments. This sweep range is set by default when the instrument is powered up, so it doesn’t need to be specified—unless you change it using the Start Frequency (“S” command) and/or the Frequency Increment (“I” command).
Next, you connect a 1% resistor to the DUT terminals. Sending a “C” command will perform the calibration. You will see a series of data points in the serial terminal. Each line contains the excitation frequency, the “raw” Real and “raw” Imaginary readings from the DFT and the calculated Gain Factor. An array of Gain Factors—one for each 500-Hz frequency band—is stored in the 24LC256 EEPROM chip. As a result, you don’t need to do anything with the Gain Factor readings manually. When the Calibrate function is run from my PC application, the 200 Gain Factor readings can be saved to a disk file, using the Save Current Run menu item. The contents of this file could then be imported into Excel and used to observe, for example, the anomaly at low-frequency readings that I mentioned earlier (Figure 6).
This procedure must be performed for all six ranges, placing the proper resistor in place for each range. To reduce noise in the reading, the Calibration routine performs four measurements at each frequency, and takes the average. In operation, different starting frequencies and sweep ranges can be specified by the user. In this case, the frequency at which readings are taken will usually not match those used in the calibration. Therefore, during normal measurement, a selection of the calibration data points is used to interpolate the measurement frequency with the frequency of the closest calibration data point. No fancy math is done here, as the Gain Factor vs. Frequency is a straight line with only a small slope (Figure 6).
COMPILING THE SOURCE CODE
All members of the Teensy module family use Freescale (now NXP) Arm processors. PJRC, the company that makes these modules, has written a “plug-in” for the Arduino IDE, which allows you to write Teensy programs in the Arduino IDE using Arduino’s simplified “C” syntax. This plug-in is called “Teensyduino” and can be downloaded from the PJRC site. The link is available on the Circuit Cellar article materials web page. Meanwhile, my source code (AD5933.ino) is available on Circuit Cellar’s article code download web page.
When you run the Teensyduino plug-in’s installation program, you will have to specify the folder where your Arduino program is stored. After Teensyduino has installed, when you open the Arduino IDE and check the Tools-Board menu you will see a separate section called “Teensyduino.” It contains all Teensy modules. For this project, you would select the Teensy LC board. When I did this project, I was using Arduino version 1.8.5 along with Teensyduino version 1.42—both the latest, stable versions available at the time.
There is an important option that you must configure for this program to work properly. Under the Tools-Optimize menu, select “Faster.” The regular measurement routine sends out floating-point numbers for the actual impedance values, and the Calibration routine sends out floating-point Gain Factor values. Initially my Optimize setting was set for “smallest code.” I believe that must be the default, because I did not choose that setting. The “smallest code” setting prevented these formatted floating-point numbers from being sent out the USB serial port.
As I mentioned earlier, Analog Devices provides sample software to run their EVAL-AD5933 evaluation board. This software is provided as a .EXE file which runs under Windows. I didn’t purchase the EVAL-AD5933 board, so I couldn’t try out this sample program, but I assume it must work. Also, as I noted earlier in the article, I couldn’t compile the VB6 source code because third-party VB libraries were needed but not supplied. Without being able to edit/compile Analog Devices’ VB6 source code, it would have made it difficult for me to modify their sample program the way I wanted.
Given this complication, I decided against using the Analog Devices evaluation board. Instead, I used the Digilent PmodIA board with my own Teensy MCU controller. For the PC host application, rather than using the outdated VB6 compiler, I wrote it using VB.net. VB.net is part of Visual Studio Community 2015, which is a full-featured IDE with various options for C/Basic toolchains, all supplied by Microsoft at no charge.
The only “tricky” part of this program concerns its interface to the USB serial port used by the Teensy LC for communications. The Teensy’s USB serial port shows up in Windows Device Manager in the Ports (COM and LPT) section as a “USB Serial Device (COMx)”—where “x” is the COM port number that Windows has assigned it. It doesn’t show up as a “Teensy LC,” as you might expect.
I’ve used USB-serial bridge adapters that show up in the Device Manager as “Prolific USB-to-Serial Comm Port” or “Silabs CP2103.” These are more descriptive names that you could designate in VB.net to select the proper device, assuming you have identified its descriptive name in Device Manager.
In this case, I’ve written the VB.net code to search for the occurrence of “COM” in the device name. I then open the first COMx port that Windows has enumerated. This COM port number is displayed in a text box on the main program screen. If you don’t have any other USB-serial devices plugged into the PC, this COM port number should be the same as the one that the Device Manager displays, and everything will work fine. If you have multiple USB-serial devices attached to the PC, you would have to change the VB.net code shown in Listing 1 in the program to look for the specific COM port number assigned by Windows.
(lines 86-91 in the code)
If InStr(fullComPortName, “COM”) <> 0 Then
cpindex = InStr(fullComPortName, “COM”)
comPortNumber = fullComPortName.Substring(cpindex - 1, Len(fullComPortName) - (cpindex))
tbComportnumber.Text = comPortNumber
If you have multiple USB-serial devices attached to the PC, you would have to change this VB.net code in the program to look for the specific COM port number assigned by Windows.
A screen capture of this application is shown in Figure 7. At the lower right of the screen, you can see that the Instrument COM port is COM9, with a green block indicating the presence of the instrument. The full-scale impedance values can be chosen from the group box to the left of the data graph area. Start and Final frequencies are set with the appropriate buttons. The six ranges are calibrated using the Calibrate Menu item. The current run can be saved to a disk file using the File menu.
In collecting data, you would start out by picking a Full-Scale Range lower than what you expect the impedance to be, and then incrementally increasing the range until a useable data graph is produced. The graph will be scaled to 120% of the full-scale value selected to allow for some “headroom.” If any part of the frequency sweep produces an impedance that is beyond this 120% limit, that portion of the plot will be colored red. In this screen capture, I had a 10 kΩ, 1% resistor connected as the DUT and you can see the straight line representing the Impedance vs. Frequency.
Figure 8 shows the finished instrument. It’s small—only about 5” long. I built it “on-spec” to see if it could be integrated into the Physical Chemistry teaching labs at Dalhousie University, where I worked for 30 years (I’m now retired). For their purposes, I expect that Phase won’t be needed, so I didn’t add the calculations to measure it. However, the instrument provides both the “raw” Real and “raw” Imaginary values of the impedance, and the Phase can easily be calculated from Equation (3) shown earlier. In addition, one would need to save six Phase calibration tables in EEPROM. That’s because the AD5933’s internal signal path contains circuitry that results in an inherent phase shift that requires compensation. The 24LC256 EEPROM that I used has plenty of room to store this extra Phase calibration data.
For detailed article references and additional resources go to:
PUBLISHED IN CIRCUIT CELLAR MAGAZINE • MARCH 2019 #344 – Get a PDF of the issueSponsor this Article