# RC switching using MOSFETS question

#### Kkein

Joined Jun 10, 2011
46
Hi Guys,
Need your help. I'm trying to switch on and off two MOSFETS to charge and discharge a capacitor. The problem is the capacitor does not charge to full voltage of 30V for some reasons. Instead it charges to 2.93V and discharges when the other transistor is on. Circuit is shown. But when I use only one mosfet, the capacitor charges to 29.7V which is close to 30V. What is the problem here. Can anyone help please. Appreciate.

#### Attachments

• 157.8 KB Views: 56
• 63.3 KB Views: 40

#### Jony130

Joined Feb 17, 2009
5,435
PE0 voltage is equal to ??
And replace Q3 into P-channel MOSFET (source at RCS ; drain to CL)
Also move RC resistor from Q4 source to Q4 drain. And connect Q4 source directly to ground.

#### Kkein

Joined Jun 10, 2011
46
Hi Jony130,
PE0 is a 0/5V square wave
PE1 too is 0/5V square wave

#### Kkein

Joined Jun 10, 2011
46
Oh I see. Thanks, Jony130. So the solution is to use a P-channel mosfet for Q3 and N-channel mosfet for Q4?

#### Jony130

Joined Feb 17, 2009
5,435
So the solution is to use a P-channel mosfet for Q3 and N-channel mosfet for Q4?
Yes, but using P-channel mosfet will complicate the "driver". Because you also need to add NPN transistor.

#### Attachments

• 7.2 KB Views: 37

#### Kkein

Joined Jun 10, 2011
46
Jony130, Thanks. I finally got it working with your suggestion. However, something doesn't seem right with the current (see attached). As the voltage across the fully charge capacitor is 30V and the discharging resistor being 20ohms and Mosfet Rds_on of 0.03 ohms, I would expect that the current flowing through the RC circuit to be 1.5A, thus a voltage of 1.5V across a 1ohm resistor connected in series i.e. I=V/(RL+Rds_on+Rs). But that's not what I'm getting. Instead I'm getting for 0.11A. Why is that? Anyone experience this before?

#### Attachments

• 48.9 KB Views: 29

#### Alec_t

Joined Sep 17, 2013
13,219
The Rdson of 0.03 Ohms is for a Vgs of 10V. You have only 5V Vgs, so the FET won't be switched fully on and will have a higher Rdson.
You need either 'logic-level' FETs or a level-shifting driver stage for the gates.

#### Jony130

Joined Feb 17, 2009
5,435
Jony130, Thanks. I finally got it working with your suggestion. However, something doesn't seem right with the current (see attached). As the voltage across the fully charge capacitor is 30V and the discharging resistor being 20ohms and Mosfet Rds_on of 0.03 ohms, I would expect that the current flowing through the RC circuit to be 1.5A, thus a voltage of 1.5V across a 1ohm resistor connected in series i.e. I=V/(RL+Rds_on+Rs). But that's not what I'm getting. Instead I'm getting for 0.11A. Why is that? Anyone experience this before?
As I told you already you need moved RL and Rs resistor to Q4 drain.
And connect Q4 source directly to ground

#### Jony130

Joined Feb 17, 2009
5,435
The Rdson of 0.03 Ohms is for a Vgs of 10V. You have only 5V Vgs, so the FET won't be switched fully on and will have a higher Rdson.
You need either 'logic-level' FETs or a level-shifting driver stage for the gates.
Notice that RL RS is connected between Q4 source and ground.

#### Kkein

Joined Jun 10, 2011
46
Gentlemen,
Thanks for your help. However, I couldn't get it working due to "time step too small" error when I moved RL & Rs to Q4 drain. I tried building a non inverting driver circuit and use a switch to switch ON & OFF, but the annoying error won't go away. However, when I leave both resistors on the source side of Q4, the error goes. What's the problem? Help please!!! Appreciate it.

#### Attachments

• 84.8 KB Views: 26

#### Jony130

Joined Feb 17, 2009
5,435
Can you upload the simulation file ? Try zip it first or change .DNS into txt.

#### Kkein

Joined Jun 10, 2011
46
Jony130,
Here it is mate. Thanks for your help.

#### Attachments

• 14 KB Views: 25

#### Jony130

Joined Feb 17, 2009
5,435
Simply change Q1 to BUZ10 and error will magically disappears.
Also notice that MOSFET Vgs_max = 24V but in your circuit from post 7 Vgs is 30V because you skipped one resistor connected between Q2 gate and Q3 collector.

#### Kkein

Joined Jun 10, 2011
46
Many thanks Jony130 and those who have assisted. It's kinda working now.

#### Jony130

Joined Feb 17, 2009
5,435

#### Kkein

Joined Jun 10, 2011
46
Hi Jony130,

Yes I have included the resistor as suggested - here is the circuit attached.

Also, is there a solar pv cell model that I can use instead of the battery to do the simulation in Proteus ISIS. I was trying to make one with diode and control current source but it won't work. The idea is to charge the capacitor using a solar pv model and then discharge the capacitor.

Thanks.

#### Attachments

• 50.1 KB Views: 21
• 50.8 KB Views: 23

#### Jony130

Joined Feb 17, 2009
5,435
Yes I have included the resistor as suggested - here is the circuit attached.
Looks good.

Also, is there a solar pv cell model that I can use instead of the battery to do the simulation in Proteus ISIS.
Try this circuit (Q5, R9 , R13, D3)

I was trying to make one with diode and control current source but it won't work.
This circuit wont work because you don't use F1 properly and D1 model is not right.

#### Kkein

Joined Jun 10, 2011
46
Jony130, Thanks once again. I tried that circuit but for some reasons, I could not get hire voltages.

I have tried another solar pv circuit as attached. It works but the current and voltages are negative! How I can reverse things to positive?

#### Attachments

• 67.7 KB Views: 19

#### Jony130

Joined Feb 17, 2009
5,435
You need to change the the direction of 1A current source.
And also try to use this diode model
.model PV_Panel D(Is=10n Rs=.5 N=77.06 Cjo=10n M=.5 Eg=85 Xti=230 BV=30 IBV=.001 Vj=.4 Iave=1 Vpk=30 mfg=Generic type=PV)