PWM+RC Audio Output - R & C values
![hippy](https://forums.parallax.com/uploads/userpics/339/nR1DFKQUWXIHE.jpg)
I'm wondering, using a simple RC to turn PWM into an audio output, what are the best R and C values to use ?
I chose the 220R plus 100nF as Jeff uses in the Propeller Cookbook and it sounded okay to me, but I won't deny that, at my age, my ears may well be full of fluff while Punk Rock undoubtedly also took its toll.
I'm thinking of the case where the RC ( via the 10uF electrolytic ) would be fed directly into a Hi-Fi or similar home-AV amplifier. Presumably a multi-filtered RC setup would be best, but I'm just after a single RC.
I chose the 220R plus 100nF as Jeff uses in the Propeller Cookbook and it sounded okay to me, but I won't deny that, at my age, my ears may well be full of fluff while Punk Rock undoubtedly also took its toll.
I'm thinking of the case where the RC ( via the 10uF electrolytic ) would be fed directly into a Hi-Fi or similar home-AV amplifier. Presumably a multi-filtered RC setup would be best, but I'm just after a single RC.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup
Jeff's design has cutoff just above 7kHz. 10K for 20kHz gives 800pF. For the demo board (10K, 10nF ) I make the cutoff just 1600Hz - That seems very low to me. Have I got the maths wrong ?
Added : Geared up with some new search criteria words I belatedly found this ...
http://forums.parallax.com/showthread.php?p=606294
Post Edited (hippy) : 9/28/2008 3:27:06 AM GMT
47nF and 220R gives a frequency roll-off of 15.3kHz
33nF and 220R gives a frequency roll-off of 21.5kHZ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
As you can probably tell it's really the electrical aspects of this I have no idea of. I could keep with the 100nF ( convenient as I have them ) and drop the 220R ( easy ) but is it better to go low-R high-C or high-R low-C, or is there really no difference ?
Does the actual update of the PWM have an impact here ? Updating FRQA/B every 64uS gives 16kHz, so what should the cut-off be in such a case, I'd presume at or lower than 16kHz, 8kHz if thinking about nyquist ( so 220R+100nF is okay ) but I may be off-track in that.
Yes, the update rate does matter as it is your sampling rate, which should be twice the cutoff frequency of your filter or you will start hearing noise and beat frequencies generated by the sampling frequency mixing with your audio. The PWM frequency should also be much higher than twice the cutoff frequency.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup
But with the DUTY mode of the propeller counters, you don't have a fixed PWM sampling frequency. The PWM frequency is very high (40 MHz) at 50% output voltage and goes down to 80MHz/32767 = 2.4 kHz at the Min and Max output voltage (for a 16 bit DAC). Because the ear is only sensible for sampling artefacts at quiet parts of the audio signal, and the PWM frequency is very high then, the DUTY mode is perfect for Audio output.
It also works without any R-C filter, but then you have 40 MHz RF on the audio cable, and this can produce interferencys on TV and Radio.
Andy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup
I wouldn't go to LOW on R, since this aspect is to protect the I/O pin from excessive current.
Basically you should consider the capacitor regardless of its value as a short circuit during an I/O transition, and the possibility that the I/O could see twice the supply voltage during this transition.
The typical impedance for a HiZ microphone input is defined as greater than 10,000Ω
The typical impedance for a MedZ microphone input is defined as 600Ω - 10,000Ω
The typical impedance for a LoZ microphone input is defined as less than 600Ω
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 9/29/2008 5:10:05 AM GMT