Controlling isolated 0-5V

stueveone:
@6v6gt

I am trying to digest your recommended post, thanks for sending BTW! Do you have a final schematic that you got to work? I am not sure where the PNP transistor should go. I would also be interested to see how you omitted the power supply circuit, seeing as I have a 5V supply already provided with the speed control circuit?

Best,
stueveone

Just to be clear. This design was used for a motor controller which was not isolated from the mains.
It was this controller: link . If however, yours is mains isolated then you could probably use a simpler circuit.

The OP (not me) of the thread where this design was used, found a 5 volt supply on the motor controller which he could use because it shared a common ground with the terminals he was using for the connection.

Anyway, here is the circuit:

And the simulation with a 25% duty cycle (Green trace shows output voltage):

Note: This is from an LTspice simulation in which the MCP6002 (dual rail to rail) Opamp was not available so a substitute is shown. The power sources V1 and V2 are again for the simulation.

Edit: Circuit now modified to remove the need for a PNP transistor, but still keep the requirement that a 0% PWM duty cycle gives minimum voltage at the output and a 100% duty cycle gives the maximum voltage at the output. The original HackaDay circuit gave the inverse of this.