loading

Capacitors are vital components in electronics, but sometimes they are broken, or the value printed on the cap has become unreadable. Because my multi-meter does not have a capacitance measurement, I decided to make one!

The principle of measuring capacitance is quite simple. The voltage of a capacitor charging through a resistor increases with time T. The time it takes to reach a certain voltage, is related to the values of the resistor and capacitor. In this project, we'll use a 555 timer circuit as a monostable multivibrator. If that sounds like some dark magic to you, don't worry, it's quite straightforward. I'll refer to the the Wikipedia page for the details, as we'll focus on the things we really need: the schematic and formula. The time in which the capacitor C charges through the resistor R is given by: T = ln(3) x R x C = 1.1 RC. If we know the value of the resistor and the time, we can calculate the capacitance: C = T / 1.1R.

Now we need a device for measuring the time, and that is where the Arduino comes in. The time is defined by the state of the output pin of the 555 timer (pin 3). It will be HIGH when the capacitor is charging, and LOW when it's not. This means the output generates a pulse with length T.
The Arduino will be connected to pin 3 and will be detecting the rising and falling edge (transition form 5V to 0V and vice-versa). By using the function micros(), we'll know how long the pulse is, and we'll calculate the resistance.

The value of the resistor can be chosen freely. We'll take 1 MOhm for measuring low capacitance (nF range), and 10kOhm for higher capacitance (uF range). Otherwise, measurements in the uF range would take ages.

Finally, the value of the capacitor should be displayed on a screen; I chose a 4-digit 7 segment display. Those displays need a lot of inputs, so we'll multiplex them to resolve this issue. Basically: we'll drive the displays one by one, but so fast that the human eye cannot notice. We'll also use a shift register to further decrease the number of Arduino pins we need. The shift register will read the data from the Arduino over 2 wires, and then drive the display through 8 wires. This is well explained here: https://www.instructables.com/id/Multiplexing-with-Arduino-and-the-74HC595/ .

I used an ATTINY 84 instead of a full-size Arduino uno, to save some space. For a detailed guide on how to program those, take a look at this great 'able https://www.instructables.com/id/Using-the-Arduino-Uno-to-program-ATTINY84-20PU/ . It's also possible to use a bare-bone Arduino by only using the chip.

Ultimately, to power the build, I used a 9V battery and voltage regulator (LM317).

Step 1: Parts List



• IC's


• ATTiny 84 or 44 (16 pins)
• 555 timer chip
• Shift register (74HC595)
• 5V voltage regulator (LM7805) or LM317



• Resistors


• 220R x9
• 470R x4
• 10k x3
• 1M
• 1k (only for LM317)
• 330R (only for LM317)



• Capacitors

• 100nF x2
• 1uF (only for LM317, 100nF otherwise)
• Random for measuring



• Other

• Red LED
• 4-digit 7 segment display (common anode), or seperate units with 1 or 2 digits
• NPN transistor x4
• Pushbutton
• DPDT switch
• 9V battery connector
• 9V battery





Total price < €10

Step 2: Code, Build & Test

The code is quite easy and small enough to fit on an ATTINY 44 or 84. If you want to make some modifications, be sure to keep the size in mind, as the ATTINY 44 can only store 4kB.

The loop does 3 things:

  • Detects when the output pin of the 555 timer goes HIGH, records the time and resistor value
  • Detects when the output pin goes LOW, records the time
  • If the pulse is over, calculates C and displays it

To display the number, it is first spliced into digits, and then displayed one by one. This is achieved by sending the right code to the shift register and activating the corresponding transistor, to allow the current to drain through the desired display digit.

The bytes for the numbers, defined at the beginning of the code, can be determined with the drawing of the digit. The reason I opted for this numbering scheme, which may seem quite strange, is because it was the easiest way to wire everything. I simply put the shift register next to the display and connected the adjacent wires. If your display has a different pinout, it may be handy to change the numbering scheme, and bytes.

For determining the resistor value, a 2-pole switch is used. 1 pole switches the resistor from 10k to 1M, while the other pole switches from 0V to 5V respectively. This logic level can be used by the Arduino.
We'll also light an LED while measuring.

The trigger for the 555 timer, is generated by the pushbutton. The pin is held HIGH by a pull-up resistor, pulled LOW by pressing the button, then goes HIGH again. This is the trigger for the 555 timer to start the measurement.

Try the circuit on a breadboard first, and assure it's working. You may need to change the internal clock to get the right value. When using the wrong MHz setting, your results will be completely wrong.

Now it's time to solder everything on a perfboard. Simply replace the capacitor indicated with "???" by some female header pins, so it's easy to insert the capacitors. Making your own PCB is also perfectly possible, I included the file with the schematic in Fritzing. After that, the only thing left to do is measuring some capacitors!

My results were quite accurate and it works great. For even more accuracy, you could use an external crystal instead of the built-in clock of the ATTINY or ATMEGA chip. One more thing would be the use of interrupts to detect the rising and falling edge, but I couldn't get that to work on the ATTINY. If you know how it's done, feel free to leave it in the comments!

To start a measurement, insert the capacitor in the header pins (remember to respect the polarity when measuring electrolytic capacitors), set the measuring range (with the 2-pole switch) and press the pushbutton.
Enjoy your home-made capacitance meter!

<p>Hi! I been working on this one now. But well I decided to use a full arduino since programing my Atmega 8 takes a lot of time setting it up. Now, where are the pins associated from the attiny will be on the arduino? <br><br>Although I found the analog pins from both of them but still, I don't know if I connect the pins right. My meter won't work.</p>
<p>In this pinout diagram you can see which pins of the atmega328p (the one most commonly found on arduino uno boards) correspond to the pins you use in the code. Good luck!</p>
<p>Do you use any analog pins? In attinys, a digital pin can be a analog pin, like &quot;pin 0&quot; to &quot;pin 7&quot; from attiny 84.</p><p>Although I found out that the code only uses the pins as digital</p>
<p>Only digital pins are used for input and output</p>
Hi, thanks for the feedback. <br><br>I looked into your remarks, and apparently I made some mistakes in the schematic. <br>Pin 10 of the 595 needs to be connected to Vcc and pin 13 to GND indeed. <br>As for the 7 segment display, the actual pinout is in the figure, but I will correct it on the schematic. This was a tricky component because the physical pins will map differently to the display segments for other types of 7 segment display. <br>The switch I used was a DPDT, as can be seen in the parts. To avoid a cluttered schematic I used 2 switches instead. <br><br>The 2313 would be a great idea, but my electronics store didn't have them so I went with these components. <br><br>I hope you liked the build :) <br>
<p>Hello!<br>Built it and fixed a couple of mistakes.<br>First of all, for the circuit to function you need to tie 595's OE (13) to ground and MR (10) to VCC. Without that, it didn't function for me and it doesn't seems it'd function for you either.</p><p>Second thing - some disambiguation about 7-segment wiring would be great, both in the firmware and on the wiring diagram - they do not correspond to each other. Hardware diagram describes tgfedcba layout (t is the dot), but in the firmware it's btcgdeaf =) (I mean, there's no way dot bit mask is B01000000 if the dot is connected to Q0 of 595.) I understand it's hard to explain how exactly this part has to be suited to wiring choices made, but it's worth a mention because it's one of problems people will likely encounter.<br><br>Third thing - there are actually 2 2-pole switches in the schematic, one connects the range resistor and one &quot;tells&quot; the MCU which of the resistors is connected (resistorPin). It even makes sense to use a DPDT, so you only use one switch for range changing instead of two.</p><p>Other than that, great device! You could optimise some operations to make it fit on a 2313, since it's cheaper and more accessible (you could also use additional pins and add a crystal), but it's great this way too. Thank you!</p>
<p>Hey pretty damn awesome!!! I'm looking forward to build this on my birthday (which is TWO DAYS from now!) and I think I'm having problems with that Attiny IC.</p><p>Can I use Attiny2313 instead? Although this might not work (is does not have ADC for analog) Well, we can have the ATMega, but what code it should have? (ATMega8L, 128, 169, etc, you get the picture...)</p><p>I hope my local store called &quot;Alexan&quot; has Attiny44/84 so the problem's solved. ;_;</p>
<p>Thanks! The Attiny 2313 has not enough memory for the program, the 4313 should work; because you don't need the ADC. I wish you good luck with the build and a happy birthday :P</p>
<p>There's a 1&micro;F capacitor in the parts list, but nowhere in the schematic.</p>
<p>That's when using the LM317, you should take a 100nF for the LM7805.</p>
<p>great job</p>
<p>Thanks! </p>
<p>Hi. Just curious as to what the range of capacitance you can measure with the design as it is? I'm especially wondering about the low end. I know that you cannot make the charge resistors (R2 and R3 in your circuit) arbitrarily large, because the 555 needs to have some minimum currents into pins 2, 6, and 7.</p>
<p>It works from 9999uF (limited by the display) to about 10nF. When I go lower than that, the pulse becomes too short to detect reliably. I guess 10M Ohm would also be possible, but I don't need those low caps very often.</p>
<p>Thanks, Thomas. 10nF is 0.01uF, which is actually a pretty big cap. I guess that is not surprising for this 555-based concept. For measuring smaller capacitors, in the 10pF to 1000pF range, some other technique would be needed. Anyway, this is an interesting Arduino project. Thanks for posting it.</p>
<p>It was just about the accuracy. Measuring lower capacities was possible, but not as accurate. I just tried with a 10M Ohm resistor, and that worked fine in the 10pF range. So you can easily adjust that if you want :)</p>
Very interesting
<p>The display function and timing can be done more easily with an 18pin microcontroller. And it wouldn't really be a technological leap because you already use one for the timing part.</p>
<p>I know, but I hadn't laying one around and wanted to use an ATTINY :) Maybe I'll make another one with a bare-bone Arduino.</p>
<p>It's impressive what you archive with only basic components. If my mutimeter wouldn't come with a capacitance measurement function I'd build this, for sure!</p><p>Concerning the interrupt: I'm not familiar with arduino code, so I can't tell you exactly what libaries and code you need. However I know that the attiny84 has only an interrupt capability on pin 5 (PB2), so you'd need to rewire that pin. At second thought you might want to better use the ICP (InputCaPture) interrupt, wich IS available at pin 7. The advantage is that on a trigger event the current valueof timer 1 will be copied into a special register, which makes all sorts of timing measurements extreme simple and very precise. Good luck with this!</p>
I have a fluke 83 multimeter and I can't get the capacitance measurement to measure over 10 uf. Is this normal since the fluke isn't sending a whole lot of voltage/amperage through the capacitor and it will just take a very long time to charge up or is it something wrong with my meter? I have two of them and tested both with the same result, any ideas? Would a dedicated capacitor checker like this work more quickly?
<p>Like nqtronix mentioned, your Fluke is not able to measure higher capacities. Mine works perfectly with higher capacities, although it takes a bit longer to measure large capacities. 100uF takes around 1-2 seconds, but for 1000uF it took 12 seconds. You could change the 10k resistor to 1k, which would divide the time by 10, if you plan on measuring many high capacity ones. </p>
<p>just add a rotary switch for 100, 1K, 10K, 100K, 1F with the needed ohm value for each.</p>
<p>Great idea! You just need to take a 2-pole rotary switch then: the Arduino/ATTINY also needs to know what resistor is selected.</p>
<p>According to its datasheet (http://assets.fluke.com/manuals/83_85_87smeng0500.pdf) it should be only ablle to measure zp to 5uF, so I guess you'll are lucky to get measurements up to 10uF.</p><p>I haven't worked fith 555 timers that much, it tend to do all the timing in software if I use a MCU anyway, but I'm guessing the charging time will be about 2 RC constants, 2*10000(OHM)*0.00001(F) = 0.2 seconds for a 10uF capacitor. Decreasing R3 should speed up the charging further. ThomasVDD might be able to give you a better insight.</p>
This looks excellent and very well done. I think I might try to make this using an atmega chip instead of the tiny because that's what I've got on hand and I've never used the tinys. I think I'll also try to design a PCB using fritzing for this and set it up as a permanent unit with a proper housing. The only thing I don't have on hand is the seven segment LEDs.
<p>Thanks! You could always use a small lcd screen instead, since you'll use an atmega chip. Good luck!</p>
<p>That's a good idea as well but I went ahead and ordered some 4 digit led displays. I have double sided copper board, the atmega chip, the shift register, the 555 timer, plenty resistors, capacitors and hopefully enough transistors to go ahead and put this together. Just have to adjust for the atmega and 4 digit display, and that&quot;ll take me a while to plan out because I'm really just an amateur hobbyist.</p>
<p>You can use the included fritzing file, and change the ATTINY into an Atmega chip there. It's free software and it works great, so that shouldn't be an issue. Praise yourself lucky to have a 4 digit display, that saves a lot of wiring :D Good luck with the build!</p>
<p>great projest,i want to build this</p><p>will an arduino 328 uno work instead,if so,does it need different codes?</p><p>and could I replace the lm317 with a 7805?</p>
<p>It works perfectly with an Arduino uno, the code should not be changed for that. You could use the chip only, to save some space, and the cost of the whole board.<br>The 5V voltage regulator mentioned in the schematic is indeed an LM7805. I added it in the parts list :)</p>
<p>soldering diagram is not clear there are 14 resistors in your project which are not mention in schematic diagram please upload a complete schematic diagram</p><p>thanks</p>
<p>I fixed the oversight. The current limiting resistors for the LED displays and transistors are now added. That makes a count of 12. The other 2 are only for the LM317, and in the schematic I used the LM7805 5V regulator for convenience, so the resistors are not needed there. If you want to know more about the LM317, and how to wire it, this is a great site: <a href="http://www.reuk.co.uk/Using-The-LM317T-To-Regulate-Voltage.htm" rel="nofollow">http://www.reuk.co.uk/Using-The-LM317T-To-Regulate...</a> <br>Cheers</p>
Nice instructible. Thanks.
<p>This instructable is very useful !</p>

About This Instructable

29,795views

432favorites

License:

Bio: I study (civil) electronics engineering at the VUB in Belgium. I have a passion for making things, both useful and cool.
More by ThomasVDD:DIY Breadboard Lego Battery Pack Boost Flashing Led Earrings 
Add instructable to: