# Charging a capacitor with MOSFETs

I have this circuit:

simulate this circuit – Schematic created using CircuitLab

The idea is that a high at Vcharge will charge the capacitor and then a high at Vdischarge will discharge it. However, a high at Vcharge creates about 3.22V across the capacitor, which then discharges as soon as Vcharge goes low again. Why is this happening?

• Is V_discharge remaining low in all times? Jul 31, 2015 at 17:33
• The M1 part of your circuit is a 'source follower' configuration (the MOSFET version of a BJT emitter-follower). As such, your capacitor will never charge to more than Vsupply-Vgth, where Vgth is the threshold voltage of your MOSFET. Jul 31, 2015 at 17:37
• @brhans How can I change the circuit to fix that? Jul 31, 2015 at 17:52

...probably because Vdischarge is not low, e.g. just floating!?

BTW: You don't have any current limitation for discharging the capacitor.

EDIT: I guess actually your problem is that C1 is much to small for what you expect.
47pF is a incredible small capacitance and it discharges even with a 10MOhm resistor within some 1/10s of a Millisecond (47pF * 10MΩ = 0.47ms).
I don't know how you measure the voltage across C1 but I guess the instument (and the PCB or bread board) has a resistance that is in that order or even much less.

• Why don't I have a current limitation? I get the impression that more than 0.2A will damage the MOSFET Jul 31, 2015 at 17:51
• R1 affects only charging. Discharging C1 via M2 will be without any series resistor (though for such a small capacitor it probably isn't a problem as the total amount of energy is very small).
– Curd
Jul 31, 2015 at 17:55
• I was thinking in terms of charging. Imagine there's no resistor. When M1 is switched on about 1A of current will flow, which could damage the mosfet Jul 31, 2015 at 17:57
• If you think you need current limitation for charging, why do you think you don't need it for discharging?
– Curd
Jul 31, 2015 at 17:59
• thats what I guessed: 47pF --> 1000µF just a slight magnification of capacitance by factor 21000000 works wonders.
– Curd
Jul 31, 2015 at 19:53

Use a P-channel MOSFET to charge the capacitor and you can then tie the gates together (low = charge, high = discharge). The source follower configuration you currently have would require more like a 10V gate drive to work properly.

No resistor is necessary with 47pF, however there is significant capacitance in the MOSFETs (even the smallest ones you can find) that will cause the voltage across the 47pF to behave differently than you might expect.

There is a lot of literature out there on making analog switches that have minimum coupling. If you don't feel like re-inventing it all, search on "charge injection" and switch. Also consider the source-to-drain capacitances.

• Any idea why it discharges as soon as Vcharge goes low? The gate input of Vdischarge is grounded through a 10k resistor Jul 31, 2015 at 18:11
• Gate to drain capacitance is ~20pF so a 5V change at the gate will bring you down close to zero from 3V. Jul 31, 2015 at 18:17
• Any way to fix this? Jul 31, 2015 at 18:19
• Not easily, I'm afraid. Try RF BJTs or more exotic species. Or increase the capacitor 1000:1 if you can. Jul 31, 2015 at 19:13