Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

dither frequency with pwm to drive proportional valve

Status
Not open for further replies.

mshh

Full Member level 5
Joined
May 30, 2010
Messages
313
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
usa
Activity points
3,673
i am planning to drive proportional valve using pwm by atmega. i will functions of ramp up and down in c code . dither frequency is needed to avoid stiction of the valve and to smooth the pwm signal . this dither frequency is ranging from 70–350 Hz and amplitude 0–10% of maximum current . the question here is how to do the dither in software programming?
 
Last edited:

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,060
Helped
4,050
Reputation
8,100
Reaction score
3,963
Trophy points
113
Activity points
119,191
Hi,

Either you calculate your dither so that there is still a low stiction, then the regulation loop is improved, because the stiction error is smaller than before. But ther still remains an error.
Or you calculate dither so that the valve continously moves (with dither frequency) around its optimal position. This causes best regulation results. Ther is no hysteresis you need to compensate, and the errir is about zero.
The problem is that the steady movement will wear out the valve. You need to replace it in a relativeky short maintenance period.

Maybe there is a way to switch dither on when needed, and off the othef time....

Klaus
 

mshh

Full Member level 5
Joined
May 30, 2010
Messages
313
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
usa
Activity points
3,673
Hi,

Either you calculate your dither so that there is still a low stiction, then the regulation loop is improved, because the stiction error is smaller than before. But ther still remains an error.
Or you calculate dither so that the valve continously moves (with dither frequency) around its optimal position. This causes best regulation results. Ther is no hysteresis you need to compensate, and the errir is about zero.
The problem is that the steady movement will wear out the valve. You need to replace it in a relativeky short maintenance period.

Maybe there is a way to switch dither on when needed, and off the othef time....

Klaus
i didn't get you , waht do you want to say ?what is your suggestion to solve this?
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,060
Helped
4,050
Reputation
8,100
Reaction score
3,963
Trophy points
113
Activity points
119,191
Hi,

What exactely is unclear?

Do you want the valve to move with your dither frequency or not?

Klaus
 

mshh

Full Member level 5
Joined
May 30, 2010
Messages
313
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
usa
Activity points
3,673
yes i want . and i asked how but your answer didn't give me a clear solution
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,060
Helped
4,050
Reputation
8,100
Reaction score
3,963
Trophy points
113
Activity points
119,191
Hi,

You just need to know the mathematics / code of the dither?

If dither is sine then
Dither = A_dither * sin ( 2* Pi * f_dither * t). Or you use a table.
Then add this dither to your actual pwm value. That's all.

Mind to update the pwm value snychronous to pwm frequency (or integer parts of it, means every second, third ...)
Use interrupts.

Klaus
 

mshh

Full Member level 5
Joined
May 30, 2010
Messages
313
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
usa
Activity points
3,673

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,060
Helped
4,050
Reputation
8,100
Reaction score
3,963
Trophy points
113
Activity points
119,191
Hi,

with
If dither is sine then
i leave it on you to choose any other waveform..


Klaus

- - - Updated - - -

Hi, again..

frequency ranges from 14 - 200hz
I used a fixed frequency rather than a spread spectrum..

Klaus
 

mshh

Full Member level 5
Joined
May 30, 2010
Messages
313
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
usa
Activity points
3,673
how to implement it in microcontroller?
 

mshh

Full Member level 5
Joined
May 30, 2010
Messages
313
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
usa
Activity points
3,673
i am wondering if i could generate pwm by timer2 as a dither frequency and superimpose it on the pwm by timer 1 ? could i do that?
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,060
Helped
4,050
Reputation
8,100
Reaction score
3,963
Trophy points
113
Activity points
119,191
Hi,

A regulation loop should always run with a very fixed timing. This ensures calculable loop stability. Often this is controlled by a timer.
As you run a PWM you most probably need a timer periferal for it. And most probably the PWM (timer) periferal can raise an interrupt.

Example:
Maybe you have a PWM running with 1kHz and you want a dither frequency of 20Hz.
Then itshould be able the generate the interrupts at the 1kHz PWM frequency.
Now divide 1kHz by 20Hz and get 50. Means it needs 50 pwm interrupts for one complete dither fullwave.

It should be possible to generate a table with 50 values of your dither waveform.
In the interrupt routine increment a counter running from 0 to 49 as pointer to the dither values.
Pick the dither value and add it to the regulation loop output and store it to the PWM register.

Finished.

Klaus
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top