Go Down

Topic: PWM to analog... is this just too Rube Goldberg? (Read 1 time) previous topic - next topic

retrolefty


IIRC vanilla PWM is 490 Hz variable width pulse, or is it closer to 500 Hz?
Couldn't the same low-pass filter work for 0-100 PWM?




Depends on the -3db corner frequency of the specific R/C filter used. Lowering the switching frequency would normally call for lowering the cornering frequency of the filter. A given low pass filter will contiune to perform as designed as you raise the pwm switching frequency, but might require adjustment as you lower the switching frequency.

Lefty

GoForSmoke

Yes but vanilla Arduino PWM has a default full cycle that doesn't change the clocks. It should be fast enough.

But as I read, how fast I want to change the PWM -level- (assuming like 10% duty cycle to 90%) is more the deal?

Quote
RC = 1/2piF
F = 1/2piRC


Does this frequency limit how smoothly DC output will change as PWM level changes?
If so, that would be the smoothness the audio circuit the filtered PWM could change frequency as well as how fast I could jump from one note to another.
I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

retrolefty

#12
Feb 02, 2013, 12:42 am Last Edit: Feb 02, 2013, 12:48 am by retrolefty Reason: 1

Yes but vanilla Arduino PWM has a default full cycle that doesn't change the clocks. It should be fast enough.

But as I read, how fast I want to change the PWM -level- (assuming like 10% duty cycle to 90%) is more the deal?

Quote
RC = 1/2piF
F = 1/2piRC


Does this frequency limit how smoothly DC output will change as PWM level changes?
If so, that would be the smoothness the audio circuit the filtered PWM could change frequency as well as how fast I could jump from one note to another.



Filtering of a pwm output to generate a variable true analog DC voltage level is certainly a viable solution for some applications. But trying to generate variable audio frequencies via PWM output is just not a very practical solution in my mind. And it's not about the ability of filtering out the basic PWM switching frequency, but rather how to encode the audio frequency into PWM duty cycle values that have to change constantly with time even at a fixed audio frequency, it makes my head hurt trying to visualize that coding task. A 8 bit AVR chip is not the best candidate for want of a sine wave DDS generator.

Lefty

GoForSmoke

#13
Feb 02, 2013, 04:09 am Last Edit: Feb 02, 2013, 04:11 am by GoForSmoke Reason: 1


But trying to generate variable audio frequencies via PWM output is just not a very practical solution in my mind.


I don't want to generate the frequencies. I want to influence what frequency an audio generator creates and I'd like to be able to slide the tone up and down quickly, dig?

I'd like to control volume too, ADSR kind of thing.

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

emdee

I play guitar so that helps me understand what you are getting at. You've got some sort of voltage-controlled analog effect box circuit that you'd like to put under digital Arduino control by using PWM and an R/C filter to generate the control voltage for the effect. I've thought of that before, and it would seem to be fine in theory (if your circuit is happy with 0-5V for your analog control, and doesn't take too much current); otherwise as mentioned you'll want an op amp to get a different range.

Go Up