Using PWM to control MOSFET to modulate current? - Page 1
Forum section: electronics / beginners

author: Mike_K
author_rank: Newbie
timestamp: June 07, 2021, 04:06:56 am
content: Hello all,I would like to know if it is common practise to use a PWM voltage signal applied to the gate-source junction of a power MOSFET to modulate the current through the drain-source path?A bit about my setup: I am powering a TEC (thermoelectric cooler) using a switching bench power supply, and applying a 5V PWM signal to the GS junction of a IRF520 power MOSFET. This FET has a threshold voltage of 4V according to the datasheet:http://www.radiovilag.hu/images/IRF520.pdf. The FET is used as a switch to connect the TEC through the DS junction to the bench power supply. I also have a 10k pull-down resistor between the source and gate.I could draw a schematic if necessary, although I think the setup is simple enough that I can get away without one. If requested, I can draw one up...With a 100% duty cycle, the TEC draws about 1.2 amps, the same as when I just apply a 5V DC voltage, and with a 50% duty cycle, it draws about half that. This makes me believe that what I am doing is OK, however the bench supply seems not to like it so much since it makes a humming sound when I apply the 50% duty cycle, and looking at the bench supply voltage on a scope shows quite an erratic voltage signal. I suppose this is because the bench supply isn't made for the current switching on and off at such a high frequency?If this is not the correct way to modulate current using a MOSFET, I would appreciate any advice on the correct way to do it.Thanks in advance for any feedbackMike

author: bdunham7
author_rank: Super Contributor
timestamp: June 07, 2021, 04:15:20 am
content: What frequency PWM signal? What model bench PSU? You might want to decouple the FET from the PSU a bit with a capacitor, maybe more.

author: Mike_K
author_rank: Newbie
timestamp: June 07, 2021, 04:35:41 am
content: The PWM signal is generated with an Arduino Uno, so I believe it's 490 Hz based on this:https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/It is a cheap very noisy supply:https://www.amazon.com/gp/product/B074C86DSY/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1Do you have any advice on how to size such a capacitor for decoupling? What would be 'more' than a capacitor?Thanks!

author: bdunham7
author_rank: Super Contributor
timestamp: June 07, 2021, 04:46:31 am
content: I'd start with a 100uF capacitor right near the FET and a little resistance between the PSU and the capacitor. A few feet of just barely big enough wire (24 AWG or so) is probably good enough. If you could use one of the 980 Hz pins, that might help too. Just make sure your FET stays cool, as it generates the most heat during the switching transition. More decoupling would be something like a choke or more resistance.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: June 07, 2021, 10:04:50 am
content: Using PWM to control power is very common. It's used almost everywhere that both a uC and significant power is used.Looking for pictures of a TEC gives ... deviating results (probably).https://duckduckgo.com/?q=tec&t=hc&va=u&iax=images&ia=imagesHowever, peltier elements with PWM is not good. These things like to see a steady DC current.You may see comparable power consumption, but efficiency goes down when PWM-ming.

author: Manul
author_rank: Super Contributor
timestamp: June 07, 2021, 01:34:46 pm
content: First problem - IRF520 is not good for 5V gate drive. For most mosfets you want something like 2.5-3x the gate threshold voltage to make it fully switch (low Rdson). So 5V switching may seem to work, but it adds inefficiency. Look for logic level mosfets.Second problem - as far as I know, Peltier element has quite a lot of parasitic capacitance. PWM is good for resistive loads and inductive loads. PWM is bad for loads which are fully or partly capacitive, because at every cycle you get a spike of current (capacitance needs to charge up). If capacitance is high all that makes efficiency drop significantly and not to mention problems related to high current spikes - noise, interference, various oscillations, etc.To drive capacitive load with PWM (control the current), you need inductor in the configuration of typical buck converter. Current inside inductor cannot start or stop immediately, it works like a current smoothing element. It "cures" the effect of capacitive load causing inefficiency, because it keeps current more or less average without huge spikes and reduces I*R^2 losses. But in that case the 490Hz frequency is too low, or you would need a very big inductor.It all depends how much you care about it being done good. If this is just for experiments, then it might not be important.Edit: if you want to keep same setup, I would probably suggest adding a bulk capacitor and lowering the switching frequency. You may try to manually PWM at something like 1Hz. Less switching should increase efficiency (but I never tried this myself). Using logic level mosfet is a must though.

author: Ian.M
author_rank: Super Contributor
timestamp: June 07, 2021, 02:30:38 pm
content: A cheap way to drive a TEC with reasonably smooth DC for a one-off project or prototype is to hack a suitably rated non-isolated DC-DC converter module to allow its output voltage to be controlled by your MCU PWM. First choose a module that uses a control IC with a ground-referenced internal reference voltage.If you inject a current at the switching IC's feedback (Adj) pin it will offset the output voltage, so all you need to do is to inject a current inversely proportional to the PWM duty cycle, sufficient to reduce the output to zero when the duty cycle is zero.As in normal operation, the feedback pin is held close to the reference voltage by the feedback loop, this could be as simple as inverting the PWM and passing it through a diode into a multi-stage RC low-pass filter to smooth it, with an order of magnitude greater resistor between the last capacitor and the feedback pin than those in the filter, to isolate it from the feedback pin so the filter capacitance doesn't compromise stability, and the total resistance chosen so that just enough current can be injected to reach 0V out (or whatever desired minimum output voltage).Adjust the module's feedback pot to set the upper limit of the output voltage range.

author: Mike_K
author_rank: Newbie
timestamp: June 07, 2021, 03:57:56 pm
content: Thanks everyone, a lot of useful info for a young player.At this point I am not really interested in efficiency, I just don’t want to damage my equipment like the power supply. And I will make sure the MOSFET doesn’t get too hot.Is there a go-to logic level MOSFET for applications like this that could provide up to a few amps without requiring too much cooling?ThanksMike