• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PWM Input and VDC Output Voltage Linear Relationship

samk

New Member
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
 

Attachments

audioguru

Well-Known Member
Most Helpful Member
The datasheet for the lousy old LM358 shows that it has slew rate trouble with sinewaves above 10kHz and you are trying to use it with pulses at 40kHz. Use a better and newer TLE2141 single opamp that works well up to above 400kHz so it can pass 40kHz pulses. The TLE2141 inputs work all the way down to ground like an LM358.
 

samk

New Member
Thank you for the reply, i will have a look at the Op-Amps prescribed. i will see if i have better linearity.
Regards
 

samk

New Member
think there is also a problem at the input low pass filter stage, when i put the 24.908 u PWM level, the voltage does not conform to the linear expected voltage after filtration. thats a source for the lack of linearity. Could anyone have an idea how to improve this part.
 

audioguru

Well-Known Member
Most Helpful Member
Why does your circuit have a lowpass filter? It cuts away most of the input pulses.
 

samk

New Member
i meant to use the filter to convert the PWM signal to an analog DC voltage. or is there anything i can substitute with
 

samk

New Member
Hello all, i still have a simple problem that i cant seem to get rid off. The low pass filter that converts 3.3 V, 40kHZ PWM into DC voltage does not seem to be linear from 90 % onwards. Could anyone please guide me on what i can do to have linearity at the PWM Conversion stage.. I used a simple RC circuit to filter the PWM as seen in the image of the circuit. Hello all, i still have a simple problem that i cant seem to get rid off. The low pass filter that converts 3.3 V, 40kHZ PWM into DC voltage does not seem to be linear from 90 % onwards. Could anyone please guide me on what i can do to have linearity at the PWM Conversion stage.. I used a simple RC circuit to filter the PWM as seen in the image of the circuit.
 

ronsimpson

Well-Known Member
Most Helpful Member
The low pass filter that converts 3.3 V, 40kHZ PWM into DC voltage does not seem to be linear from 90 % onwards.
Please post a schematic. With values. Or at least post the values. I have designed ICs that have several different types of PWMs. I find them extremely linear. (depends on that the load looks like) I need to know what IC is driving the RC. Many micros have IO pins that pull down well but do not pull up well. If the RC is feeding a amplifier I need to know about that also.
 

ronsimpson

Well-Known Member
Most Helpful Member
Not certain what "linear" is. Duty cycle to voltage is very good.
SPICE is perfect but V1 in real life is not and can not drive a 500 ohm load. Try changing to 5k or 50k and reducing the cap.
The B-E of Q3 is not compensated for. Try the feed back at the Emitter or better yet at DC_output. (add voltage divider)
1577557612208.png
 

samk

New Member
Hello Ron, i plan to use a 3.3 V Push-Pull type of CMOS that can sink 2mA at 0.8V. I am not so farmiliar with the exact specification, as a i am still new to this field, and this is my first project
 

audioguru

Well-Known Member
Most Helpful Member
He is not making a real circuit. Instead he is making a "perfect" simulation that has zero source resistance.
 

samk

New Member
i am using the simulation as a guide for the circuit that i want to make later... I could not start with the circuit first as i wasnt sure how to compute the parameters.
 

samk

New Member
Please post a schematic. With values. Or at least post the values. I have designed ICs that have several different types of PWMs. I find them extremely linear. (depends on that the load looks like) I need to know what IC is driving the RC. Many micros have IO pins that pull down well but do not pull up well. If the RC is feeding a amplifier I need to know about that also.
The values that I am attempting to get from the circuit are as follows:
INPUT PWM(uS) -------- EXPECTED DC OUTPUT(V)
2.4415 -------- 590
5.371 -------- 1294
6.34775 -------- 1529
9.082 -------- 2188
11.81625 -------- 2847
24.908 -------- 5900

I dont have any schematic yet, as i have just started the projects, the only thing provided is the information as per the table above. So i came up with the Spice simulation as a start point, as i am still new in this field, and i aim to improve the schematic first then try it on a real circuit.
 

Latest threads

EE World Online Articles

Loading

 
Top