Fast measurement of pF capacity nRF52832 - high ADC noise


#1

Hi all,

I am using a BLE nano 2. I am trying to measure small capacities of a few pF with this method:
http://wordpress.codewrite.co.uk/pic/2014/01/21/cap-meter-with-arduino-uno/

So the code that I am using is:

const int OUT_PIN = A3; //P0_2
const int IN_PIN = A5; //P0_4

//Capacitance between IN_PIN and Ground
//Stray capacitance is always present. Extra capacitance can be added to
//allow higher capacitance to be measured.
const float IN_STRAY_CAP_TO_GND = 30.00;
const float IN_EXTRA_CAP_TO_GND = 0.0;
const float IN_CAP_TO_GND  = IN_STRAY_CAP_TO_GND + IN_EXTRA_CAP_TO_GND;
const int MAX_ADC_VALUE = 1023;

void setup()
{
  pinMode(OUT_PIN, OUTPUT);
  //digitalWrite(OUT_PIN, LOW);  //This is the default state for outputs
  pinMode(IN_PIN, OUTPUT);
  //digitalWrite(IN_PIN, LOW);

  Serial.begin(115200);
}

void loop()
{
  //Capacitor under test between OUT_PIN and IN_PIN
  //Rising high edge on OUT_PIN
  pinMode(IN_PIN, INPUT);
  digitalWrite(OUT_PIN, HIGH);
  int val = analogRead(IN_PIN);

  //Clear everything for next measurement
  digitalWrite(OUT_PIN, LOW);
  pinMode(IN_PIN, OUTPUT);

  //Calculate and print result

  float capacitance = (float)val * IN_CAP_TO_GND / (float)(MAX_ADC_VALUE - val);

  Serial.print(F("Capacitance Value = "));
  Serial.print(capacitance, 3);
  Serial.print(F(" pF ("));
  Serial.print(val);
  Serial.println(F(") "));

  while (millis() % 500 != 0)
    ;    
}

When using an Arduino Uno (10 Bit ADC), everything is fine and I have about 1 pF noise. But when using the nRF52832-based chip, I have a strong noise. The readings strongly depend on the Pins which I am using (AX). With some it does not work at all, e.g. P0_28 (A2). I had the best results, when using P0_2 and P0_4 (A3, A5). The noise in this configuration still is about ±10 pF, no matter if using 10 Bit or 12 Bit resolution.
I have had similar issues, when using an Arduino Due, which is also based on a Cortex M4 chip…

Do you have any idea, why I have these issues with the changed hardware?

I would appreciate any hint.

Best regards,
Christian


#2

hi Christian,

do you had success with your measurement?

best
willi


#3

Hi Willi,
the ADC reading quality is just too bad… I could not reduce the noise to my desired level with this hardware.
Did you try it and did you have more success?
Best regards,
Christian


#4

Hi Christian,

no, i also had no success. i switched to Arduino connected with BLE Nano.

Best
willi