Capacitor discharge circuit in modern multimeter

Thread Starter

q12x

Joined Sep 25, 2015
2,240
Hello to good people that know me.
- Do you know how a capacitor discharge circuit looks like in a modern multimeter?
I already tried a couple of circuits I could think of, but ... problems:
1-it needs to discharge an unknown charged capacitor to 0V on the + lead, lets say 1000 or 5000uF, which means a lot of charge or current stored.
2-then -compare- when is fully discharged at 0V (or close to it) and send a Hi to microcontroller pin, that in turn can start measuring, meaning charging the cap to a programmed value. Switch between discharging circuit to mcu testing pins when Cx is empty and safe.
3-resolve when Cx is not connected or when pads are floating.
What I've tried:
#1Screenshot_2.jpg

#2Screenshot_1.jpg
Thank you !
 
Last edited:
I praise your precaution of including a discharge resistor to limit the peak current. Otherwise capacitors with a large C*V product could weld the relay's contacts or overload the Mosfet.

Which DMM models have you seen that include this feature? I've not seen one myself, but suspect those would be ones with a Capacitance measurement function?
 

Thread Starter

q12x

Joined Sep 25, 2015
2,240
Which DMM models have you seen that include this feature? I've not seen one myself, but suspect those would be ones with a Capacitance measurement function?
All the DMM I have and can measure capacitance, they seem to do all the things I mention, but I never look or recognize the circuit inside them. All I can say is from observation. I think on the paper you got with the DMM, they mention to discharge the cap before testing, but I think they are referring to large capacity ones. But for low capacity, I have the impression they do it internally through a mosfet, but the circuit itself is a mystery. Even the GM328 ESR Transistor Tester, looks like it has it.
On some DMMs, when Im changing from 1 capacitor to another, is automatically recalculating the capacitance of the new one on the leads/pads, without me pressing any reset button. So that's another mystery circuit that Im very interested.
 

WBahn

Joined Mar 31, 2012
33,140
Some capacitance meters don't rely on measuring the time to charge to a threshold value. Instead, the use the capacitor as part of a timing circuit for an oscillator and measure the period of oscillation.
 

Thread Starter

q12x

Joined Sep 25, 2015
2,240
Some capacitance meters don't rely on measuring the time to charge to a threshold value. Instead, the use the capacitor as part of a timing circuit for an oscillator and measure the period of oscillation.
This is chatgpt idea, not mine and I like it and most surely I will implement it.
Suppose
Current = 100 µA
Voltage starts at 0V
Arduino starts a timer.
Voltage slowly rises.
When it reaches 1.000V the comparator interrupts the Arduino.
Timer stops.
The elapsed time is directly proportional to capacitance.

Example
100nF 100uA
Voltage target = 1V
t = C × V / I
=100nF×1/100uA
=1 ms

Arduino measured 1.001 ms

Display 100.1nF Done.

also chatgpt:
Most modern DMMs don't measure capacitance directly—they usually charge/discharge the capacitor with a constant current, measure the time, or measure the frequency shift of an RC oscillator.
So there are 2 methods !
But this is another subject. Lets concentrate only on discharging circuit or method. Because Im staying at it for a week already.
Either is Not easy or I dont see it.
 

WBahn

Joined Mar 31, 2012
33,140
You don't need to discharge the capacitor completely. Indeed, you don't necessarily need to discharge it at all. If you are using a constant-current method, you can theoretically start at any state of charge, measure the voltage, then apply the constant current and, after a fixed amount of time, measure the voltage again. The change in voltage is inversely proportional to the capacitance. The problem here is that the initial voltage may be such that the meter's constant-current source may saturate before the timer expires. Plus, some capacitor types have voltage-coefficients of capacitance, so it is best to start from a low voltage. But that's easy enough to do. Measure the voltage of the capacitor and, if it's above some low threshold, turn on a transistor switch with a current-limiting resistor and keep it on until the voltage falls below the threshold. Then start the measurement. This allows you to charge between fixed thresholds and measure the time, which is directly proportional to the capacitance, making the circuit much simpler.

You can also use first-order charging circuit and measure the time between two thresholds that are chosen such that a counter measuring the time between them is the value to be displayed.
 

Thread Starter

q12x

Joined Sep 25, 2015
2,240
You don't need to discharge the capacitor completely.
I think I do. Why? Because if the capacitor is say 100V charged, then all the voltage difference will fall on the very sensitive mcu measuring pins. And I want to avoid frying the chip, especially the mcu.
Now, there is another detail to what you say and I encounter it already and also mentioned into my images.
Screenshot_3.jpg
Thats why Im -comparing- at this very low voltage value and then set Lo when is under it.
So in a way, I already did what you say, discharged it to a comfortable minimum voltage value and start the measuring from there.
In my case is this 20mV, or it can be 500mV, as the starting low threshold. Charge it to+1V over, time it and reset the measurement while displaying the last result.
If its not what you meant, then reformulate.
 
Last edited:

panic mode

Joined Oct 10, 2011
5,225
btw, i see your circuit using 100V to charge caps. using such tester on cap rated for 6.3V or 16 V or 35V etc will cause it to explode. also i see no protection for your comparator. i STRONGLY suggest using Opamps to buffer lines going to your ADC, insert same kind of resistor + clamping diodes as shown here on comparator input. next, i see that you are driving bunch of relays from 5V using single NPN transistor in common collector. that has to be the least effective way to do so. specially with 10k base resistor. i would not be surprised that relays don't turn on at all. then there is a switch to GND on GPIO3. this will destroy the MCU if closed when output is high...

1789494975326.png
 

WBahn

Joined Mar 31, 2012
33,140
I think I do. Why? Because if the capacitor is say 100V charged, then all the voltage difference will fall on the very sensitive mcu measuring pins. And I want to avoid frying the chip, especially the mcu.
Now, there is another detail to what you say and I encounter it already and also mentioned into my images.
View attachment 371329
Thats why Im -comparing- at this very low voltage value and then set Lo when is under it.
If its not what you meant, then reformulate.
Read what I said. I said that theoretically, you could start at any state of charge, but that it is better to start near zero.

What is it, exactly, you are trying to do?

Why do you need to be connecting charged capacitors to your circuit?
 

Thread Starter

q12x

Joined Sep 25, 2015
2,240
Why do you need to be connecting charged capacitors to your circuit?
I want to make a 'simple' capacitor meter. But is not that simple.
From all my research so far, the measuring pins --indifferent-- of the capacitor value, can be directly the mcu pins !!!
This is my conclusion, my subjective observation and also my limited experience with this topic. It is my first project of this kind !
The tricky problem to solve that I stumble, is protecting those mcu pins from whatever charge that Cx might store.
So this is my solution how to build it.
Im very open to try a consecrated circuit, like I said, from a modern multimeter or old one, only to do its job.

using 100V to charge caps.
yes, that is the worst case scenario, also Cx is 1000uF. I have some High Voltage and High Q charge capacitor in my real stock. Sometimes I might get stupid and put one of those without discharging them with a piece of metal or a safe resistor. So I plan it first here.

i see that you are driving bunch of relays from 5V using single NPN transistor in common collector.
yes, I have small and big transistors for this task. Also I can change it to a mosfet. I did see it its from common collector, but I was preoccupied with the other logic in the cct. I kind of hurry this part, like a sketch, to formulate the idea.
(temporary) problem solved, I change it to a PNP.
1789497431574.png

there is a switch to GND on GPIO3. this will destroy the MCU if closed when output is high...
Not correct. If the pin is set as input, the code will expect Hi or Lo on that pin with no problem. But not higher than 5V for Hi.

clamping diodes on comparator input.
interesting. But I want those lines where Cx is connected to be as clean as possible of parasitic capacitance, because I want to measure down to 1pF. Thats the goal at least. I will insert these clamp diodes, no problem for now, but if in real test will be a problem.... Those are good for ESD from what I know, for the comparator input.
 
Last edited:

Thread Starter

q12x

Joined Sep 25, 2015
2,240
To clarify this module.
1789497694336.png
Cx is the capacitor in test.
The 'stuff' on top of it is only for the simulator, to charge the cap AS IF IT WAS charged in reality.
So after its finishing discharging, I can charge it again (here in simulator) to check again how the other logic circuit is working. This is exactly as I'm taking out and putting in a new charged capacitor on the testing pads or probes in reality.
Nothing more.
 

Thread Starter

q12x

Joined Sep 25, 2015
2,240
This is my real problem:
The Logic:
IF no Cx connected, LM393 output=Hi
Cx full discharged, LM393 output=Hi
IF Cx charged, LM393 output=Lo


I dragged the logic so far, but I can not see how to continue it from this point.
One possible solution that I think of, is like this:
Arduino is sending 10msON/100msOff pulses and checks if LM393 out is Hi 1ms after signal send.
This acknowledge a cap is connected, because the delay in response.
Im not sure for 1pF caps if it will work!!! - big dudu problem.

Thats why I added this -manual- part:
1789498620250.png
But Im sure it can be automated, Im not seeing it yet.
You see my dilemma?
Oh, and this is not chatgpt logic, its my logic, because he was running after its tail, literally, very annoying sometimes.
chatgpt is good, but with heavy filtering. But not at this stage im in now. Or I didnt had luck asking the right question.
Thats why I turn to bother the forums. Hehe.
 

Thread Starter

q12x

Joined Sep 25, 2015
2,240
What this part is doing?
Screenshot_4.jpg
It is disconnecting Cx from the mcu pins (A), but connecting it to the discharging 300R resistor (B), for discharging purposes.
When comparator see no charge left, that <20mV, its output goes Lo, signaling the line is at 0V, in a word.
Then its connecting Cx to mcu pins (A), but disconecting it from the discharging 300R resistor (B).
Practically what I did here, imagine I take Cx in my hand, discharging it through that 300R while mcu pins are floating, then putting it discharged onto mcu pins for measuring. All this but automated. This is what this circuit is doing. Very simple.
 

Thread Starter

q12x

Joined Sep 25, 2015
2,240
This other circuit with 1 mosfet, is the -simplified- circuit :
Screenshot_1.jpg
Because the same problem I have here as in the other larger circuit, with establishing when Cx is touching the pads, when is 0V, and when is charged with X voltage. Then somehow, the mcu figure it out, but the next part of the logic is in total BLUR for me at this point.
I think there is a solution but I dont see it (yet). I hope you catch my problem.
I have the impression Im over-complicating this thing somehow.
 

panic mode

Joined Oct 10, 2011
5,225
this is how OpAmp is used as a buffer with input protection. you can remove lower resistor to make output same voltage as input.
adding that resistor allows you to make input scale down such as 0-100V input gives 0-5V output.
and output can never be higher than Vcc even if input is connected to 150VDC but the input resistor will need to handle the power dissipated...
(150V - (5V +0.7V) )/200k = 0.722mA and some 105mW so 1/4W would do

1789496098085.png
 

panic mode

Joined Oct 10, 2011
5,225
Not correct. If the pin is set as input, the code will expect Hi or Lo on that pin with no problem. But not higher than 5V for Hi.
who said anything about GPIO being an input? you have resistor and LED there so i assume you want to light it up my MCU at some point (the only thing that makes sense). that means this pin will need to become and output/ and i explicitly stated that problem is when GPIO is working as output.

But I want those lines where Cx is connected to be as clean as possible of parasitic capacitance, because I want to measure down to 1pF.
you started topic with 1000-5000uF. so lowest capacitance i consider is 1000uF. maybe 100uF.... and after dozen of replies you are down to 1pF. that is a very extreme from 1000uF we are talking about 12 orders of magnitude different. if you want to measure small caps, take a look at cap meter by Roman Black.
 
Last edited:

panic mode

Joined Oct 10, 2011
5,225
What this part is doing?
View attachment 371339













Very simple.
unnecessarily complicated and wrong.
instead of using pairs of relays, should use single DPDT relay. and you also do not need two diodes per relay(s).
part A connects capacitor to ADC and blows up MCU when voltage is over 5V. part B turns off discharge resistor.
part C (missing there) is relay to charge capacitor.
also capacitor should not be connected directly to clamp diodes and comparator, there need to be high value resistor between them.
 

panic mode

Joined Oct 10, 2011
5,225
This other circuit with 1 mosfet, is the -simplified- circuit :
View attachment 371340
Because the same problem I have here as in the other larger circuit, with establishing when Cx is touching the pads, when is 0V, and when is charged with X voltage. Then somehow, the mcu figure it out, but the next part of the logic is in total BLUR for me at this point.
I think there is a solution but I dont see it (yet). I hope you catch my problem.
I have the impression Im over-complicating this thing somehow.
lets see, relay turns on and change capacitor. there is no control over charging, no current limit, nothing.
but we do get relay contact blown to pieces or in worst case welded shut. the 100V also destroys the comparator (which only goes to some 30-ish Volts) and BS170 (also not rated for high voltage). if the mosfet fails short, R14 blows up unless it is rated for 1kW or more.

i do not see why you need high voltage to do any of this unless you are doing destructive insulation testing.
you can control cap charge/discharge using constant current source. then you get nice linear response and knowing any two points on that slope should tell you what the capacitor value is. you do need it fully charged or discharged.
 

MisterBill2

Joined Jan 23, 2018
28,185
Clearly the this thread is about LARGE capacitors, with high values of capacitance.
There is a lot more to evaluate than just the actual capacitance, at least for all of my applications.
Leakage current is also important.
 

panic mode

Joined Oct 10, 2011
5,225
yes, leakage and ESR are the two very important values.
but before this thread gets there, measuring one parameter (capacitance) of those large caps would be nice. preferably without hurting anyone or blowing things up.
 
Top