Hello everyone, I am trying to have a linear relationship between the PWM input at 40kHZ and output DC voltage. The Linear equation should be something like this (Voltage= PWM*25 ). Where PWM is the values between 1 and 256. I have implemented the circuit by use of the LM358 opamp, 25VDC input, an inverter circuit, and a transformer. Within the circuit, i have included the PWM test values and the output voltages expected. The challenge is as I increase the PWM towards the maximum (24.9 uS) , the linearity aspect disappears, and i have to change the transformer to get the expected voltage. This then messes up the previous PWM test levels' results. I would appreciate if anyone was able to advise me on how to get a good linear relationship. I have also tried using variable feedback resistors on the opamp, but it doesn't help. Can a demultiplexer be used to select different gains (feedback resistors) according to PWM levels, if so , how can that be implemented?

Regards

Regards