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

Sound generation via PWM

Status
Not open for further replies.

vibrasphere

Newbie level 3
Joined
Sep 20, 2006
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
pwm sound generation

Dear friends,

I need to play 8-bit, 11kHz, mono .wav files using an MCU. The sound quality doesn't have to be great.

The idea is to generate a 11 kHz PWM with varying duty cycle proportional to the current sample's amplitude. The PWM will be generated by AT91SAM7S64 MCU.

A friend of mine proposed such a circuit

I am not sure what should be the values of caps and the resistor forming the filter network. Any help here?
 

Eugen_E

Full Member level 6
Joined
Nov 29, 2004
Messages
382
Helped
44
Reputation
86
Reaction score
11
Trophy points
1,298
Location
Romania
Activity points
2,839
pwm sound

The frequency of the PWM signal should be as high as the MCU supports for 8 bit PWM. The PWM signal should be applied to a low pass filter, with the cut frequency of 5.5kHz (for 11kHz sampling), and the filtered signal goes to audio amplifier.
Thus, the high frequency PWM signal is attenuated, and the speaker gets the time medium signal, which is proportional to the sample's amplitude. A simple RC filter may be enough, if the PWM frequency is high compared to 5.5kHz. If not, u need a higher order filter. Consider that the high frequency PWM signal is about 5V in amplitude, and if not properly attenuated, it would saturate the audio amp.

I've tested this for voice signal sampled at 8kHz, with 8bit PWM and the PWM signal frequency of about 40kHz, on Atmel AVR. The audio signal was applied to A/D converter and "copied" to output on PWM. The results were acceptable for 8 bit.

The circuit in the image isn't a lowpass filter.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top