Hi,
in my eyes your posts contradict.
I wanted to convert that 5V square wave to 20mV square wave.
But now you don´t want square wave anymore.
This also contradicts your requirement for high slew rate, because your filter reduces slew rate to a minimum.
Regarding distortion and output impedance a (feedbacked) OPAMP surely is better than a single BJT.
i used 3rd order RC filter
This filter does what is supposed to do. It is a low pass filter. Thus - like the name says - it let´s low frequencies pass. DC is the lowest expectable frequency (if one want to call "0Hz" as frequency at all).
So the filter lets the DC coming from the Arduino pass. The arduino output DC is about: VCC * duty_cycle
how can i shift the output starting from 0V(not 2V, the signal in green)?
The problem is: your requirements change from post to post. So I don´t know what your goal is.
Read our posts. At least half of them ask for clear informations.
I don´t know whether you want a square wave or not, a low pass filter, a buffer .... or something else.
As long as I don´t know what you want I can not recommend anything.
Just guessing ... but it´s now post#22 ... and I don´t want to spend more time in guessing.
Klaus