Calibrating AD5933 with Arduino

Hi,

I am trying to interface the ad5933 with an arduino. Using the arduino I2C library, I am able to communicate with the ic, read temperature measurements, and program registers and initiate a frequency sweep. I have probed the excitation voltage and I am certain it corresponds with the programmed frequency and amplitude. However, when attempting to calibrate, the values the real and imaginary register values are off and the gain factor is off. I have used the suggested set up in the datasheet with a ZCal=200K and RFB=200K. Yet, the computed gain factor is about 256*10^-12, compared to the 515.8*10^12 in the datasheet. I know my gain factor doesnt need not be the same as the datasheet's but it should be similar at least. And with the current gain factor i'm getting, all test measurements within the range of the Zcal (Zmin - Zmax), are all wrong. I've attached my code herein. Kindly let me know if I'm doing something wrong or missing something. Thanks.

sketch.ino.zip
  • Hi,

    Im sorry but we are not reviewing code... you may described using pseudo code yoru operations, please.

    Say taht, remember that the AD5933 operates in a 2's complement so, make sure that your numbers are correct.

    Regards,

    Miguel

  • Hi,

    I guess before you program the part, you are correctly resetting the part, right?

    You can read this application,

    http://www.analog.com/static/imported-files/application_notes/AN-1252.pdf

    I dont believe the problem is in the communication but how the data is processed...

    Make sure all your equations are correct.

    Additionally, you can physically check Vout during the measurement to double check that the part operates as expected.

    Regards,

    Miguel

  • Here is a pseudocode describing my implementation:

    1) Program Registers: set range, pga gain, settling cycles, start frequency, increment and points in sweep.

    2) Set to standby

    3) Send initialize sweep command to CTRL_REG

    4) Send start sweep command to CTRL_REG

    then in a loop, while STATUS_REG indicates sweep not complete {

              5) Check STATUS_REG for availability of data

              6) Read imaginary and real values, and convert

              7) Compute magnitude, impedance and phase.

    }

    8) Power down

    I run this first with Zcal to compute the gain factor, then use it for subsequent calibrations.

    And yes, I checked the raw hex values in the data registers to be sure that I'm doing the 2's complement conversions right. Since I am able to read the temperature values successfully, it seems to me that the actual values read from the data registers (imaginary and real) are off. Could this be because i'm using an arduino? Have you had any issues using the atmega328p with the ad5933? Thank you.

  • Hi. I took a quick look at your code.  I think when you send any value to Control Register 0x80, you need to 'AND' your new values with the values of D10/9/8 (Output voltage / PGA gain) to ensure the voltage and PGA gain are retained.   If D10/D9/D8 are  0/0/0 then the output voltage is 2V and Gain x5. I assume you are seeing 2V.

  • Hi Marvin,

    Thanks for getting back and for quickly reviewing my code. I see what you're talking about, I'm going to quickly fix that and see if that fixes the issue. Thanks.