NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Noise Noise Noise

June 02, 2010
by norby31
norby31's Avatar

I'm having so much trouble with my audio signal and noise. Am I missing something important in my configuration? I've tried putting caps across Vcc and Vdd to ground, filtered input and output, tried ladder DAC and pwm DAC, adjusted Vref for the ADC. Still sounds like a war is going on. Help? Other people who use different chips for programming don't seem to have these troubles.

June 02, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi norby31,

Let's take a step back and think a little about how you are going about doing the sound output, and perhaps we can find the source of your noise. Playing audible sound through a PWM DAC is certainly possible with these chips, but by no means trivial.

When doing the PWM output you have to think about what frequency it is outputting at, and make sure you have a low pass filter that will remove the PWM frequency so you don't hear it. This generally means that you will want to run the PWM as fast as you possibly can, without any pre-scalers and in 8 bit mode. If you are doing that, then you get one PWM cycle every 256 clock cycles, for a PWM frequency of 57KHz. Humans can hear up to about 20 KHz, so you are going want to filter out any frequencies above that. If you set up a good low pass filter with a cut off frequency at about 20KHz you should do a reasonably good job of cutting out the PWM buzz at 57KHz.

If you were trying to run your PWM any slower than that it is going to be real tough to do the filtering around it and still preserve your signal.

Another trick you could use is to get yourself a 20Mhz crystal, then you could run the PWM frequency a tiny bit faster and get better suppression from your low pass filter. In general the farther away the stuff is you want to get rid of from the stuff you want to keep the better.

Keep experimenting and let us know what you find. It sounds like you have a pretty neat project in the works.

Humberto

August 04, 2011
by hariharan
hariharan's Avatar

can u program a mcu to detect sound of a specific frequency and output it in a specific out put? i'm trying to make the mcu to work like a high pass and low pass filter. thanks!

Post a Reply

Please log in to post a reply.

Did you know that inductors try to keep their current constant over short periods of time? Learn more...