Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.
0

Capacitance Measurement
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Capacitance Measurement

by mikewitt on Fri Feb 23, 2007 7:47 pm

Anyone have a schematic for capacitance measurement? I need one for position detection on a galvanometer (Basically, I need to measure the capacitance between each of four quadrants, like between I and II; II and III; III and IV; and IV and I. [I'm using standard graphing naming conventions])

It's for a project I'm working on (and will obviously post here when I'm done).
mikewitt
 
Posts: 111
Joined: Thu Jan 04, 2007 9:18 pm
Location: KB9YJY, Wilmette, IL

by adafruit on Fri Feb 23, 2007 8:40 pm

my multimeter has one. basically you put a 1Khz sine wave (or whatever frequency you want the capacitance at) thru a resistor and look at the frequency response output

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by mikewitt on Fri Feb 23, 2007 10:52 pm

Ok, I think I get the general theory, but not so much what the resulting waveform would be.

Here's an example schematic I threw together (forgive me for not connecting all the necessary pins.)
Image

so how would the resulting waveform be affected? I think I could measure it, but what would I be looking for.

**EDIT: Feb 27, 2007 -- Changed image to link of image
Last edited by mikewitt on Tue Feb 27, 2007 5:02 pm, edited 1 time in total.
mikewitt
 
Posts: 111
Joined: Thu Jan 04, 2007 9:18 pm
Location: KB9YJY, Wilmette, IL

by adafruit on Sat Feb 24, 2007 1:52 am

ya thats a good start! now you can make an "RC filter":
http://en.wikipedia.org/wiki/RC_circuit
using the unknown part as the 'capacitor'
and then i dunno, a 1K resistor as the R (or vary it)
then look at the output peak voltage (use a meter to find the peak, or put on AC measurement.
test it on known capacitors first, of course
let me know how it goes

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by mikewitt on Sat Feb 24, 2007 8:45 pm

My brain exploded while attempting to understand those equations on wikipedia. :shock: (Like how can angular frequency be a complex number?)

I'll just create a square wave generator sometime tonight or tomorrow and see how the waveform changes through a cap. (I should be able to read it then on the 644 or 13's built in ADC, when I get to that step)
mikewitt
 
Posts: 111
Joined: Thu Jan 04, 2007 9:18 pm
Location: KB9YJY, Wilmette, IL

by mikewitt on Sat Feb 24, 2007 11:12 pm

I was building the 555 circuit and realized something:

The time that the 555 is low is given by the _SIMPLE_ eqn.:

t=1.1RC, where r is the resistance in ohms, and C is the capacitance (in farads)

so solving for C: we have
C=t/(1.1R)

if R is something high (say, 100k), then I have the equation

C=t/110000

then we use the ADC comparator (it's faster than an out-n-out conversion) and we should be able to measure the time between pulses.

Would this work? I'm thinking that the 555 will be operating at close to 9mHz, and am wondering if that'll cause any problems.
mikewitt
 
Posts: 111
Joined: Thu Jan 04, 2007 9:18 pm
Location: KB9YJY, Wilmette, IL

by adafruit on Sat Feb 24, 2007 11:20 pm

sure

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by mikewitt on Sun Feb 25, 2007 8:14 pm

Ok. I just finished some tests, and it seems to work perfectly.

Here is the schematic I refer to:

Image
(I forgot to add values, R2 and R1 are both 1k ohm

Q is the output, that's what I hook to my scope.

C_HI is the high end of the cap (if you want to test a polarized cap)
C_LO is the low end. --these don't matter on standard ceramic caps

Vcc should be between 5-9v, but can be up to 15v safely. 5v is a good TTL level.

To find out C, use the equation C=t/R (from t=RC)

Since my scope only gives frequency, I substitute t=1/freq

We know R (R=r1+r2), so we get
C=t/2000

In my test case, I get freq=2.25676kHz

that means that freq=2256.76Hz

So...

C=(1/2256.76)/2000
~0.00044/2000
~.00000022155 F
~.22 uF

The Cap I used was labeled 224J, which makes it a .22uF +/-10%
mikewitt
 
Posts: 111
Joined: Thu Jan 04, 2007 9:18 pm
Location: KB9YJY, Wilmette, IL

by adafruit on Sun Feb 25, 2007 8:34 pm

excellent work! :)

its a super useful idea, i will post it to my bloggityblogblog

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by mikewitt on Mon Feb 26, 2007 12:24 am

Thanks for the plug on your blog.

One quirk I noticed is that if there's no capacitor, it'll just put out a square wave at a frequency of about 1.7 mHz, which means that with these values for resistors, its theoretical limit is about 294 pF. In my playing around, there's noise (and lots of it) at anything less than .5 nF. Still, .5 nF is pretty good, and +9/-11 % accuracy is even better (assuming +/-10% resistors; with more accurate resistors, I'm sure it could become even more accurate). To measure smaller capacitances, increase r1 and r2 equally (it seems to be easier to measure that way), and compensate for for a new R, such that R=r1+r2.

I'll post some easy r1+r2 values later this week for different capacitance ranges.
mikewitt
 
Posts: 111
Joined: Thu Jan 04, 2007 9:18 pm
Location: KB9YJY, Wilmette, IL

by Olaf Marzocchi on Mon Feb 26, 2007 6:39 pm

What about a capacitance meter using an AVR? it could measure the voltage during the charge and then interpolate the capacitance value.
It could also automatically switch the resistors, to select the correct time scale for the specific capacitor. There are good digital trimmers, even with log scale.
Olaf Marzocchi
 
Posts: 73
Joined: Mon May 08, 2006 3:29 am

by mikewitt on Mon Feb 26, 2007 7:36 pm

Yep -- although you don't need to measure voltage across the cap, the 555 does that for you. This was designed to be used with an AVR, which is why I found the 555 so appealing, if you apply +5v as Vcc, you get TTL Logic levels at the output, so no ADC is necessary. I would measure frequency with one AVR(an ATTiny 13 or similar, that's what I have lying around, and am going to use to interface with it), and then spit out an SPI or I2C (or whatever) measurement of the frequency to the other AVR. (I need it to measure high frequencies, and so doing math on the measurement IC is out of the question).

I just got my programming dongle in the mail today, and will be able to start putting together a circuit later tonight. I'll post pics later (probably tomorrow night if all goes well).
mikewitt
 
Posts: 111
Joined: Thu Jan 04, 2007 9:18 pm
Location: KB9YJY, Wilmette, IL

by Olaf Marzocchi on Tue Feb 27, 2007 4:41 am

And then the second AVR could be able to show the reading on a LCD display? what did you plan to use?
Olaf Marzocchi
 
Posts: 73
Joined: Mon May 08, 2006 3:29 am

by mikewitt on Tue Feb 27, 2007 9:23 am

Yeah. I was going to use this for position sensing on a servo, and so I have to do lots of calculations. I don't really have enough time (in terms of clock cycles) to do lots of instructions on the AVR that reads cap. measurement, because of the speed of the 555 timer (I'll be using very small cap values, so it'll be oscillating fast, around 1 MHz) and so if another AVR processes the data while another just reads it, it'll go much more smoothly.

And I've had a setback, I need to find my 5.1v zeners before I can make the circuit with the AVR and the 555, so expect that later this week or next.
mikewitt
 
Posts: 111
Joined: Thu Jan 04, 2007 9:18 pm
Location: KB9YJY, Wilmette, IL

by Olaf Marzocchi on Tue Feb 27, 2007 10:58 am

Do you plan to make the circuit able to read up to 470 uF? I think this is a useful value, even if not in microelectronics circuits.

I look forward to see your circuit, I was just looking for one of them in the last days!
These were the most promising: http://elm-chan.org/works/cmc/report.html and http://cappels.org/dproj/nlglcm/Pretty% ... oject.html and http://www.talkingelectronics.com/html/CapMeter.html


P.S.: Mike, could you substitute that huge image with an imageshack/supload thumbnail? I don't have a wide-24" yet ;-)
Olaf Marzocchi
 
Posts: 73
Joined: Mon May 08, 2006 3:29 am

Please be positive and constructive with your questions and comments.