The new Raspberry Pi B Model B+ is here - Pick one up in the store and check our detailed guide!

Capacitance Meter

by Len17 on Sat Sep 18, 2010 7:52 pm

Thanks to johngineer for posting my capacitance meter project on the blog. Here are some more details.

This is the finished project mounted in an Adafruit enclosure:
Image

More pics here

I got the basic idea from mikewitt here. It uses an oscillator circuit made from a 555 timer in astable mode. The frequency of the oscillator depends on the capacitor being measured. I have attached a schematic of the measurement circuit at the end of this post (LCD hookup not shown). Ladyada has a tutorial showing how to hook up the LCD and mount it in the enclosure.

Measuring the frequency is a bit tricky because it ranges from a couple of hertz up to a few hundred kilohertz. In the software I implemented two different methods to measure the frequency:
  1. Count the number of cycles in one second. This works well when the frequency is high, but if it’s low you have to wait many seconds to get enough cycles for an accurate estimate.
  2. Measure the time for a single cycle, in microseconds. This works well when the frequency is low.
My sketch tries method 1 (using the AVR chip’s Timer1 with an external clock) and if that doesn’t give a good result it uses method 2. The result is displayed on the LCD character display.

I used a proto shield, with a small daughter-board mounted above it to hold a pushbutton and a socket for the capacitor, so they fit in the holes in the front of the enclosure. (Photo)

Now, I don’t really know how accurate this capacitance meter is. I haven’t tried to calibrate it against a “proper” meter. It’s good enough that I can use it to read ceramic caps, instead of a magnifying glass. :) The main drawback is that it doesn’t work for values below about 1 nF. It can read smaller values if I use different resistors in the measurement circuit, but then it wouldn’t work well for large values (100 uF). I had to pick a compromise.

Parts used:
  • Diavolino Arduino clone from Evil Mad Scientist Laboratories
  • DIY shield
  • 16x2 character LCD
  • Arduino enclosure
  • LM555CN timer chip
  • 1k ohm 1% resistors (2)
  • Tactile pushbutton switch
  • Socket strip to plug in the capacitor being measured
Attachments
CapMeter2_schem.png
CapMeter2_schem.png (47.08 KiB) Viewed 4094 times
User avatar
Len17
 
Posts: 393
Joined: Sat Mar 14, 2009 6:20 pm

Re: Capacitance Meter

by Len17 on Sat Sep 18, 2010 8:01 pm

Here's the source code for the Arduino sketch.
Attachments
CapMeter.pde.txt
(7.95 KiB) Downloaded 521 times
User avatar
Len17
 
Posts: 393
Joined: Sat Mar 14, 2009 6:20 pm

Re: Capacitance Meter

by didier on Sun Dec 11, 2011 6:09 pm

Here is an alternative http://didier.longueville.free.fr/arduinoos/?p=2323. Enjoy :wink:
didier
 
Posts: 115
Joined: Mon Nov 17, 2008 5:14 am