Z_logger Main Program - WuMRC/drive GitHub Wiki

Z_Logger is an Arduino sketch designed to take repeated impedance measurements using the AD5933, a 1 MSPS 12-bit impedance converter network analyzer from Analog Devices. The sketch initializes communications with the AD5933, configures the AD5933 for measurements, calculates a gain factor using a calibration resistance, and then repeatedly acquires an impedance measurement which it reports back through the serial monitor along with a timestamp. The sketch also includes optional verbose output with extended data (temperature, etc.).

Note: This sketch requires that the AD5933.h library is installed locally into the Arduino IDE, per instructions posted in this repository).

Goals for future versions:

  • Measurement speed up to 200 samples/sec.
  • Integration with Bluetooth Low-Energy Communications and/or onboard logging with a micro-SD shield.

Hardware Setup
Z_Logger was written for use with an Arduino using the pinout of the ATMega328P (Duemilanove, Uno, etc.) and utilizes I2C communications as configured using the standard <Wire.h> library, which requires the use of pins A4 (SDA) and A5 (SCL). The AD5933 can be powered entirely utilizing either the 3.3V or 5V supply from the Arduino's onboard regulator. An example of a compatible circuit is shown below.
Note: This circuit does not include the optional analog front end (AFE) which is required to measure impedance values below 1 kOhm.
Note: The two 10 kOhm pullup resistors are not required for the I2C bus, but they are recommended to keep the SDA/SCL lines from floating.

Usage
The configuration data sent to the AD5933 that it uses for all of its measurements are specified in the first section of the sketch. Each definition has a numerical value that may be specified by the user, denoted here as a double pound sign ##.
Note: PGA gain and voltage range are set to their default values (x5 and 2 Vp-p, respectively) by this sketch, which resets the control register of the AD5933 on startup.

#define VERBOSE ##
Turns verbose output through the serial monitor on (1) or off (0) for debugging purposes. Verbose output reports the status of each command, calculation, and received measurement.
Note: Delays are intentionally included in the use of verbose output to increase readability. Note: The temperature measurement functionality of the AD5933 is currently only used when verbose output is enabled.

#define cycles_base ##
Multiplied by cycles_multiplier to set the number of cycles to ignore before a measurement is taken, which must be included to allow startup transients to decay upon initial excitation of the impedance load.
Allowed values: 0 - 511

#define cycles_multiplier ##
Multiplied by cycles_base to set the number of cycles to ignore before a measurement is taken, which must be included to allow startup transients to decay upon initial excitation of the impedance load.
Allowed values: 1, 2, 4

#define start_frequency ##
Sets the frequency (in Hz) of the excitation signal sent to the impedance load. While the AD5933 is capable of taking measurements across a range of frequencies, Z_Logger takes repeated measurements at the single frequency defined here.
Allowed Values: 1000 - 100000
Note: The lower limit shown here can be reduced by altering the clock signal supplied to the AD5933 (see the datasheet).

#define cal_resistance ##
Sets the value of the calibration resistance (in Ohms) used to calculate the gain factor for all subsequent measurements. The value of cal_resistance is calculated depending on the range of Z values to be measured (see application note AN-1252, page 5). The calibration resistance is used once during the setup() portion of the sketch, and may be removed once the gain factor is calculated.

#define cal_samples ##
Sets the number of impedance measurements to record in calculating the gain factor. The gain factor is then calculated as an average of the values calculated for each of these individual measurements.


Circuit diagram without analog front end:

References

  1. Official AD5933 Product Documentation (Analog Devices)
  2. Wire library documentation (Arduino)
  3. Autoimpedance project (Jon Newman)
  4. Fritzing (used for images)
⚠️ **GitHub.com Fallback** ⚠️