FT232H and AD5933
Previously, I’ve described FT232H in MPSSE mode, that SPI or I2C communicates directly with simple hardware devices, such as TM1637/TM1638 or MCP3204 ADC.
In these cases, hardware interactive development (HID) is not very advantageous, since nowadays MCUs usually come with abundant libraries for these hardware devices, which makes prototyping fast and easy.
HID with AD5933 could be a more convincing use case.
AD5933 outputs a sinusoidal voltage waveform at a certain frequency and measures the resulting current, which is then ADC-ed and DFT-ed into one complex number (real + imaginary) of that frequency component.
Yes, it’s a network analyzer on a chip, though with limited capabilities.
With AD5933, you can sweep the frequency and measure the AC response of your DUT, to characterize your speaker coil or get electrochemical impedance spectroscopy data of your electrodes. These measurements are usually performed with expensive scientific equipment (e.g. Gamry or Autolab).
Hardware Design of AD5933 System
This application note (link) describes all the short-comings of AD5933, such as DC bias and high output impedance, and presents an external circuitry design to overcome these short-comings.
Digilent sold a AD5933 breakout module that copies that circuitry almost exactly. (digikey link)
With hardware issues resolved, now it’s time to focus on the software.
AD5933 datasheet (link) provides many essential information about the device. Please give it a thorough read before coding.
Here are some of my keynotes:
- Because the DFT result is from current measurements, the larger the current, the smaller the impedance.
- AC couple and op-amp chain will introduce phase shift in the resulting real + imaginary numbers. So calibration with a known resistor is very important to measure that phase shift at first.
- make an open-circuit and short-circuit measurement to get the range of the measurement. It helps you adjust the gain (x1 or x5), the excitation (200mV, 400mV, 1V and 2V) and the trans-impedance resistor (200-Ohm or 100k-Ohm).
- It’s important to look at the raw values in the real and imaginary number registers.
- Control register (address 0x80, 0x81) can’t use block write
- To use block read/write, you have to set the address pointer first (kind of cumbersome)
Here is a useful Arduino library for AD5933 (link).
However in this case, with FT2232H, you can pull complex numbers into PC directly. Especially when you start to sweep frequencies, you can make frequency response plot in Jupyter notebook directly.
Not to mention, during calibration and debugging, it’s essential to peek at the raw values in the registers directly.