sorry for late reply, I just did not develop this part in the circuit for a while, and now I am into it again.
the circuit is shown below:
my problem is, when the pwm output from microcontroller is around 5 volts (full pwm output), the output on the other side of the optocoupler is less than 5 (it was about 4.7 or so) because of drop of the optocoupler itself.
I want to reduce or eliminate this effect, so I get a linear scaling (5 volts on optocoupler output when I give 5 volts on pwm side, and 0 volts on optocoupler output when I give 0 volts on pwm side)
are there any suggestions how can I achieve this?