This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

FDC2212: FDC2212 Real Dynamic Range (Single vs. Differential Configuration)

Part Number: FDC2212
Other Parts Discussed in Thread: FDC1004

Tool/software:

Hello everyone, I am attempting to use the FDC2212 to measure the capacitance drift of a number of SMD capacitors as they undergo various environmental temperature/pressure, and I am noticing that while it seems to work for pF range capacitors, the precision of the sensor dramatically goes down when the capacitance reaches nF levels. I am wondering if I am configuring my sensor in software incorrectly, or if I am reaching the maximum capacitance sensing range for my particular choice of inductors. Here is my circuit schematic (C+ on the MAX14661ETI_T multiplexer chip is connected to C2+ on the FDC, C- is connected to C2-, and I grounded CLKIN and am using the internal oscillator for all of these):

The layout are as the following, where the two boards are connected by wires (unshielded):

Now, I am aware that this is wired up in differential mode where the capacitors are getting measured across C2+ and C2-, so I did the following for the registers/capacitance measurement:

#define FDC2212_I2C_ADDR_0 (0x2A)  // Default I2C address
// Register Addresses
#define FDC2212_DEVICE_ID            0x7F
#define FDC2212_CONFIG               0x1A
#define FDC2212_MUX_CONFIG           0x1B
#define FDC2212_STATUS               0x18
#define FDC2212_DATA_CH0_MSB         0x00
#define FDC2212_DATA_CH0_LSB         0x01
#define FDC2212_DATA_CH1_MSB         0x02
#define FDC2212_DATA_CH1_LSB         0x03
#define FDC2212_RCOUNT_CH0           0x08
#define FDC2212_RCOUNT_CH1           0x09
#define FDC2212_SETTLECOUNT_CH0      0x10
#define FDC2212_SETTLECOUNT_CH1      0x11
#define FDC2212_CLOCK_DIVIDERS_CH0   0x14
#define FDC2212_CLOCK_DIVIDERS_CH1   0x15
#define FDC2212_DRIVE_CURRENT_CH0    0x1E
#define FDC2212_DRIVE_CURRENT_CH1    0x1F
// Constants for Configuration
const uint16_t CONFIG_VALUE = 0x5401;        // Conversion configuration with reserved bits set
                                             // Max current for shorter sensor activation time, chan1 continuous mode
const uint16_t MUX_CONFIG_VALUE = 0x020D;    // Channel multiplexing configuration with reserved bits set
const uint16_t RCOUNT_MAX = 0xFFFF;          // Max reference count for long integration times
const uint16_t SETTLECOUNT_VALUE = 0x0400;   // Settling reference count
const uint16_t CLOCK_DIVIDERS_VALUE = 0x1001;// Clock dividers configuration (bits 13:12)
                                             // Differential: b01: divide by 1. Chooes for sensor frequencies between 0.01MHz and 8.75MHz
                                             // Differential: b10: divide by 2. Choose for sensor frequencies between 5MHz and 10MHz
                                             // Single-ended: b10: divide by 2. Choose for sensor frequencies between 0.01MHz and 10MHz
const uint16_t DRIVE_CURRENT_VALUE = 0x8C40; // Drive current setting for each channel
// Constants for Capacitance Calculation
const double CH_FIN_SEL = 2; //use this when CLOCK_DIVIDERS_VALUE = 0x2001, use 1 when CLOCK_DIVIDERS_VALUE = 0x1001
const double fclk = 43.3e6;  // 43.3 MHz internal clock frequency (adjust if external)
const double L = 18e-6;      // 18 µH inductance
const double cap = 33e-12;   // 33 pF parasitic capacitance
// Utility functions
void writeRegister(uint8_t reg, uint16_t value) {
  Wire.beginTransmission(FDC2212_I2C_ADDR_0);
  Wire.write(reg);
  Wire.write((value >> 8) & 0xFF);  // MSB
  Wire.write(value & 0xFF);         // LSB
  Wire.endTransmission();
}
uint32_t readCapacitanceData(uint8_t msbReg, uint8_t lsbReg) {
  uint16_t msb = readRegister(msbReg);
  uint16_t lsb = readRegister(lsbReg);
  uint32_t reading = ((uint32_t)(msb & 0x0FFF) << 16) | lsb;  // Mask with 0x0FFF to ensure reserved bits are cleared
  return reading;
}
double calculateCapacitance(uint32_t reading) {
  // Calculate Fsense using a 28-bit shift and the reference frequency
  double Fsense = 2*(reading * fclk) / 268435456.0;
  // Avoid negative or overflow values in capacitance calculation
  if (Fsense <= 0) {
    Serial.println("Error: Fsense frequency is zero or negative, check the reading or circuit configuration.");
    return 0;
  }
  // Calculate Csense in pF (picofarads) with safe handling
  double Csense = (1e12) * ((1 / (L * pow(2 * PI * Fsense, 2))) - cap);
  // Serial.print("Freq: ");
  // Serial.print(Fsense*1e-6);
  // Serial.println(" MHz");
  //Serial.println(Csense);
  // Ensure Csense is non-negative
  if (Csense < 0) {
    Serial.println("Warning: Calculated capacitance is negative, likely due to overflow. Check circuit values.");
    return 0;
  }
  return Csense;
}

When I do that, it just outputs a negative capacitance when I measure across C68 and C9 (~100 nF). This is with the mux closed on ONLY that channel (and yes, I do see capacitances change when the mux closes on other channels instead). When I disconnected C- on the mux and grounded it instead (i.e., operated this on the single-ended mode), I switched CLOCK_DIVIDERS_VALUE to 0x2001 per the datasheet and am able to get positive (and somewhat reasonable-looking) capacitances as I switch between each channels. I logged the capacitance of all 16 channels over the course of 2 hours at 2 Hz sampling frequency and get the following statistics. Note that for CH0-5 (AB01-AB06, from 10 nF to 100 nF) the standard deviation and variance are orders of magnitude larger than the pF readings (CH12-15 are controls with no Cs installed).

Note that I saw in another forum post that FDC2212/4 does not support hot-swapping and needs to be put to sleep before you swap the output with a multiplexer, so I implemented that by setting the FDC2212 to sleep mode, waiting 50 us (I tried a longer time too like 50 ms and it doesn't make a difference), switching mux channel, waiting another 50 us, then waking it up again in my logging loop (see lines 16-21):

// Perform logging if enabled
  if (logging) {
    currentMillis = millis();
    if (currentMillis - startTime > logDuration) {
      Serial.println("Logging finished (duration elapsed).");
      file.close();
      logging = false;
      return;
    }

    file.print(currentMillis);
    Serial.print(currentMillis);

    for (int ch = 0; ch < 16; ch++) {
      // Put FDC to sleep, switch mux, wake it
      writeRegister(FDC2212_CONFIG, CONFIG_VALUE | 0x2000); // Sleep
      mux_cap.closeAllChannels();
      mux_cap.openA(ch);
      delayMicroseconds(50);
      writeRegister(FDC2212_CONFIG, CONFIG_VALUE); // Wake
      delayMicroseconds(50);

      // Wait for conversion to be ready
      uint16_t status;
      int retries = 0;
      bool valid = false;
      do {
        status = readRegister(FDC2212_STATUS);
        if (status & 0x0004) {
          valid = true;
          break;
        }
        delay(1);
        retries++;
      } while (retries < 100); // retry up to 100 ms

      if (valid) {
        uint32_t rawData = readCapacitanceData(FDC2212_DATA_CH1_MSB, FDC2212_DATA_CH1_LSB);
        double cap = calculateCapacitance(rawData);
        file.print(",");
        file.print(cap, 8);
        Serial.print(",");
        Serial.print(cap, 8);
      } else {
        file.print(",NaN");
        Serial.print(",NaN");
      }
    }

    file.println();
    Serial.println();
    file.flush();
  }

The test was done in an isolated environment with no movement/disturbance to any of the components. My understanding was that the FDC2212 was supposed to be able to measure fF level resolution capacitance up to 250 nF (or in my case with a 18 uH inductor in single-ended mode, 14 uF to 14 pF for fsense from 10 kHz to 10 MHz). My questions are:

  1. Why is my capacitance reading so much noisier at higher capacitances at single ended mode (nF level noise)? Is this inevitable or is there a way to lower noise at higher capacitances?
  2. What are some reasons why my differential reading setup doesn't work? The capacitance should be more than high enough but my code says it's less than 33 pF which gives me a negative C from the capacitance calculation equation in the datasheet.
  3. Is my method of switching the output with a multiplexer legitimate if I put the device to sleep like that? I'm a bit uncertain why hot-swapping wouldn't work other than increasing settling time, since I don't get how a sudden change in capacitance from switching channels is different from the sensing capacitance changing quickly.

Thank you so much for everyone's assistance!

  • Bill,

    Thank you for your post and your interest in TI products.

    There's a lot to unwrap in your post, so let's start at the beginning, or in this case, the inputs of your circuit.

    The FDC2x1y devices are very similar to our LDC131sx and LDC161x devices.
    That is to say they are based on a resonant input LC circuit that shifts in frequency as the input electrodes (capacitive or inductive) interact with a nearby object.

    For inductive sensors (LDC131x, LDC161x), the input electrode is a coil that interacts with a nearby conductive object.
    The LC circuit is formed by the electrode/coil and a lumped-element cap on the PCB.
    For capacitive sensors the input electrode is usually a uniform conductive object like a rectangular piece of copper and a lumped-element PCB inductor.

    In either case, the input circuit forms a LC resonant circuit/oscillator with a nominal center frequency (ωo) and bandwidth (Δω-3dB) or Q (=  ωo/Δω-3dB).
    The LDC/FDC sensors work by detecting a change in ωo caused by a nearby object.
    Because they are best at detecting a change in ωo it can be said they are pretty good at detecting changes in capacitance or inductance, but not quite as good in detecting an absolute capacitance or inductance. 

    Having said all of that, you might be hitting some kind of limit in your LC input circuit that your FDC can support.
    If the Q of your input circuit gets too high/low, this will correspond to a high/low value of the equivalent parallel LC circuit resistance (Rp) , and the FDC will not be able to maintain the needed input waveform levels, VSENSORMIN, VSENSORMAX.
    Also, there are limits on the input frequency fSENSOR the FDC can support. 
    Please take a look at the input waveforms using a high impedance probe and confirm they fall in the amplitude and frequency limits given in the data sheet.
    One trick we use is to place a leaded 1k resistor between the probe tip and the point to be probed on the PCB. The leaded resistor helps reduce the parasitic capacitance of the probe and it does a pretty good job of reducing distortion and frequency shifts in the measured waveform.

    Another consideration is EMI from the surrounding environment. The FDC2x1y devices can be prone to this because proper shielding can be a challenge.
    Because of this, we usually recommend the FDC1004 over the FDC2x1y devices because the FDC1004 has built-in active shield drivers that can help with EMI management.
    The FDC1004 does not use a resonant circuit like he FDC2x1y devices.
    You can see more info about the FDC1004 at the E2E FDC1004 Frequently Asked Questions page. 

    Please update this thread with the results of the measurements, and if they look okay, we can go to the next steps.

    Regards,
    John

  • Hello John, thank you for your assistance I tried the steps you suggested and get essentially the following for channels 0-5:

      However on my serial output I get a frequency of about 0.13 MHz according to the chip itself for channel 0, 0.32 MHz for channels 1-4, and 2.54 MHz for channel 5. For channels 6-15 I get something like this with a reported frequency if about 4.22 MHz.


    I am measuring right at C+ with a 1M 16 pF probe hooked onto a 1.487k leaded resistor in series like what you suggested. From pg 7 of the datasheet under excitation it says the oscillation amplitude should be between 1.2 and 1.8 Vpp, so am I correct to assume that what I am seeing is too low? Any suggestions for how to correct this? Thanks again!

  • Bill,

    What pin/test point are you probing in your first plot?

    Regards,
    John

  • I probed the same pin/test points for all of the tests and stuck the leaded resistor there so it’s not moved between channel switches. I probed the circled green point:


    I just switched over to a higher impedance probe (10 Meg 3.9 pF) and see a p2p of 1.8V now, so I think that was a result of too low of an impedance from my measurement side. With this new probe (and at the same probe site) I see this for chan 6-15 (and still see nothing for chan 0-5):

    According to my understanding, the Fsense is dictated by 1/(2pi*sqrt(LC)), which means my L of 18e-6 should give me a range of 140 pF to 14 uF right? But I am able to get a C of just ~70 pF (40ish pF from serial printout minus the 33 pF I subtract in software). This is strange to me.

  • Bill,

    Are you using a differential or single-ended coil configuration?
    What do the coil waveforms look like if you measure across the individual coils?

    Regards,
    John

  • I did the characterization above in the single-ended coil configuration, but I would like to do it in differential for my actual project. The coil waveform looks like a complete sine wave when I measure across C+ and C- for channels 6-15:

    For channels 0-4, I just get a flat line. Interestingly for channel 5 (which is 10 nF instead of 100 nF) I get some half waveform that only shows up on the negative side whose frequency matches with what I see in my serial print (0.7 MHz):

    Any idea how to interpret this? Sorry that I accidentally marked this as resolved, it is not resolved yet :) Is there a way to un-resolve a post?

  • Bill,

    Marking the thread as Resolved won't be a problem. We can keep going.

    The waveform that should appear across the LC tank (connected to INxA and INxB) should look like a full, balanced sinusoid centered at 0V, with a peak amplitude between 1.2V and 1.8V. To measure this way on an oscope usually requires two high impedance probes with the oscope taking the difference between the two channels.

    The single-ended waveforms on each side of the tank circuit should like like symmetrical, balanced half-sinusoids that are 180 degrees out-of-phase.

    Are you seeing this on all of your channels?

    .,
    John

  • Got it, thank you John. I see that for channels 6-15 like what I said above, but not for channels 0-4. For channel 5, I see a slight sinusoid on the negative side of channel 6 but nothing on the positive side. I had two 10 Meg 3.9 pF probes connected to 1.495k resistors probing both channels relative to ground:

    Waveform for channels 6-15 (slight frequency changes between those channels, yellow is C+ and blue is C-):

    Waveform for channel 6 (10 nF load, yellow is C+ and blue is C-):

  • Bill,

    Thanks for the add'l info.

    Channels 6-15 are okay, but the other channels need some work.

    Are there analog multiplexers between the electrodes+LC tank circuits and the FDC INx pins?

    Regards,
    John

  • The FDC INx pins go straight to the parallel 18 uH inductor and 33 pF capacitor as seen in the layout, then that goes into a cable that goes to the analog multiplexer that connects to all these different capacitors. My intuition is that if the multiplexer is causing issues it wouldn't just be happening on some channels but not others. Do you see an issue with my layout of the FDC and the LC tank (4th image on the first post)?

  • Bill,

    We're still trying to troubleshoot the input, so everything that touches the input path should be considered.

    We can do this in a couple of steps.

    Probe the device input pins and record the single-ended and differential waveforms while:

    1. Removing the sense electrodes (the system inputs)
    2. Removing the connecting cables

    Do the waveforms in (1) and (2) look different than when everything is connected?

    If the sense electrodes and/or cables don't seem to matter, we will move on to next steps.

    regards,
    John

  • When you say remove the sense electrodes, do you mean disconnect the cable from the mux end (i.e., the only thing connected to the INx pins would be the cable and the 18 uH inductor and 33 pF capacitor in parallel)? With the connected cable and the mux connected, it still oscillates if the capacitor connected to the mux channel is <10 nF (see examples above when it's connected to pF level caps or no capacitor at all). In differential mode though (when C- is connected to C2-) it never works even with the mux not connected to anything (but it does work with the cable connected to C2-. Here's a summary:

    1. Just cable connected to C2- and C2+: works

    2. Cables connected to C2- and C2+, C2- cable not connected to anything else and C2+ connected to mux that isn't connecting it with any channel: works

    3. Cables connected to C2- and C2+, C2- cable not connected to anything else and C2+ connected to mux that connects to channels 6-15: works

    4. Cables connected to C2- and C2+, C2- cable not connected to anything else and C2+ connected to mux that connects to channels 0-5: doesn't work

    5. Cables connected to C2- and C2+, C2- cable connected to C-: doesn't work regardless of whether C2+ cable is connected to anything/what the mux is selected to

    This leads me to believe that what I'm doing where I wire C- up to one end of all the capacitors is throwing C2- off and that when in single ended mode (first 4 cases I listed) it doesn't work when the capacitance is too high. The question is why is this happening and how do I fix it?

  • Bill,

    I'm having a little trouble understanding the topology of your single-ended and diff electrodes in terms of the diagrams you posted earlier.

    Are there simpler diagrams of those connections?

    For the differential mode connections, with everything but the MUX disconnected, the reduced parasitics may be forcing the LC tank resonant frequency above 10MHz, which is too high for these devices. Adding some add'l PCB capacitance and seeing if that allows the LC oscillator to have a stable signal (across INxA and INxB) could show you are getting more 'C' than you should from the electrode and cable capacitance.

    What I tried to propose was to first remove just the electrode, then the cable, and then the MUX, all the while monitoring the waveform across the corresponding INxA and INxB device pins. The goal was to see if one of those three connections (or all of them) was responsible for distortion of the waveform across INxA and INxB pins, which the device interprets as the input signal. Until we can establish all of the input signals look okay there isn't much sense in looking a the device outputs.

    Sorry if this wasn't clear.

    regards,
    John

  • Here are some simple diagrams I drew showing what the connections are and their results:

    So in short, as long as the IN1B wire is connected to the other end of the capacitors the FDC output does not oscillate (probed at IN1A and IN1B relative to GND like your previous suggestion). This is true even if none of the capacitors are connected to COMA (i.e., connected to IN1A), and I tested that by programming the mux so that COMA is left floating with all the other channels floating as well. For single-ended, this diagram sums up my observations:

    Do these diagrams clear it up? What other configuration are you looking for to understand what's happening? I only see significant distortion when IN1B is connected to the other end of the capacitors or when IN1A is connected to channels 0-5 (i.e., 100 nF capacitors) or channel 6 (10 nF cap, negative oscillation exists but amplitude is very low).

  • Bill,

    Excellent diagrams. Thank you.
    I suspect the capacitors on the MUX inputs (as well as any MUX-based parasitics) could be contributing factors.

    For some unknown reason, whoever wrote the FDC2x1y data sheets neglected to mention limits on the sensor Rp, Q etc.
    The only thing that is mentioned is an upper limit on the sensor capacitance (250nF), and that's just for a typical value at a relatively low oscillation frequency (10kHz). 

    All of our FDC2x1y devices (and LDC devices) use a negative-gm circuit to form an LC oscillator with the sensor.
    One of the key parameters is the LC circuit Q = Rp·√(C/L) = (1/Rs)·√(L/C) where Rp is the equivalent parallel resistance across the LC pins and Rs is the equivalent series resistance, usually in series with the inductor. Both of these resistances represent the losses in a real resonant circuit.
    If the Q gets too high (very high reactance) or low (Rp too low or Rs too high), the gm-based circuit will not oscillate. 

    I suspect the relatively large bank of capacitors on the MUX inputs combined with the MUX input parasitics (even for OFF channels) are causing losses - and possibly the total capacitance across L) to be too high. That could be why when both cables are connected - and the circuit is completed - the sensor does not oscillate. But it does oscillate when one wire - or neither - is connected, and the oscillator is working only with the 33pF & 18uH.

    A couple of things to try:

    1. With the cables connected, remove the 33pF cap across the inductor and see if this changes anything.
      As a guess some channels that didn't work before may work.
    2. Try different values L and see if the works/won't work pattern changes.

    I've had some customers use analog MUXs in a similar way and have been successful, but they only used 2 channels.
    You're setting a record for the number of switched channels, so if you can make this work, its one for the record books.

    Please let me know how it goes.

    Regards,
    John

  • I changed my system to run off of an external 40 MHz oscillator instead of the internal oscillator, and for some reason that seems to have allowed me to do differential readings (first figure I posted in my last post) without causing problems, but the system still doesn't work at C in the nF range. To determine whether the mux/cables are causing the problem like what you suggested, I tried disconnecting the two cables from the FDC2212 and just swapping the 33 pF capacitor for a 100 nF capacitor, and the sensor does not oscillate, even when I decreased the inductor size to just 1 uH. It does, however, oscillate at 10 nF, but with very low amplitude (100 mV). It still registered on the FDC2212 readout as 10,392 pF though, so that is fairly close (and surprising the low amplitude is picked up by the device). This is with the IN1A and IN1B pins connected ONLY to the capacitor and the inductor with the oscilloscope probes on both pins. I don't believe the issue I am having is a result of my mux now, as I can't read anything in the 100 nF range even with absolutely nothing else connected. Are there any examples of people reading capacitances in the nF range? I see in the datasheet they said they achieved a 250 nF reading using a 1 mH inductor, but with my 1 uH inductor I can barely read 10 nF (amplitude ~60 mV). At 100 nF, the device just freezes (no output, which means unread conversion flag is never on). See below:

    FDC2212 IN1A and IN1B connected only to a 10 nF capacitor and 18 uH inductor, reads 10400 nF:

    FDC2212 IN1A and IN1B connected only to a 10 nF capacitor and 9 uH inductor (two 18 uH in parallel), reads 10,392 nF:

    FDC2212 IN1A and IN1B connected only to a 10 nF capacitor and a 1 uH inductor, reads 8936.03320757 pF:

    FDC2212 IN1A and IN1B connected only to a 100 nF capacitor and a 18 uH inductor, reads all over the place but around 90,000 pF:

    And again with the 1 uH inductor, it doesn't read anything at all. Here's another contrast with a 1 uH inductor or 18 uH inductor, both connected to a 47 nF capacitor. This is what the 1 uH inductor waveform looks like:

    And this is what it looks like with the original 18 uH inductor:

    As a whole, I don't really see much of an improvement from decreasing inductor values for higher C like what I would expect, and this is with no mux and no cable.

    Here's one with the entire system in differential mode now (33 pF cap back, cables, mux, and indexed to channel 5 with the 100 nF capacitor). With 9 uH I get a Vpp of about 42 mV and a period of 1.920 us which is roughly 521kHz, or 10.37 nF in capacitance. However the FDC2212 is unable to read that and output a reasonable value since the amplitude is so low:

    For 18 uH, I get essentially the same thing (2.736 us => 365497 Hz => 10.5 nF) but with a larger amplitude (which I'm guessing is what I want?), but again the FDC doesn't pick up on the signal.

    This looks like the frequency is actually changing how we want it to, but the sine waves are just getting extremely attenuated at higher C regardless of L values (tried 1 uH, 9 uH, and 18 uH, and 18 uH has the least attenuation for some reason). Any suggestions/idea for what is causing this attenuation?

  • Bill,

    Many thanks for the add'l info.
    I will review it and update this thread by Wednesday.

    Regards,
    John

  • Bill,

    What  setting are you using for the sensor drive current?
    If it isn't maxed out, does increasing it help?

    Regards,
    John

  • I have it set as DRIVE_CURRENT_VALUE = 0x8C40 so I think that's already maxed out :(

  • Bill,

    Does your application allow an increase the sensor frequency?
    If so, do you see any differences with a smaller cap and the 18uH inductor?

    Regards,
    John

  • I don’t mind what the frequency of the sensor is, but I need to be able to sense higher capacitances (up to ~100 nF and down to 1-2 pF). As such I can’t just limit it to pF range capacitors. I purchased this device with the understanding that it would be able to measure to at least 250 nF, so that’s what I’m intending to do.

  • Thanks Bill.

    I'm not sure why you're seeing the low amplitudes and erratic output behavior.
    I'll review what we've discussed so far and provide any updates (or questions) by COB on Thursday.

    Regards,
    John

  • Bill,

    If you place a 18uH coil and a 33pF cap across the INxA and INxB inputs, w/o cables or anything else connected, what do you see for INxA and INxB waveforms?

    Regards,

    John

  • If I just have a 18 uH coil and the 33 pF cap across the inputs, I can read around 50ish pF from the frequency and the waveform on both inputs look good. It’s only when the capacitance goes up to the nF range that it stops to work.

  • Bill,

    This suggestion will be "reaching" because I've never tried it myself, but you may be able to detect the nF caps by putting a smaller cap in series with the larger cap you're trying to measure. This will make the overall resonant capacitance smaller, which seems to be best for your system.

    Hopefully the cap values can be sized so the result is an overall capacitance that gives a high-quality waveform, while allowing a useful, measurable frequency shift, and also allowing you to back-calculate your target capacitance from the combination of the two series components.

    Regards,
    John