AD5933 Part 3
AD5933 Data Sheet Rev. F | Page 4 of 40 SPECIFICATIONS
VDD = 3.3 V,
MCLK = 16.776 MHz,
2 V p-p output excitation voltage @ 30 kHz,
200 kΩ connected between Pin 5 and Pin 6; feedback resistor = 200 kΩ connected between Pin 4 and Pin 5;
PGA gain = ×1, unless otherwise noted.
AD5933 Arduino Library
mjmeli/arduino-ad5933 Library - Michael Meli, GitHub 2016may04
The AD5933 is developed by Analog Devices. From the AD5933 page:
The AD5933 is a high precision impedance converter system solution that combines an on-board frequency generator with a 12-bit, 1 MSPS, analog-to-digital converter (ADC).
The frequency generator allows an external complex impedance to be excited with a known frequency. The response signal from the impedance is sampled by the on-board ADC and a discrete Fourier transform (DFT) is processed by an on-board DSP engine. The DFT algorithm returns a real (R) and imaginary (I) data-word at each output frequency.
Once calibrated, the magnitude of the impedance and relative phase of the impedance at each frequency point along the sweep is easily calculated. This is done off chip using the real and imaginary register contents, which can be read from the serial I2C interface.
In other words, the AD5933 lets you measure the complex impedance of something.
Example
Perhaps the easiest way to see how to use the library is to look at the example code in the examples
directory. Once you install the library, you can easily open this code in the Arduino editor by going to File > Examples > arduino-ad5933 > ad5933-test
.
This example will show you how to initially setup the AD5933 and run frequency sweeps.
There are two methods for doing a frequency sweep.
The first is by using the frequencySweep()
function.
This function is very easy to use, but you have to wait until the entire sweep is complete before handling data in bulk and this requires more memory, especially for large sweeps.
The other method is by manipulating the AD5933 at the I2C level directly, which is slightly more complex, but allows you to handle data immediately after a reading and has significantly lower memory overhead.
Brief Overview
There are an assortment of functions in AD5933.h
that can be used with numerous constants. Each one of the functions are static, so be sure to include AD5933::
in front. Here I cover a few of the main ones.
NOTE: Many of these functions return booleans indicating their success. This may be useful for debugging.
To reset the board: AD5933::reset();
To enable on-board temperature measurement: AD5933::enableTemperature()
To get a temperature reading: double temp = AD5933::getTemperature()
To set the clock source to
internal: AD5933::setInternalClock(true)
OR AD5933::
setClockSource(CTRL_CLOCK_INTERNAL)
To set the clock source to external: AD5933::setClockSource(CTRL_CLOCK_EXTERNAL)
To set the frequency sweep start frequency: AD5933::setStartFrequency(#)
To set the frequency sweep increment frequency: AD5933::setIncrementFrequency(#)
To set the frequency sweep number of increments: AD5933::setNumberIncrements(#)
To set the PGA gain: AD5933::setPGAGain(PGA_GAIN_X1/PGA_GAIN_X5)
To set the power mode: AD5933:setPowerMode(POWER_ON/POWER_DOWN/POWER_STANDBY)
To perform a calibration sweep, which computes gain factor for each frequency step based on a known reference resistance (the results are stored in the gainFactor array, so make sure this is large enough): AD5933::calibration(double[] gainFactor, double[] phase, int referenceResistor, int numIncrements)
To perform an entire frequency sweep (the results are stored in the real and imaginary arrays): AD5933::frequencySweep(int[] real, int[] imag, int numIncrements)
To read a register: byte res = AD5933::readRegister(/* register address */)
That is sufficient for most things. Check out the header file for more functions and constants. Also check out the example code for better illustrations of usage.
.END
Interesting... But what are you going to use it for anyway?
ReplyDelete