Im currently measuring nano farads with an arduino due and a very simple circuit. I have programed the code to compute the moving average of the value so my reading are actually very accurate. Currently though im experiencing some strange happenings. One day my meter will read at 100 samples per second and take .003 seconds to charge. The next day my meter will only read 50 samples per second and take .006 seconds to charge the very same capacitor with no adjustment to the code or hardware. Any idea why this may be?

Thank you

Schematic? Code? Picture?

ill have all that info up later tonight. also id like to mention they are home made capacitors. made of cardstock and sheets of aluminum tape. Measuring them with a multimeter and they stay very accurate and consitent

Your multimeter doubtless has a lot of work put into averaging and smoothing the readings.

What very simple circuit? Bypass capacitors? Big huge loops of wire?

We need to know these things.

Hey, my car runs rough, what is it?

I’m working with ACRocco13 on this. I’ll start from the beginning to be more clear.

We’re building a capacitance meter derived from this Arduino tutorial: http://arduino.cc/en/Tutorial/CapacitanceMeter.

Attached is the basic setup. The only difference between this and our actual setup is the capacitor consists of aluminum tape | cardstock | aluminum tape. The leads to this sheet are slightly long (about a foot), but we twisted the wires. As for the rest of the wires, we had it set up with and without big loops. Cleaning up the wiring to be tighter gave no visible difference.

We are looking for a 5 digit resolution and got what we wanted on the one day. On the good day it was able to read 1000 readings per second and the capacitor charged within 180 microseconds. We used an 800 sample moving average and got it to stay steady to ±.02 microseconds. On our bad day (with the exact same setup) it was reading 500 readings/sec and charged in 600 microseconds and it resulted in ±3. microseconds(!). We were astounded how badly it can change from one day to another. The only difference we thought could cause it was that it was a pretty rainy day on the bad day (and thus humid). Could this cause this much difference?

Varying the moving average window and changing the delay between each reading changes things a lot. We aren’t sure where is ideal for both variables. We are thinking about adding a calibration in the beginning to decide the ideal. Is this a good idea or how should we go about picking it?

I’m not too familiar with a bypass capacitor, but from the looks of it we don’t have one, but might want one?

I’ve pulled out the Capacitance meter into a little library below. I also made a filter library (just moving average) and use it to keep track of two averaged windows that I compare. We’re using the Due Scheduler because we eventually want to read multiple capacitors at the same time (hence the cap meter library).

``````// I've shortened this file for simplicity
#include "CapMeter.h"
#include <Scheduler.h>

CapMeter *cap1;

void setup() {
// int readPin, int chargePin, int dischargePin, int ledPin, int window, int waittime
cap1 = new CapMeter(A0, 3, 10, 39, 800, 10);
}
void loop() {
}
``````
``````#include "CapMeter.h"
#include "Filter.h"

CapMeter::CapMeter(int readPin, int chargePin, int dischargePin,
int ledPin, int window, int d) {
cPin = chargePin;
dPin = dischargePin;
lPin = ledPin;
wait = d;

pastState = new Filter(window);
currentState = new Filter(window);

// Set charge pin
pinMode(cPin, OUTPUT);
digitalWrite(cPin, LOW);

// Set LED pin
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
}

// Shift and replace moving average filter values

discharge();
delay(wait);
}

int CapMeter::charge() {
// set chargePin HIGH and CapMeter charging
digitalWrite(cPin, HIGH);
// 647 is 63.2% of 1023, which corresponds to full-scale voltage
// Bumped this up because Due can read at 12 bit resolution
startTime = micros();
}
return micros() - startTime;
}

void CapMeter::discharge() {
// dicharge the CapMeter
digitalWrite(cPin, LOW);
pinMode(dPin, OUTPUT);
digitalWrite(dPin, LOW);
// wait until CapMeter is completely discharged
}
pinMode(dPin, INPUT);
}
``````

second photo

Crap! I think I can see elementary particles. Please resample.

It looks like you are trying to do some kind of 4 point measurement? That isn't really necessary if you aren't using high currents or trying to ready very low resistance. Or are those connected to the foil for a crude shield?

Get rid of that aluminum foil wrapped around the wires. If nearby objects are causing more than a fraction of a pF of stray capacitance, move them away and shorten the wires.

You have made some very unstable capacitors. Temperature and humidity are going to have a large effect on them. Twisting the wires is OK for short term shielding, but is going to drift in capacitance so you have to zero it out often.

The foil around the wires is going to be subject to temperature and movement.

The principles are sound. I've been building capacitance meters using 555 timers using the same principle since, well, shortly after the 555 timer was made.

I drew this in 1985, but I started building these things using analog meters in the 70's.

can it be that humidity is of influence on the measurement?

the 4 point measurment you are refering to is us attempting to measure 2 capacitors at a sigle time. They are not meant for a crude shield. I agree with the aluminum foil around the wire. It was a last ditch effort to improperly cancle noise. Would manufactured shielded wire improve our noise reduction? We are currently using 22 gauge solid copper wire should we switch to something different? Also like i said our current capacitors are 1.2 mil aluminum tape with cardstock as a dielectric. If we were to use the same material is there a way to make these capacitors more stable? Last question, will we devlope more error with the time it takes to charge and discharge the capacitor or with the random noise we are picking up? Thank you for the help so far. very interested in taking a closer look at the picture you posted

to robs point, yes i belive humidity has a large affect on the capacitor and to be honest i do not know hot to combat that

The paper is going to absorb moisture readily. Is there a particular reason to use these homemade capacitors? You might try testing and aligning this circuit with a couple of 1nF NPO capacitors. Silver Mica or Polypropylene.

A sheet of plastic may change with temperature but not absorb moisture.

You may not need to shield the wires at all. I've never had to with my 555 circuit.

ACRocco13:
to robs point, yes i belive humidity has a large affect on the capacitor and to be honest i do not know hot to combat that

use plastic cards(?) to make the insulator part of the capacitor, something that does not soak moisture like paper..?

Using manufactured coaxial cable would be more stable than aluminum foil. But merely twisting the wires can be nearly as good, but the stray capacitance will likely be a bit less stable than the coax.

I will experiment with alternative insulators. I just need it to be extremely consistent. I do not need to know the value of the capacitor. Would hardware filtering or amplifying the signal improve my results?

Over what time period are they inconsistent? If they jump around from one reading to the next, noise may be an issue. You have a big noisy RFI generator there called an Arduino.

If it varies over hours or days, that sounds like drift of the capacitor itself.

readings jump from one reading to the next. +/- 1.5 depending on the day.

1.5 what? nF? or pF? If pF, well, wow! That is incredibly stable.

Please try it with stable capacitors, or we are troubleshooting trouble.