Author Topic: Most accurate way to use a microcontroller to measure capacitance?  (Read 13687 times)

0 Members and 1 Guest are viewing this topic.

Offline SuzyCTopic starter

  • Frequent Contributor
  • **
  • Posts: 792
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #50 on: May 09, 2018, 03:12:08 pm »
BravoV

It is not just a question of a "formula for that", it is a question of calibration and software, but, of course, it must be based on stable and  precise actors  involved in the actual measurements and calibration. I think I have that available.

In some raw circuit, .1% means I must ace 1000ppm in freq. accuracy, and the calib. resistor is already good to .02% or better.

Can something measure .1% with even 1% components.  The answer is a big Yes, with calibration, software.
« Last Edit: May 09, 2018, 03:20:49 pm by SuzyC »
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #51 on: May 09, 2018, 03:50:30 pm »
At least somebody can do it!

Can do .01%

I don't think you quite understand the territory.

The Genrad capacitor you've referenced from IET is just that, a single variable capacitor. A secondhand one of these, without calibration, will set you back $300 USD. A new one, with tracable calibration certificate? If you need to ask you can't afford one - I'd guess in the region of $3000 USD. Their target market is national and primary calibration labs. This is the device you use to check the accuracy of an LCR meter, it's a step down from a primary calibration standard.

So that 0.01% specification for measuring its capacitance has been achieved in the temperature and humidity controlled calibration lab of a world class standards company, one that itself supplies national standards labs. If they can only economically achieve only 0.01% (and trust me, if they could do better they would) is it realistic to think that one would be able to achieve a result only 10 times worse on a shoestring bikinistring budget? For comparison, Aglient's $16,000 E4982A LCR meter has a basic measurement uncertainty of 0.45%, a result 45 times worse.

To put the whole absolute accuracy of capacitor measurements into perspective, the best achievable uncertainty in a primary standards lab environment is ±5 ppm (0.0005%) for a precision built primary reference capacitor. To put that measurement itself into  perspective, that kind of capacitor can reversibly change its value by 20 ppm just by changing its orientation.

Being realistic, you're not going to see an absolute accuracy better than 1%, on a good day, with the wind in the right direction, and your tongue at the right angle. However, what you're really interested in is not absolute accuracy, it's the relative matching of a bunch of capacitors. That you can achieve with very high accuracy using a very old fashioned bridge circuit (sine wave source, two matched resistors and a half decent AC voltage meter). I'm not going to put any figures on that, Conrad's your man for that sort of thing (as in I suspect he can quote figures off the top of his head).

You can scrabble back your absolute accuracy in the frequency domain, where measuring to 1 ppm is trivial, or the resistance domain where 0.1% accuracy is the domain of relatively cheap handheld DVMs.

Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 1930
  • Country: us
    • The Messy Basement
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #52 on: May 09, 2018, 04:16:43 pm »
Wait! I'm a hardware-centric dinosaur! I'm an idiot! Go download a free copy of Visual Analyser here- http://www.sillanumsoft.org/
With the sound card in any computer and a couple opamps, it has a high resolution ZRLC meter that you can calibrate to about any degree of accuracy you have a standard for. http://www.sillanumsoft.org/ZRLC.htm

After you finish your notch filter it will generate a signal and let you measure the response or do an FFT.
Unless you're using a Mac. Or can't wire a couple opamps.
I think there may be other programs that can do this to some degree as well.
 

Online Gyro

  • Super Contributor
  • ***
  • Posts: 9485
  • Country: gb
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #53 on: May 09, 2018, 04:17:08 pm »
Gyro: I don't have a sig generator and or a sensitive AC detector. I would have to carefully design, fabricate, test, calibrate and learn to use this piece of specialized equipment. It doesn't seem so easy as you say to achieve .1% accuracy.

An AC source is simple, an 555 timer astable circuit will do the job. Set the frequency to match what you're interested in, you could RC filter the output to round it off a bit, but leaving it as squarewave will do (it match parasitics too). For the AC detector, don't you have some form of audio amplifier and headphones? Ears are very sensitive for such things, match for minimum sound.

For the resistors, you can use the close tolerance ones that you are presumably buying for the Twin-T.
Best Regards, Chris
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: fr
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #54 on: May 09, 2018, 04:22:34 pm »
Thanks agianSiliconWizard, for so generously penning a detailed reply!

Also as I mentioned, if you think you can get an accurate evaluation of a capacitance over such a wide range with a NE555-based oscillator and this without calibration?

As with any instrument, with calibration.

How are you going to calibrate without reference capacitors? How are you going to get ahold of those?

You have a source of <$1 cog/npo caps in larger than 1000pf values in min quan <1000?

Mouser, Digikey... (but Mouser seems to have more corresponding parts.)
For instance: Kemet C0402C102F5GACTU (1 nF / 50 V / C0G / 1%).

Just as a last word, the approach (and schematic) I suggested IS a CTMU. Only with fair precision parts (that are still not expensive), with the added benefit that it should get you reasonable accuracy even without any calibration.

Yes you can do this with integrated µC CTMUs, but you'll have to calibrate (again, with what?) and I doubt you can get 1% precision or better over this wide range of capacitance. Now if you can get ahold of a couple precision reference capacitors, why not.

 

Offline SuzyCTopic starter

  • Frequent Contributor
  • **
  • Posts: 792
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #55 on: May 09, 2018, 04:27:06 pm »
Cerebus:
An Absolute accuracy is only approachable withing standard calibration labs, but I find it hard to believe that even a goal of 1% is very difficult and so it follows that .1% of absolute capacitance value is not reasonably achievable.

.1% resolution of capacitance value seems a cinch.

I can't help but reason that the limit of capacitor measurement is must be somehow limited to 1%.

This 1% arbitrary limit might is likely a pessimistic guess that cannot be glued to a capacitance measuring device that employs analytic circuit design combined with software and hardware calibration. I really think this could be easily achievable(if not immediately verifiable) when calibrated with and when known valued caps(of 1% or better precision/absolute accuracy) are used for comparison.

As my mama said once while reading me bedtime stories, "Even the best atomic clock in the universe is not as accurate as a broken clock, and this is so, twice each day!"
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #56 on: May 09, 2018, 04:40:45 pm »
Yes you can do this with integrated µC CTMUs, but you'll have to calibrate (again, with what?)....
The beauty of the CTMU approach is that you calibrate using a RESISTOR, which can be had in very tight tolerances. The reason is that what you're actually characterizing is a constant current source. Once you know the current, the standard equations for charging a capacitance apply. You do not need a bunch of reference capacitors.

Our most recent CTMU design is using a 0.1% 1206 resistor for calibration. Cost is 21 cents - sure, more than a popcorn SMD resistor, but still quite affordable compared to high precision caps.

A primer on the resistor-based calibration technique is in every PIC spec sheet that has a CTMU. A few minutes of reading will bring you up to speed. There are tricks that can be played beyond the basics they describe, but the primer will get you well down the road.

EDIT: Note too that you can calibrate once and store the calibration data in the on-chip EEPROM (if you use a PIC that has EEPROM), or simply recal on every powerup. Or, heck, on every measurement. Lots of options depending upon your application. The latter choice is obviously the most accurate as it would take into account drift, temperature effects, etc. The calibration process isn't lengthy nor complex.

We went down this road of "how do we measure capacitance" a long time ago. Everything in this thread sounds very familiar. And the end result of that journey was the CTMU. YMMV and do your own research, but I suspect you'll be hard pressed to do as good, or as inexpensively, unless you're designing a lab quality reference standard.
« Last Edit: May 09, 2018, 04:49:26 pm by IDEngineer »
 

Offline SuzyCTopic starter

  • Frequent Contributor
  • **
  • Posts: 792
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #57 on: May 09, 2018, 04:46:29 pm »
SiliconWizard Thank you very much for your comprehensive and well-thought out replies.

 I must apologize for speed reading your reply and not seeing the point you were making about using a cc source, which seems to be the basis for a simple and precise way to accomplish my goal.

C0402C102F5GACTU USD 1.37 approx ea found on mouser. Just the right capacitor to use as an affordable "standard".

Strange, some hours ago I first searched for similar and Mouser's search engine  found just a few cog caps vals sold only in 1000+ quan.

The most important thing in getting a good answer is to know what question to ask.


I only have a pile of 2% 20000pf film available at the moment.

Can I safely assume assume that since I have 35+ of them that most of them would lie well within 1 std deviation of  an absolute accuracy of 20000pf just due to the likely tight control of the process of manufacturing?

So, those that compare best with each others are going to be the best approximation of their absolute value(if I got the right batch!).

« Last Edit: May 09, 2018, 04:55:01 pm by SuzyC »
 

Offline oldway

  • Super Contributor
  • ***
  • !
  • Posts: 2172
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #58 on: May 09, 2018, 04:47:43 pm »
Oldway: I don't quite understand why all the extra buffers. Are you suggesting to buffer the output of the simple astable 555 circuit that feeds the squarewave output back to the the capacitor connected directly to the 555?

Seems like a good idea to remove the load from the timer's output to prevent this influence on the internal comparators that determine the frequency of astable oscillation.

But in every case, dealing with cap vals from .2 to 50pF, using the largest resistor would lower the output frequency to give a longest period to measure with the most resolution  when using a MCU internal timer peripheral counting 62.5nSec internal timer ticks.
So, in this case, having to buffer the output of the 555 seems to be useless.

I am assuming here using a MCU that operates its HFINTOSC of 64MHz which corresponds to 16mSec instruction clock, although the internal peripheral timer clock can be the 64MHz clock.

Using any MCU means there will be jitter in measurements due to inherent IRQ and HFINTOSC  jitter, but it is certainly possible for this jitter be averaged out to minimize this source of error. The final measurement value would be obtained by averaging many measuring results.

With a 16-bit timer, the resolution of a raw max period measurement of  555 osc. could be as good a very tolerable one count ambiguity of 62.5nsec.  Assuming the 555 oscillates using a precision resistor and the DUT for timer, it means the largest valued resistor would be chosen to max out the counter resolution of the internal MCU timer.

Why wouldn't this idea work?

Why wouldn't the CMOS 555 timer, with a tightly regulated supply voltage, well bypassed,  be well suited to do a very good job here?

What is the problem the using a CMOS 555? What would be compromising in its design to be capable of introducing error?

As with any precision capacitance measuring device, whether its made by Gen Radio, Agilent or by using a 555, calibration and comparison with a known standard would be a must.

The only problem I have would be to make a few of my own "calibration standard" capacitors values using the timing resistor's precision itself to determine its value to better than  .1%.  I can fairly easily find .02% or better timing resistors.

Some explanations : This astable oscillator will oscillate at : F=0.722/R1C1.
F is then well inversely proportional to the value of C1.

300Khz is more or less the max frequency you can use the Cmos version of 555. (TLC555 for example.)

Than R1 must be more or less 47K. For stability, It must be a resistor with nul temperature coeficient.

You wrote:
Quote
For instance, a CMOS 555 timer can vary 1% in freq (that's the spec.) with supply voltages changing from 5 to 15V.
That's right and it varies with temperature also.

The frequency formula shows that the frequency is not dependant from power supply voltage, nor temperature.....

Then, how to explain that it varies when in theoria, it should not ?

This is because the output stage of the Cmos 555 is far from being a perfect switch...It does not go to 0V (Vss), nor to the power supply voltage (Vdd).

Indeed, with a power supply of 5V for exemple, with a 1mA current, output voltage  (Voh) can vary between 4.1 and 4.8V...this value varies with temperature and output current.
Low level voltage (Vol) with 3.2 mA sinking current varies between 0.13 and 0.4V...

Using an inverting buffers Cmos 4049B (one inverting buffer and 5 inverting buffers in parallel) or a non inverting buffers Cmos 4050B, whe are eliminating the problems of instability with variations of temperature and with variations of power supply.

Indeed, first whe divide the current in 5 ou 6;
Second: the buffers are far better switches then the output stage from the 555.
With 5V power supply (Vdd)
Voh : min: 4.95V
Vol :  max: 0.05V

 
« Last Edit: May 09, 2018, 04:52:12 pm by oldway »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: fr
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #59 on: May 09, 2018, 05:00:34 pm »
The most important thing in getting a good answer is to know what question to ask.


Quite right. A word of wisdom. :-+

I only have a pile of 2% 20000pf film available at the moment.

Can I safely assume assume that since I have 35+ of them that most of them would lie well within 1 std deviation of  an absolute accuracy of 20000pf just due to the likely tight control of the process of manufacturing?

So, those that compare best with each others are going to be the best approximation of their absolute value(if I got the right batch!).

Well, on just a few tens of parts, I'm not sure you could assume this, and still, that sounds like a lot of pairs to compare!
But if you can trim the resistors, maybe 2% tolerance would be a decent fit for your twin-t filter?
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #60 on: May 09, 2018, 05:00:41 pm »
the approach (and schematic) I suggested IS a CTMU. Only with fair precision parts (that are still not expensive)...
Your constant current source uses a REF200. Have you priced one of those lately? And then you still haven't paid for the MCU that was requested in the title.

A CTMU-equipped PIC already HAS a constant current source, without all of the standalone discretes, and it's controllable by many of the other integrated peripherals such as hardware timers which yield extremely high resolution temporal control of the constant current source without being dependent upon firmware instruction cycles. It also contains a S/H which further isolates you from the (potentially) non-deterministic behavior of a firmware-driven approach due to various leakage (read: discharge) currents in any design, whether integrated or discrete.

All for under three dollars.
 

Offline SuzyCTopic starter

  • Frequent Contributor
  • **
  • Posts: 792
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #61 on: May 09, 2018, 05:06:16 pm »
Thanks Oldway!

I don't quite wrap my head around why you focus on the max freq of osc. of a CMOS 555, the best frequency for this measurement is always going to be with the lowest freq, that is having the longest period to maximize the available resolution of the MCU counter peripheral.

So, I get it that the CMOS buffers are going to buffer the output of the 555 and connect then to the timing resistor.

But again why the buffers, when of course using a very tightly regulated Vdd supply! Temperature variations are probably not too important as this device would be used with the range of comfortable room temperature, not in Siberia one day and Syria the next.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: fr
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #62 on: May 09, 2018, 05:13:51 pm »
Yes you can do this with integrated µC CTMUs, but you'll have to calibrate (again, with what?)....
The beauty of the CTMU approach is that you calibrate using a RESISTOR, which can be had in very tight tolerances. The reason is that what you're actually characterizing is a constant current source. Once you know the current, the standard equations for charging a capacitance apply. You do not need a bunch of reference capacitors.

You're making a good point. I remember using a CTMU (don't quite remember on which MCU, a Microchip I think, that was years ago), and the way it worked, it was not possible to directly do this as I reckon. I think it relied on a voltage change to work properly.

Anyway if your MCU has a CTMU that allows this, that's a nice solution. But still, two things I'm wondering. You have the current source characterized, but does the CTMU not rely on an internal voltage reference as well? How can you characterize it? Is it accurate enough? Also, the internal current source is probably not as good as a REF200 or similar, in terms of output impedance for instance.
So I'm still not 100% convinced that you can get a real accuracy of under 1%, but I must admit it's elegant and cheap.
 

Offline SuzyCTopic starter

  • Frequent Contributor
  • **
  • Posts: 792
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #63 on: May 09, 2018, 05:15:56 pm »
SiliconWizard, Thanks again!

The idea is that once I choose the capacitor that best fits the median value of the batch, I can call that my "standard cap 20000pf."
Now I also have 2000pf and 3500pf 2.5% capacitors. Shouldn't the best agreement with the non-20000pF "standard" verify that the 20000pf standard value well approaches the absolute value of its capacitiance?
 

Offline SuzyCTopic starter

  • Frequent Contributor
  • **
  • Posts: 792
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #64 on: May 09, 2018, 05:40:04 pm »
SiliconWizard: Thanks, you've made a very good point.
The built in cap meas pin of a MCU couldn't possibly be as easy to achieve accuracy with considering the inaccuracies introduced by the MCU internally considering the limited precision/stability/noise content/offset/bias currents/reference voltage stability for the current source etc. that would also likely vary with temperature and VDD.

Your idea to build a similar working meas. device using a quality CC in an carefully fabricated external meas. environment has to be the better!

Somehow the CTMU idea seems too good to be true to obtain the precision I want.
« Last Edit: May 09, 2018, 05:44:40 pm by SuzyC »
 

Offline oldway

  • Super Contributor
  • ***
  • !
  • Posts: 2172
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #65 on: May 09, 2018, 05:45:18 pm »
Thanks Oldway!

I don't quite wrap my head around why you focus on the max freq of osc. of a CMOS 555, the best frequency for this measurement is always going to be with the lowest freq, that is having the longest period to maximize the available resolution of the MCU counter peripheral.

So, I get it that the CMOS buffers are going to buffer the output of the 555 and connect then to the timing resistor.

But again why the buffers, when of course using a very tightly regulated Vdd supply! Temperature variations are probably not too important as this device would be used with the range of comfortable room temperature, not in Siberia one day and Syria the next.
Using the max frequency is important to minimize the influence of leakage and input impedance of THR and TRIGGER inputs from TLC555 on value of the frequency.

R1 should be as low as possible....Here, 47K.
No need to be a precision resistor.

No need of a tightly regulated Vdd supply...With a buffer, frequency don't vary with Vdd.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: fr
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #66 on: May 09, 2018, 05:54:18 pm »
the approach (and schematic) I suggested IS a CTMU. Only with fair precision parts (that are still not expensive)...
Your constant current source uses a REF200. Have you priced one of those lately? And then you still haven't paid for the MCU that was requested in the title.

Yes, they can be had for around $8-$9 for one piece (6 € at Mouser). The overall BOM would probably be less than $20-$25. We've probably all have consumed a lot more than this just talking about it.  ;D

A CTMU-equipped PIC already HAS a constant current source, without all of the standalone discretes, and it's controllable by many of the other integrated peripherals such as hardware timers which yield extremely high resolution temporal control of the constant current source without being dependent upon firmware instruction cycles. It also contains a S/H which further isolates you from the (potentially) non-deterministic behavior of a firmware-driven approach due to various leakage (read: discharge) currents in any design, whether integrated or discrete.
All for under three dollars.

I admit it's unbeatable cost-wise, but I'd still be interested in comparing the two approaches.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #67 on: May 09, 2018, 05:56:24 pm »
David Hess sez, "Using an astable oscillator does work however the fixed delay between the comparators and output adds an error term which shows up as non-linearity and this error term changes at different frequencies."

As in all things, cannot calibration eliminate this error, especially with the power of software?

Sure it can, but it represents another source of error.  Even worse, the delay varies depending on other factors like supply voltage and temperature.

The error due to the delay limits the accuracy of analog function generators at high frequencies so they often include circuits to compensate for it and sometimes a calibration adjustment which causes the comparators to switch earlier at higher frequencies.

Quote
All instruments require testing/calibrations before their intended use.

Sure, but reducing uncertainty makes testing and calibration easier.  Bob Pease once pointed out that it is easier to compensate a 20ppm/C circuit to 0ppm/C than a 200ppm/C circuit.

I was also considering your original post from the perspective of best accuracy with a minimum of calibration using reference capacitors and a simple design with more common parts.  Of course you still need high accuracy resistances and voltages and time measurement.

I don't quite wrap my head around why you focus on the max freq of osc. of a CMOS 555, the best frequency for this measurement is always going to be with the lowest freq, that is having the longest period to maximize the available resolution of the MCU counter peripheral.

Low frequency operation with a low value of capacitance requires higher impedances which leads to a whole new set of problems like leakage and electrostatic coupling from other sources.



Consider your accuracy requirements in relation to old test instruments and their complexity.  I have a pair of ancient ESI 250DA impedance bridges which supposedly can achieve 0.2% + 1 digit on low dissipation capacitors using a built in 0.1% reference capacitor.  Decades later I have no reference capacitor or capacitance tester good enough to verify this level of performance.  An instrument like this would have no trouble however grading capacitors into matched sets of better than 0.1% and many of the discussed designs can also do that despite lower absolute accuracy.

Note that I do not really recommend picking up an old impedance bridge; they are a pain to use although perhaps not so difficult for grading parts of one value.
 

Offline IDEngineer

  • Super Contributor
  • ***
  • Posts: 1926
  • Country: us
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #68 on: May 09, 2018, 06:03:04 pm »
The built in cap meas pin of a MCU couldn't possibly be as easy to achieve accuracy... Somehow the CTMU idea seems too good to be true to obtain the precision I want.
All I can say is, try it before you scoff.

I personally participated in some very long, very detailed conference calls with rooms full of Microchip Silicon Engineers and Applications Engineers. They put a LOT more thought and Engineering into the CTMU than we expected. The linearity of the current source, the leakage of the switches, etc. were all carefully considered. And the results speak for themselves. Using a 0.1% reference resistor for calibration, we easily get sub-1% repeatable results on *production* devices built in the hundreds per month.

A VERY carefully designed and laid-out discrete approach might equal that, but with much greater effort and cost. If you actually NEED the highest possible accuracy, like if you're building a lab-quality measurement device, then sure - a CTMU (probably) won't get there (but honestly, it's been so amazing I'd characterize it before I dismissed it). But for anything short of a lab reference, I'd start with the CTMU and prove it WON'T work in the given application because I strongly suspect it would do just fine, and the surrounding infrastructure would be far easier to implement in the bargain.

SiliconWizard, you're correct that an accurate voltage reference is needed. But those are cheap and easy. If 1% accuracy is acceptable, use a 1% voltage regulator and just use the supply rail. Tighter voltage references, to almost any spec you desire, are off-the-shelf, inexpensive, and readily available (check DigiKey or Mouser to start). A very accurate voltage reference is still cheaper than the REF200, and honestly... after discussions with Microchip and our own in-house experience, I suspect the CTMU current source is more accurate.

The REF200 is only spec'd to 0.5%. We're seeing better repeatability and absolute accuracy than that. And if REALLY high accuracy is desired, the CTMU has three separate current ranges each of which can be adjusted under firmware control over a +/-60% range. Slap in a single resistor of the desired precision, measure the voltage that develops across that resistor due to the current source, trim in firmware in real time, and bingo - you can get much, MUCH more accurate than the REF200's 0.5%. In reality, the CTMU's accuracy is only limited by the resistor you use to calibrate it... and tight-tolerance resistors are cheap and readily available. DigiKey lists 0.01% resistors for $1.03/100's. That's 50X better than the REF200. Back in the real world, the 0.1% resistor we use is ~50 cents and that's still 5X better than the REF200.

Disclaimer: I don't work for Microchip. But I've been mightily impressed by their CTMU. I have a LOT of experience with it now, over a period of ~2 years, and you'll be hard pressed to duplicate its accuracy and repeatability in discretes for any realistic cost. And if you want to do so in a production environment, you'll burn a lot of labor hours duplicating what the firmware self-calibrating nature of the CTMU gives you for free.
« Last Edit: May 09, 2018, 06:10:59 pm by IDEngineer »
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26896
  • Country: nl
    • NCT Developments
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #69 on: May 09, 2018, 06:14:53 pm »
An easier approach is to use a synchronous rectifier as they often use in LCR meters. Apply a known AC current and measure the AC voltage across the device. The synchronous rectifier will cancel the noise. If the measurement range is narrow then you can built this with really cheap hardware without losing accuracy. There are some examples on this forum.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: fr
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #70 on: May 09, 2018, 06:46:03 pm »
The REF200 is only spec'd to 0.5%.

Yes, although I've measured a few with an expensive SMU and have seen much better initial accuracy than 0.5% (very impressive), but granted you can't rely on that.

Thing is, you can measure the actual current with a decent multimeter that has 0.1% error or better in DC current mode. You can find this kind of accuracy in middle-end multimeters. The point here is that you only need DC measurements. This kind of accuracy for AC measurements in middle-end DMMs is hard to impossible to find, but for DC, it's relatively common. Same for measuring the voltage references.

 

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 1930
  • Country: us
    • The Messy Basement
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #71 on: May 09, 2018, 07:20:43 pm »
Measure some of your 20000 pF caps and choose one in the middle. Call that your lab standard. Even if it's slightly off, how would you ever know or care?

BTW, I've built a few notch filters and I've always sidestepped the whole problem by including a trimmer cap and/or a trimpot. Tune by result.
 

Offline PA4TIM

  • Super Contributor
  • ***
  • Posts: 1161
  • Country: nl
  • instruments are like rabbits, they multiply fast
    • PA4TIMs shelter for orphan measurement stuff
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #72 on: May 09, 2018, 07:24:54 pm »
Measuring capacitance is hard because a lot of other things play a roll. For instance frequency behavior, parasitics, ESR, leakage, dielectric absorbtion, tempco, voltco, piezo electric effects, and then things like shielding and guarding.   You need a very, very, very good cap and meter to measure the same value for a certain bandwidth.
Like Conrad Hofman I think a bridge circuit is the best option unless you can use some factory calibrated IC. But only if you build a correct circuit and measure ideal caps in an ideal fixture.

My best capacitance meter is a 0,01% GR-1620 bridge that is still in production (you really do not want to know the price but it is one of the best, if not the best, on the market. Measuring a cap to full accuracy takes something like 10 minutes and that a few times because it is very hard to do it  right. Everything must be shielded and the zero detector used to the fullest sensitivity of 1uV for a full scale. I also have some capacitance standards.

I have a GR-1608 back then stated as 0,1% but it turned out to be much better and is later re-spec-ed, I had to replace a resistor, that was almost 40 euro. Not only the initial value accuracy is important but also tempco and things like sensitivity to humidity. This was the cheapest choice to get the right performance (it was advised to me by the original designer of the bridge who helped me with advice and documentation)
My two daily meters are 0,1%. To measure with 0,1% is a whole different story. Both uses a 5 terminal measurement. If I use them 2 terminal I will not even come close to 0,1%.

But one thing I missed in the discussion, All meters that are capable of getting this kind of accuracy measure the complex impedance or admittance. You can not measure only capacitance if you want 0,1%. You need to measure the reactance (and calculate C from it or scale it in capacitance) and real resistance  part too. Or only measure calibration grade caps with an ultra low loss angle. For pF you can use aircaps or vaccuum caps, for 100 pF and up Mica is a good choise but you need to calibrate them and select them for lowest DF, 100 nF and up I think polystyreen as dielectric.

I tried to make my own caps by calculating them but I not even came close thanks to things as the fringing effect. The dielectric is the biggest problem, If you only use air and two guarded rond plates it is doable but still hard, besides that it becomes huge (Marconi builded a big barn for them to hang from the ceiling) I made a coaxial one that came close (only 50% off  ;) ) but because the core would not float in air alone it needed some support and that made the fault over 100%.

I tried oscillators, F.E. Terman writes about a methode in his book about measurements. I tried that but it was hard to get it right. The oscillator was very hard to get stable enough (and you need to measure that with a very good counter) The biggest problem I could never figure out. As soon as I connected the CUT all went well and I could very precise measure the frequency shift but if I removed it, the oscillator had a higher frequency as before and would not go down unless I switched if off a while.

But without calibration grade gear you will start a very frustrating journey. For one because you will never know if you reach 0.1%

The easy way is matching them. Use a sinewave and measure voltage and current, oh wait, you only have a 3 digit meter (and low BW ?)  :-//
Then use two caps in series. Use an ac signal and measure the voltage over both. You can calculate the reactance of the unknown cap from the ratio and then recaculate the unknown capacitance. Or you build a bridge....(and even then forget the 0,1%)

Just use the best caps you have/buy or maybe there is someone here nearby who can measure them for you (although I think only a few of us really can measure a tracable 0,1% and then for a limited frequency range. Do an impedance measurement from your best cap from 100Hz to 1 MHz and you will not get a straight line.
« Last Edit: May 09, 2018, 10:47:24 pm by PA4TIM »
www.pa4tim.nl my collection measurement gear and experiments Also lots of info about network analyse
www.schneiderelectronicsrepair.nl  repair of test and calibration equipment
https://www.youtube.com/user/pa4tim my youtube channel
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #73 on: May 09, 2018, 10:40:09 pm »
Ogden: if I may quote the tag line of another eevblog poster:

The difference between theory and practice is less in theory than
the difference between theory and practice in practice.

Cannot agree more. You definitely need more of both - learning and practice.

You (hopefully) could find "Impedance Measurement Handbook" interesting: http://literature.cdn.keysight.com/litweb/pdf/5950-3000.pdf
 
The following users thanked this post: SuzyC

Offline SuzyCTopic starter

  • Frequent Contributor
  • **
  • Posts: 792
Re: Most accurate way to use a microcontroller to measure capacitance?
« Reply #74 on: May 10, 2018, 01:07:00 am »
I perused the appnote you recommended for me to read and I have these first impressions:

(1) This document has no revision date and so the the characterizations of components(but certainly not the theory) may be well out of date.  In my opinion, an scientific document that fails to give a publishing/revision date is highly suspect of expressing knowledge that can likely be obsolete.  The idea of a scientific/tech paper published without any publication/revision dates is very bad form!

For instance, on a page(Table 5.1) describing the various dielectric materials used in making capacitors:

Ceramic:
Bypassing, coupling, and filtering to high frequency
High capacitance to volume ratio
Chip style available
Low D (low k type)
Low cost
Extensive test data, reliable
Poor temperature coefficients and time stability
Large voltage dependency
and susceptible to pressure (high k type)

It seems obvious this article was composed when chip capacitors were a rare item ("Chip style available")

Where does an almost ideal ceramic capacitor, the COG chip capacitor, find itself mentioned?



---------------------------------------------------------------------------------------
« Last Edit: May 10, 2018, 01:15:26 am by SuzyC »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf