# Variable Voltage Using PWM and Low Pass Filter

I am trying to control a steady DC output voltage using a Micro controller with a PWM duty cycle. With the current schematic, the Voltage on Vout is pulsing along with the Mosfet at what ever the duty cycle is. I know that this is the result of Load being grounded only when Mosfet is "on", but can not figure out how to get around this. I want a smooth, controllable Vout that uses the same ground as the Fet. I know this is a noob question but any help will be appreciated. Also, I don't want to be picky but for me pictures really do speak a thousand words.

Current Schematic Simulation EDIT

What I'm really looking for is a way to use a low-pass filter to smooth a PWM voltage. This smoothed out voltage will then be used to power a 1 ohm load. I know how to create a PWM voltage and a low pass filter, but not how to implement both to power something. Since I'm new to circuits, a simple schematic drawing will be very helpful.

• You're measuring the voltage at Vout rather than across the load. Jul 22, 2014 at 2:08
• The only way I could get the simulation to work was to put the load there. I just want a smooth Vout that powers the load. Jul 22, 2014 at 2:12
• I want be able to change the load on the devise I am designing. It has to be 1 ohms. I just need a way to ground it so that it want pulse. Jul 22, 2014 at 2:25
• I appreciate the help, but I'm having a hard time explaining what I want. Your solutions are noted, but not what I'm looking for. I need a different design, not a change values. Jul 22, 2014 at 2:32
• Yes it will create heat as dissipation at the filter resistors, capacitors that should support the high RMS current you want. For that application you use LC filters (inductor/capacitor) not RC (resistor/capacitor). If the voltage output you want is lower than the input I suggest you read about buck converters. Jul 22, 2014 at 2:49

you have to read theory of DC/DC (buck or boost) converters. http://www.learnabout-electronics.org/PSU/psu31.php

Here's one viable approach.. the buffer simulates the micro output. The output in this case is 0-Vdd = 0-5V and that is filtered and buffered and amplified by 1.6 to give 8V. I used 1kHz for this, but you can adjust resistor and cap values to suit. For precision, you can use an actual buffer and give it a separate reference supply. The op-amp type will depend on your requirements, but probably would be a rail-to-rail in and out capable of handling the desired output voltage.

Edit: If you're actually wanting a 1 ohm load, you'll also need a hefty power stage followingt hte op-amp. This is a separate question, really. The PWM gets you the analog voltage, but you want a really high current, so that voltage requires a power analog buffer stage.

P.S. You should be able to run the simulation on this. simulate this circuit – Schematic created using CircuitLab

• Yes, note that the low-pass filter uses quite high value resistors to get the time constants and the op-amp does not load it. There are other possible approaches such as an LC filter that could run cooler and avoid the op-amp (in place of it would be a half-bridge power driver) but this is the one from me tonight that more closely follows your question. Jul 22, 2014 at 2:55
• I do not need to amplify the voltage, just adjust it variably. The devise is going to be high amps using high drain batteries. Jul 22, 2014 at 2:58
• You have an 8V source in your simulation. That is higher than most microcontroller PWM outputs (usually 3.3 or 5V). Jul 22, 2014 at 3:02
• I know that, I'm using the microcontrollers 5v output to control a 8v duty cycle. Jul 22, 2014 at 3:04
• And thus amplifying it, so you do need an amplifier. Jul 22, 2014 at 3:05

The problem in your design is basic:

1. The series filtering resistors are too large, and they add inefficiencies. Use an inductor instead and thus filter with an LC circuit instead of RC.
2. The series filtering capacitors need to go to ground, not to the drain of the mosfet.
3. Once inductance is added, a freewheeling diode needs to be added to prevent spurious oscillations and large voltages generated when the MOSFET would open. 