Measuring the voltage drop across a capacitor with a subtractor opamp

Thread Starter

Cookieman10101

Joined Jul 18, 2019
22
Hi,

I am trying to build a circuit that will measure the voltage across capacitor and then divide it down so an A/D can read it (atmega 328p). i built the circuit shown and I'm 90% sure it was wired correctly. the capacitor was charging up to about 8 volts even when SW1 was disengaged. I cannot figure out where the voltage is coming from but it seemed to be a pretty low current because the charge up took around 10 seconds. Anybody have any insight to share?

EDIT: I've added the actual schematic now that i have access to it. I changed out the 1 k resistors R1-3 and R6 (annotation changed) with 100k because i was out of 10k's and also discovered i need the relay to switch out R5 ONLY, and keep the capacitor connected to R3, and it seems to work fine now.
Capture.PNG
subtractor.PNG
 

Attachments

Last edited:

Thread Starter

Cookieman10101

Joined Jul 18, 2019
22
Ahh I see where your going with that. It could be considered a scenario where the input impedance is too low and is "distorting" the input signal, although it is a little different because its seemingly the op-amp actually leaking into the signal. if all else fails i could probably place a diode between the 24V supply and R3, then just account for the 0.7V drop in the firmware. But I will try raising the resistors when I get home today.
 

Ian0

Joined Aug 7, 2020
9,621
Can you swap the positions of R1 and C1? Then C1 shares a common ground with the microcontroller so measuring the voltage across it doesn't need the differential amplifier.
 

Thread Starter

Cookieman10101

Joined Jul 18, 2019
22
That's actually the way i originally wanted to do it, but there's more going on in the circuit than is shown. I need to control the current limited charging of the cap separately from a non current limited charge. Q1 is Ntype and it has to be source grounded in this particular application because there will be high DC current flowing though it. it actually represents 4 power mosfets paralleled. i have to use a subtractor because i cant ground reference the cap directly without either compromising the high current mosfet switch OR the current limited charge. i also cant place a relay in the high current path because the current will be upwards of 170A, which is the reason i opted for a semiconducting switch.subtractor2.JPG
 

Thread Starter

Cookieman10101

Joined Jul 18, 2019
22
Oh in that new schem i accidentally connected r5 to the wrong side of k1. It should be on the cap directly because i need to know what voltage the cap is at even when the cap isnt charging or when Q1 is off
 

Audioguru again

Joined Oct 21, 2019
6,647
An input of an old LM358 has a maximum positive input bias current of 0.25mA which is charging the capacitor. 0.045mA is typical.
Why not use an opamp with Jfet inputs which have an extremely low input bias current? A TL081 is one of them.

Wait a minute! the maximum input bias current of 0.25mA in the 1k resistance of R3 would cause the capacitor to charge to only +0.25V and most opamps have much less input bias current (0.045mA is typical) so the charging voltage will be much less. You said the capacitor is charging to 8V which would need an opamp input bias current of 8mA which is impossible.

Did you buy a fake or defective LM358 from ebay?
Is R3 defective (from ebay?) and is actually about 80k ohms?
Is the switch or a breadboard (from ebay?) leaking 8mA?

EDIT: Now you show a completely different circuit that even has an error in it.
 
Last edited:

Thread Starter

Cookieman10101

Joined Jul 18, 2019
22
Apologies, i should've given the original schematic but i dont have a copy with me so i scraped a quick one together. when i get home i can post that in here. As far as the opamp. I used an lm358 purely because thats what i had on hand. The lt081 appears to have a max supply voltage that is lower than my supply. I can find another jfet based one im sure. Bottom line is i have a few things i can try now to alleviate this problem.
 

Audioguru again

Joined Oct 21, 2019
6,647
I said a TL081 opamp but you said LT081 that is completely different. Dyslexia?

The maximum supply for a TL081 is 36V but all its spec's are at 30V. It is usually used with a plus and minus power supply because in your single +24V supply circuit its inputs do not work below about +4V.
 

Thread Starter

Cookieman10101

Joined Jul 18, 2019
22
Whoops! honest mistake, i did find the correct datasheet on the TL081 though. under absolute maximum ratings it says 18V but then i found this:

"Supply voltages larger than 36 V for a single-supply or outside the range of ±18 V for a dual-supply can permanently damage the device"

somewhere down near the middle of the datasheet.

https://www.ti.com/lit/ds/symlink/t...19742&ref_url=https%3A%2F%2Fwww.mouser.com%2F

On another note, it would be nice to see below 4v, otherwise i would just switch out the charge circuit and at the same time, switch out the inverting input from the capacitor.
 

neonstrobe

Joined May 15, 2009
190
when measuring a capacitor it is important not to charge or discharge it inadvertently, as a low input impedance opamp will do.
Look up the "instrument amplifier" which uses three opamps but basically buffers the two inputs with a high impedance. Use JFET input opamps as others pointed out. Worst case, just add unity gain buffers to your existing circuit!
 
Top