# How to use PWM with Low Pass (RC) Filter to control power supply voltage??

Sorry for dividing it into a few questions so that I can get clear of the concept. I am going to build a simple (difficult for me) circuit which can power up a Load with different voltage applied. In order to achieve it, I will use PWM of Arduino to control a MOSFET in order to make a Switched Power Supply. I have some confusions on how to achieve this. To explain my questions clearly I am going to use schematics from microcontroller - Rc network placing R before C vs after - Electrical Engineering Stack Exchange

Let say the switched power output pin is the pin named CLK1 and I am going to smooth a 50% duty cycle PWM on a 5V pin so that I can get a 2.5V smoothed power supply after the the LPF.

1. Many arcticles said a RC circuit should place Resistor before Capacitor in order to control current flow into the Capacitor. I am confuse because I thought current value should not based on the part between Power Supply and Capacitor only, but the whole circuit including the Load in above case.

2. Regarding Q1, if I want to calculate the current the whole circuit, should I simply subsitute values into I = V/R like I = 2.5/1250 = 2mA? If yes, then why should I place the Resistor in front of the Capacitor? The current should be same before and after the capacitor…

3. Regarding Q2, my Load is indeed a resistor. I want to gaurantee almost all those 2.5V can be applied to it. However, I can’t, because the the Resistor in RC must drop some of the voltage. Does it mean that I should make the duty cycle larger than 50% so that the extra voltage will be cancelled out at the RC Resistor?

4. Regarding Q3, the reason that we are using PWM with LFP to supply power is because the energy loss of this approach is less. However, resistor change energy to heat. Would the Resistor of the RC in the above schematic waste too much energy?

5. Regarding Q4, if too much energy is wasted, which mean I should choose a resistor with a small resistance relative to that of the load, right? However, according to this formula: f=1/(2πRC), I should take a very large Capacitor…

6. Let say I am going to supply 2.5V from 5V pin of Arduino, which means I need to generate PWM at 50% dutycycle. When I am choose the capacitor, should I choose one with 2.5V max or 5V max. (I know I should take some buffer, I will take it into account. I am wondering the the max voltage of a capacitor. Is it related to max voltage input? or max voltage it can store or charge up to?)

7. Can I just replace the Resistor of RC with my Load? What will happen?

Too many questions and sorry for my English… Thanks in advance…

This is not a good way to proceed. The PWM/RC filter will always be noisy and inaccurate, and that is not something you want in a power supply output.

Please describe the range of voltages and currents that the power supply is expected to provide, and we can help you pick a suitable design.

jremington:
This is not a good way to proceed. The PWM/RC filter will always be noisy and inaccurate, and that is not something you want in a power supply output.

Please describe the range of voltages and currents that the power supply is expected to provide, and we can help you pick a suitable design.

Hi @jremington, I am going to drive a motor like 2mA@3V (no load) and 2A@3v (stalled). However, I don't care so much about how to drive this motor at this stage, because I want to get myself clear to the RC filter concept first. At least the questions related to current, cause I don't know should I treat the circuit as one or two. If there is only one circuit here, the current value should be same at any point as it is in series. That means no matter where I place the RC Resistor (before of after the Capacitor), I can still make the same result.

Anyway, Would still appreciate that you are willing to provide help!

Circuit simulation software works very well to analyze simple circuits with transistors and passive components like RC filters, and you don't need any expensive test equipment to do experiments.

I like LTSpice, which is free and easy to use, but there are on line simulators that are even easier.

Here is the output of the circuit shown in your first post:

If your ultimate goal is to control a motor, use a modern motor driver instead. like those from Pololu.

Arduino Mega:
"he default frequency on respective PWM pin of Arduino Mega: Arduino Mega has a total of 15 PWM pins. 12 of them are from pin 2 to pin 13 whereas remaining 3 are D44, D45, and D46. The default PWM frequency for all pins is 490 Hz, except pin 4 and 13 whose default frequency is 980Hz".

When you look at any filters like a low pass filter keep in mind the frequency. Also keep in mind when looking at an RC network that for C to charge to 99% or so of the average value takes about 5 RC time constants. Get to know the formula for calculating the R and C values based on the frequency you plan to apply. That becomes real important.

Ron

Let's keep this really basic:
If 5 volts is applied across the 1k in series with the load
resistor, can the voltage across the load reach 2.5 volts?
No, it cannot. So, the load resistor is too low a value.
Also, you do not want to put a load on an RC filter
because it changes the time constant thus altering
the effect of the RC network.
Herb

On another note you may want to read this thread which was just covered.

Some good PWM material in there.

Ron

jremington:
Circuit simulation software works very well to analyze simple circuits with transistors and passive components like RC filters, and you don't need any expensive test equipment to do experiments.

I like LTSpice, which is free and easy to use, but there are on line simulators that are even easier.

Here is the output of the circuit shown in your first post:

If your ultimate goal is to control a motor, use a modern motor driver instead. like those from Pololu.

@jremington, sorry for late reply. I know there are a lot of driver in the market. Before I am going to buy one. I hope I can know how if works behind. If sth I can build it myself, I would like to build it myself

Ron_Blain:
Arduino Mega:
"he default frequency on respective PWM pin of Arduino Mega: Arduino Mega has a total of 15 PWM pins. 12 of them are from pin 2 to pin 13 whereas remaining 3 are D44, D45, and D46. The default PWM frequency for all pins is 490 Hz, except pin 4 and 13 whose default frequency is 980Hz".

When you look at any filters like a low pass filter keep in mind the frequency. Also keep in mind when looking at an RC network that for C to charge to 99% or so of the average value takes about 5 RC time constants. Get to know the formula for calculating the R and C values based on the frequency you plan to apply. That becomes real important.

Ron

Hi @Ron_Blain, My questions are base on the formula I need some more detail information and working principle behind to proceed...

I know there are a lot of driver in the market. Before I am going to buy one. I hope I can know how if works behind. If sth I can build it myself, I would like to build it myself

Here is a PWM-controlled motor driver you can build yourself. Works quite well!

mannok:
Hi @Ron_Blain, My questions are base on the formula I need some more detail information and working principle behind to proceed...

Filters, any filters, be they low pass, high pass, active components or passive circuit designs are not designed to function as a power supply. All we have looked at is a few very basic RC low pass filter designs. They have all been passive and not even close to driving anything like a motor. Much of filter design gets a little complex depending on exactly, in detail, what we want to do. We have low pass, high pass, band pass and notch and each of those has several designs going well beyond a simple R*C network.

If I want to just drive a simple DC motor my first choice is exactly as jremington posted above.

Now if I am monitoring a sensor signal with for example some high or ow frequency noise I want to filter out the noise so I decide on an appropriate filter leaving me only the sensor signal I want. There is a place for everything and filters have their place but driving a motor load is not one of them.

Ron

jremington:
Here is a PWM-controlled motor driver you can build yourself. Works quite well!

May I know what is the role of C1 here? Is it for smoothing purpose? If yes then is it sth like RC filter here? How come the Resistor is missing?

C1, together with the internal wiring resistance, is a low pass filter to reduce radio frequency and power supply noise generated by sparks from the motor brushes.

Ron_Blain:
Filters, any filters, be they low pass, high pass, active components or passive circuit designs are not designed to function as a power supply. All we have looked at is a few very basic RC low pass filter designs. They have all been passive and not even close to driving anything like a motor. Much of filter design gets a little complex depending on exactly, in detail, what we want to do. We have low pass, high pass, band pass and notch and each of those has several designs going well beyond a simple R*C network.

If I want to just drive a simple DC motor my first choice is exactly as jremington posted above.

Now if I am monitoring a sensor signal with for example some high or ow frequency noise I want to filter out the noise so I decide on an appropriate filter leaving me only the sensor signal I want. There is a place for everything and filters have their place but driving a motor load is not one of them.

Ron

Seems that I have misunderstood the usage of RC filter. However, let say the situation is that I got a CNC laser module like this: 1500mW 405nm Blueviolet Light Laser Head laser Module Engraver Accessory for CNC laser Carving Engraving Machine 1500MW - Free shipping - DealExtreme, also I have got a 12V battery and an Arduino.

May I know what is the best way to supply 5V from that 12V battery to this CNC laser module?

Use a buck (step down) voltage regulator to power a module.

mannok:
Seems that I have misunderstood the usage of RC filter. However, let say the situation is that I got a CNC laser module like this: 1500mW 405nm Blueviolet Light Laser Head laser Module Engraver Accessory for CNC laser Carving Engraving Machine 1500MW - Free shipping - DealExtreme, also I have got a 12V battery and an Arduino.

May I know what is the best way to supply 5V from that 12V battery to this CNC laser module?

Yep, then do as jremington suggest. All you want is 5.0 VDC so just use a buck converter.

Ron

Ron_Blain:
Yep, then do as jremington suggest. All you want is 5.0 VDC so just use a buck converter.

Ron

So for buck converter, we can only have one static output voltage right? No way to control its output voltage dynamically right?

Yes, it's a fixed supply, single voltage. You have a 5.0 Volt 1.5 Watt LASER so why would you want a variable voltage?

Ron

First it was about a power supply, then a motor, and now a laser.

When you finally figure out what you really want to do and run into an actual problem, post a sensible question.

jremington:
First it was about a power supply, then a motor, and now a laser.

When you finally figure out what you really want to do and run into an actual problem, post a sensible question.

Thanks for that, nice to catch a smile.

Ron