# 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?

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.