[Analog Electronics] Capacitor Measurement circuit - Page 1
Forum section: electronics / beginners

author: Belquay Neust
author_rank: Newbie
timestamp: March 04, 2020, 12:50:56 pm
content: Hello!I want to build a circuit that can measure a capacitor. In that case I have used a REF102 and LM358 as (as much as it possible) precision current source. I want to measure between for example 1nF to 10uF. I want to make it as simple as it possible, and for now I want to receive a linear load voltage on capacitor, but I am receiving a exponential slope with a knee over 63%. What can I do to make it more linear?

author: fcb
author_rank: Super Contributor
timestamp: March 04, 2020, 01:36:00 pm
content: If you charge/discharge a capacitor with a constant current you will get a constant slope ramp. So I'm assuming you are measuring the time to go between two voltages?What voltage is V+? Which voltage does the 63% relate to?

author: Wimberleytech
author_rank: Super Contributor
timestamp: March 04, 2020, 01:44:00 pm
content: Quote from: Belquay Neust on March 04, 2020, 12:50:56 pmWhat are you using for V+ of the REF102?As the capacitor charges up, you are probably losing headroom for the REF102, so it is no longer regulating.

author: Belquay Neust
author_rank: Newbie
timestamp: March 04, 2020, 02:29:03 pm
content: You are talking about Quiescent Current, but I am talking about current from OP AMP, that I have in my circuit. From this datasheet is completely possible to make 1uA current source, but I can't get a constant slope ramp with about 8uA from LM358.On REF102 I have +5V.It is reacting like I would connect a capacitor to 500k resistor and 10V. Or maybe someone have a hint how should I build a stable current source for capacitor measurement if I am wrong with REF102?

author: Wimberleytech
author_rank: Super Contributor
timestamp: March 04, 2020, 02:36:08 pm
content: Quote from: Belquay Neust on March 04, 2020, 02:29:03 pmAt T=0, 5 volts on pin 2, 0 volts on pin 4, 10 volts on pin 6? Nope

author: rstofer
author_rank: Super Contributor
timestamp: March 04, 2020, 02:48:19 pm
content: Analog computers make a stable slope all the time, it's all part of that integration thing.Consider an op amp configured with dual 15V supplies (for now), a 1 ufd capacitor in the feedback path instead of a gain resistor and a 1 Mohm resistor to the inverting input. Ground the non-inverting input.Start with the input to the 1 Mohm resistor equal to 0V. Now set the input voltage to +10V. Exactly 1 second later, the op amp output will be -10V and the ramp down will have been linear. That's because Tau (=R*C) is 1 second (10-6Farads * 10+6Ohms => Tau = 1 second)https://www.electronics-tutorials.ws/opamp/opamp_6.htmlThere are other ways to make a linear capacitor charge circuit but this is the one I am familiar with. I like analog computing!You don't need a linear charge voltage, all you need to do is change the voltage (as a % of operating voltage) over some period of time and then fit the time and voltages into the charge equation.Vout= Vin* (1-e-t/Tau) + V0So, the initial voltage goes into V0and is usually 0V, Tau is what you're trying to determine because you get Tau = R*C and you know R. Vin, Vout and t. A little ugly arithmetic and you're there.https://www.picotech.com/library/experiment/capacitorYou know that in 1 Tau seconds, the capacitor will charge to 63% of the input voltage, starting from zero. Substitute t = Tau in the equation above and you get Vout= Vin* (1-e-1) + V0with V0= 0. This results in 0.632 or 63.2% of the input voltage in 1 time constant.I have attached a charge plot where I am hitting the capacitor with a square wave.The Internet is full of capacitor measuring projects, try Google.

author: fcb
author_rank: Super Contributor
timestamp: March 04, 2020, 02:48:46 pm
content: REF102 minimum voltage is 11.4V, with your design you'll need at least 15V.

author: Wimberleytech
author_rank: Super Contributor
timestamp: March 04, 2020, 05:17:28 pm
content: I have built a capacitor tester using the method described by rstofer. I used an arduino. It worked well.I can understand the desire to use a constant current even though it is not necessary.

author: rstofer
author_rank: Super Contributor
timestamp: March 04, 2020, 06:38:58 pm
content: Quote from: Wimberleytech on March 04, 2020, 05:17:28 pmUsing an Arduino allows for automated selection of charging resistors.Here is the Digilent Impedance Analyzer for the Analog Discovery 2 (a very cool gadget)https://store.digilentinc.com/impedance-analyzer-for-analog-discovery/If you skip down the page, on the right, there is a link to the schematic and you can see where relays are used to select decade values of resistors (upper right of schematic).https://reference.digilentinc.com/_media/reference/instrumentation/analog_discovery_impedance_analyzer_sch.pdfBy using small relays, they get away from the issues related to driving MOSFETs as well as having to account for voltage drop across the MOSFET. Pretty clever!I could see doing something similar with an Arduino but like everything else related to Arduino applications, it has already been done and the project is on the Internet:https://www.arduino.cc/en/Tutorial/CapacitanceMeterGoogle for 'Arduino capacitor tester' without the quotes

author: Wimberleytech
author_rank: Super Contributor
timestamp: March 04, 2020, 06:58:52 pm
content: Quote from: rstofer on March 04, 2020, 06:38:58 pmThat is what I did. Two values. Should have been more to handle a wider range of caps. This effort was a teaching exercise. I gave the problem to a kid I was teaching electronics and programming. Every exercise I gave him, I had to solve myself.When switching resistors, I set one (port) as output and tristated the others. Lived with whatever VDS there was associated with the output drivers.This was a great project for the kid because lots of different things can be learned.

author: Belquay Neust
author_rank: Newbie
timestamp: March 06, 2020, 08:55:54 am
content: Ok, I have changed my voltage to +15V and -5V. I've got a little better results, but still it's impossible to measure 10nF. I do not want to use arduino, because my project is on STM32F103VC, but I don't want to fixing measurement in firmware, because I do not believe that resolution of ADC should work correctly. Now I have:for 10nFfor 2uF

author: Zero999
author_rank: Super Contributor
timestamp: March 06, 2020, 11:35:06 am
content: If you want to measure the capacitance, there are easier ways to do it. How about a simple Schmitt trigger oscillator? The output frequency is inversely proportional to the capacitance. Use a low a comparator with a push-pull output stage, such as the MCP6561 or TLC3702 to make life easier.If the correct values of R1, R2 & R4 are selected, then F = 1/(RC), to within 1% and even rounding R4 to 150k will give a closer tolerance, than most capacitors.

author: fcb
author_rank: Super Contributor
timestamp: March 06, 2020, 12:20:52 pm
content: Quote from: Belquay Neust on March 06, 2020, 08:55:54 amIf you are using the diagram in post#1 with V+ now +15V, you will only get a reliable reading up to 15-11.4V=3.6V or thereabouts. Read the REF102 datasheet.Probably wise to post more details about the exact setup you are using, ADC sample rate, desired accuracy, schematic etc..

author: Belquay Neust
author_rank: Newbie
timestamp: March 06, 2020, 02:12:55 pm
content: I have solved my problem by Instrumentation AMP, no Arduino and no comparators. On my output i have 7.8 uA and linear response. Now I can easily calculate this by firmware. Ok, now I will go on. Thanks for your good faith and fast reaction.

author: Wimberleytech
author_rank: Super Contributor
timestamp: March 06, 2020, 02:17:11 pm
content: Quote from: Belquay Neust on March 06, 2020, 08:55:54 amYou are still not giving enough headroom to the REF block. I think you need to change your architecture.Maybe something like this. Get a matched pair for the PNPs but you can test the concept with discretes.

author: fcb
author_rank: Super Contributor
timestamp: March 06, 2020, 04:23:58 pm
content: Quote from: Belquay Neust on March 06, 2020, 02:12:55 pmI still don't think you are understanding the limitation with the REF102 V+ rail.All you've done is added a $5 amplfier with a gain of 3.Apart from the gain of 3, this really gives you nothing extra over the reading the OUT on the LM358.

author: Zero999
author_rank: Super Contributor
timestamp: March 08, 2020, 07:07:19 pm
content: Quote from: fcb on March 06, 2020, 04:23:58 pmYes, the same result can be achieved by using the other half of the LM358, as a non-inverting amplifier with a gain of 3.