TransWikia.com

Why PWM does not regulate voltage across MOSFET?

Electrical Engineering Asked by pooya13 on November 29, 2020

I am trying to control a DC voltage using pulse width modulation (PWM) and an N-channel MOSFET. The way I have set up the circuit is as follows:

enter image description here

However, instead of the motor I have a 100K resistor, in parallel with a 100microfarad (25V) capacitor in order to smooth out the voltage. I am measuring the voltage across this resistor to check if it is being regulated or not:

enter image description here

I am powering the load from the same Arduino (for the time being. I will power it with an external battery once I get PWM working). I have the following code running on the Arduino:

int pwmPin = 3; // connected to the MOSFET's gate
int val = 128;  // set between 0 and 255

void setup() {
   pinMode(pwmPin, OUTPUT);
}

void loop() {
   analogWrite(pwmPin, val);
}

However no matter what I set the value to, I see the output voltage to be the same value of 4.99V instead of being proportional to the duty cycle. This changes as I get very close to 0 (when val=10, V_out = 4.33V and when val=0, V_out = 0V).

Why is this happening? Is the transistor not fast enough? Is the capacitor not big enough? What am I doing wrong? Below are the datasheets for the components:

Transistor (TO-220)

Diode

Sorry if the post has become wordy. I have been downvoted in the past for not including enough details with my post (because I wanted to be concise) and now I am being cautious.

Any help is much appreciated!

Edit: Please disregard the values on the diagram. I have wired my circuit as shown but for the values, as explained in my post I am using the Arduino to power the load. Meaning that the positive pin of the load is connected to Arduino’s 5V and the black line in the diagram is connected to the ground of the Arduino. (I did not make the diagram myself and I was myself confused about the 0-60V+ and 0-60- notation, I’m assuming it means the 10K resistor was chosen such that such a range of values would not damage the circuit) I have also included the datasheet to the specific transistor I am using. Thank you for the answers so far.

3 Answers

Of course you get 4.99V. Why wouldn't you? There is nothing that would cause the behavior you're expecting. What you're expecting is for the output to behave as if it had been filtered through a low pass filter, and actively discharged through said filter according to the PWM duty cycle, not simply charged. With a negligible load attached.

If all you have is a capacitor and small parallel resistor with the ground line being switched by the MOSFET, duty cycle will not have any effect on the voltage.

When the MOSFET turns on, the capacitor (having fairly low ESR) will charge as fast as it possibly can - much much faster than 100KΩ will discharge it. By my estimates, assuming the capacitor has an ESR of 1Ω (a bit on the high side but not unusual for a small aluminum electrolytic capacitor), even at 1/256th duty cycle, it will charge up to 4.99V in about 40ms.

Your setup is not a filter, but essentially a peak detector. It will always charge to a voltage that is the peak voltage it sees. Duty cycle will not change this voltage, just how long it takes to reach it (which at the lowest duty cycle is in about 1/25th of a second).

If you want the voltage to vary with duty cycle, you must:

  1. Use a low pass filter
  2. Charge and discharge the capacitor through that filter, with PWM on/off corresponding to charge/discharge of the capacitor.

The simplest low pass filter is a resistor in series with a capacitor. If we let the capacitor be passively charged by connecting it through a high value series resistor to +5V, then we can connect the MOSFET so that it will discharge the capacitor when the output pin is HIGH like so:

enter image description here

The 330Ω resistor is to limit the current from the power supply through the MOSFET. But that, along with the low pass filter formed by R1 and C1, should give you a voltage that more or less varies with duty cycle.

This is of course impractical for anything beyond simple 'analog out' type applications. You can't use this to vary the voltage for any meaningful load.

If you want something more like a variable output power supply, it cannot be done this way. That requires active regulation (since you will have a variable load) as well as using an inductor instead of the resistor (since any series resistor will dissipate far too much power while limiting the current), using a diode etc.

In other words, making a buck converter. But that's out of scope.

Correct answer by metacollin on November 29, 2020

This is not an answer but if you understand impedance ratios or a switched voltage divider, this should lead you think about your results and understand why.

Instead of 100K Resistor try an 8W bulb or a small motor or 10 Ohm 1W resistor.

Using semiconductors as switches for PWM:


Average Resistance = ESR/d for duty cycle d and ESR means RdsOn or Rce for MSOFETs or BJT's the incremental resistance. But Dual transistors have the effect of 1 then 2 PN junctions add to the ESR. (more on this later .. see graph)

A Mosfet has RdsOn which requires usually >=2.5x Vgs(th) to switch on the internal resistance.

A BJT requires Ib = 10% of Ic to achieve the Vce(sat) spec. A dual BJT (Darlington) requires Ib = 0.4% of Ic for Vce(sat) up to 3A and 20mA@5A

This implies to efficiently saturate the switch you need to overdrive it implying the current gain is reduced to 10% of hFE.

Although the Ic is somewhat nonlinear, there are linear sections of collector-emitter, Rce or Effective Series Resistance , ESR that are useful to remember.

ESR = Rce = ΔVce/ΔIc between two points on the curve.
Extrapolate the tangent to read the slope.

TIP 120 , for Ic < 1A Ic = 0.7V+0.1*Ic (Rce=0.1 Ohm)

If the Motor coil DC resistance or DCR is >> 0.1 Ohm and this V+/(Rce+DCR) is less than 3A then it should work with the understanding the Vce =2V @3A is significant.

So the supply may need to be 2V higher than the motor rated voltage for max RPM. This is not the case when using a very low RdsOn part which may cost a bit more. RdsOn << 100 mOhm is very common in SMD parts which dissipate less heat and easier ('C/W) in a smaller case size. enter image description here

Answered by Tony Stewart Sunnyskyguy EE75 on November 29, 2020

Your 100K resistor is not conductive enough to meaningfully discharge the capacitor during the gaps in the PWM waveform. In effect, it merely "holds the peak" of the applied voltage. If you used something like a flashlight bulb as a load, you might start to see a time average matching your expectation.

It's also a bit unclear if you are measuring across the capacitor, or between the always-high side of the capacitor and the unswitched ground.

You also seem to have mis-labeled the lower side of the load power supply - that should probably be "ground" not "5-60v -"

Finally the TIP120 is a Darlington transistor, effectively a dual-stage Junction Transistor, not a MOSFET as claimed in your title.

Answered by Chris Stratton on November 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP