Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What is causing non-linearity in PWM ?

Status
Not open for further replies.

CMOS

Advanced Member level 3
Joined
Jan 6, 2004
Messages
862
Helped
94
Reputation
186
Reaction score
50
Trophy points
1,308
Location
USA
Activity points
5,673
Non-linearity in PWM

Hi,
I am using PWM output of P89C51RD2 to generate variable voltage in one of my applications. The PWM5 (P1.7) output of uC is connected to passive R-C (18k - 2.2uF) LPF circuit followed by op-amp ampilfier and buffer using LM358.
The full scale output is at PWM register value = 255 (99.9% duty cycle) adjusted to 7.5V by adjusting gain of op-amp.

Now if I want 5V outtput, the PWM register value required should be 255*5V/7.5V = 170. But I am getting 5V output at PWM register value = 202 !

Same is the case with 5.5V. It should be obtained at 187 but it is obtained at 214 !

What is causing this non-linearity? Can anyone please explain?
 

Re: Non-linearity in PWM

Hi CMOS,

Are you sure that it is a linearity problem ?

Can you publish the voltage measures of the pin 3, the pin 1 and the pin 7 for the following values of the PWM :
PWM = 1
PWM = 32
PWM = 64
PWM = 128
PWM = 192
PWM = 224
PWM = 255

Telga
 

Re: Non-linearity in PWM

Because you supply the opamp of single Vc I would expect non-linearity at the values close to 0. In this configuration you will never achieve output 0V (possible minimum will be 0.3 - 0.5V), and hence values below ..25.. will not produce anything sensible.
As far as this non-linearity at the top end is concerned I think it is somewhere around this RC filter. I assume that the micro generates pretty "proportional" PWM.
Maybe you should consider pull-up resistor of 2kΩ or less?..
 

    CMOS

    Points: 2
    Helpful Answer Positive Rating
Re: Non-linearity in PWM

Hi,
Here is the table of voltages at Pins 3,1 & 7 at different PWM values. The Full sacel output is set to 8.00V
Code:
PWM      Pin-3       Pin-1       Pin-7          Theoritical(Pin-7)
1        30.5mV      45.4mV      44.0mV         0.03
32       0.35        0.56        0.56           1.00
64       0.74        1.21        1.21           2.00
128      1.76        2.85        2.85           4.01
192      3.13        5.09        5.09           6.02
224      3.97        6.47        6.47           7.02
255      4.91        7.99        8.00           8.00

I have plotted the graph of these values in M$ Excel.
 

Re: Non-linearity in PWM

CMOS said:
Hi,
...
What is causing this non-linearity? Can anyone please explain?

May be necessary to use the operational amplifiers rail to rail?
 

Re: Non-linearity in PWM

Make_Pic said:
May be necessary to use the operational amplifiers rail to rail?

Why rail to rail? I am not taking ouput to Vcc level.

Added after 31 minutes:

Hi Ian,
I used 1.2k pull-up on P1.7 and observed following results. Results are much better than before. I am getting voltage near to theoritical calculations. Thanks a lot Ian.
Code:
PWM     Pin-3   Pin-1   Pin-7   Theoritical     Error %
1       0.15    0.25    0.25    0.03            +733.3
32      0.71    1.15    1.15    1.00            +15
64      1.29    2.09    2.10    2.00            +5
96      1.88    3.04    3.05    3.01            +1.32
128     2.47    4.01    4.02    4.01            +0.24
160     3.07    4.99    5.00    5.01            -0.19
192     3.69    5.99    6.00    6.02            -0.33
224     4.32    7.00    7.01    7.02            -0.14
255     4.93    7.99    8.00    8.00             0.00

And the graph...
Note that it looks more linear than previous one because data points in previous were not equi-distant whereas this one has equi-distant PWM values.
 

Re: Non-linearity in PWM

Well, now it is quite linear..
I assume that you don't worry about the low range. If you do, the only one thing to do is to connect +/- supply..
 

Re: Non-linearity in PWM

Hi,
I am interested in in 4V-7V range only and that is quite linear and within 0.5% error.

So was it the loading of port pin that was causing non-linearity?

Thanks once again.
 

Re: Non-linearity in PWM

Remove LM358 and measure the capacitors voltage.

Will you see same problem?
 

Re: Non-linearity in PWM

The problem is solved now. Please read the above posts.
 

Re: Non-linearity in PWM

HI
Can Any one tell me using PWM is it possibleto control an Electric Fan (Electric AC Motor)
 

Re: Non-linearity in PWM

yes but then you will have to use sine wave pulse modulation.
one easy method is to use Back to back connected Devices, this will allow the current in both the direction.
Happy New Year
Hock
 

Re: Non-linearity in PWM

Why back to back? I don't think it is a necessity for a fan controller since regeneration isn't needed i think. Simple v/f control is just enough i think with one way power direction.
 

Re: Non-linearity in PWM

Hi
How to change PWM Frequency?

Kosol
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top