# PWM to analog RC based filter with minimum analog voltage level

I am trying to design a circuit to accomplish the following:

1) 5 V PWM signal is converted to 0 - 2.5 V analog voltage

2) The analog voltage should never drop below a certain minimum voltage level when PWM is 0 or filtered PWM signal results in a voltage level less than this minimum.

I know I can do this with a microcontroller and other ICs but I am looking for a simple solution. I've come up with the following. A voltage regulator produces 2.5 V. An n-channel FET switched by the PWM signal produces a 2.5 V PWM signal. This 2.5 V PWM signal is converted via RC filter to 0 - 2.5 V analog voltage. I also have a voltage divider to feed the minimum voltage level to the capacitor through a diode. I am aware I will need to compensate for the voltage drop over the diode.

Will this work? Any advice?

## 1 Answer

Start with the simplest solution and go from there. All you need is 3 resistors. See the schematic below.

If you needed additional DC accuracy, you can re-clock your PWM signal with a low voltage buffer/inverter (A 74AHC1G04 is one option) powered by a dedicated 2.5V reference. Pull-down resistor $$\R_2\$$ would not be required in this case.

• Thanks for this although I don't quite understand what's going on. I have replicated this circuit in a simulator and the output is 0 - 2.5V, not 250 mV - 2.5 V. – Ibraheem Feb 10 at 20:19
• @Ibraheem Did you include R3 going to +5V? – sstobbe Feb 10 at 20:23
• Ah, I had set it to 2.5 V. Yes it seems to be working perfectly now in the simulator. Very elegant and the accuracy is fine also. Thank you. Do you mind giving a simple explanation as to how it works? – Ibraheem Feb 10 at 20:30
• Glad it meet your needs. If you look at the thevenin equivalent circuit for the 2 output states you see 250 mV in one case 2.5 V in other case, both with a large series resistance suitable for RC filtering. – sstobbe Feb 10 at 23:55
• yes I worked that out, how do you work out the resistor values for a different minimum voltage instead of 250 mV? I've worked out a few calculations but it seems I'll need to write some software to hunt down values that will work? It seems all 3 resistor values will need to fit together if the minimum level is changed. – Ibraheem Feb 11 at 0:08