MAX9744 High frequency output

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
rmh79
 
Posts: 1
Joined: Mon Jan 24, 2022 12:10 pm

MAX9744 High frequency output

Post by rmh79 »

I have an Arduino Uno hooked up to an SD card and a MAX9744 amp. I have pin nine of the Arduino outputting PWM of several songs (selected by buttons) going to the left channel input pin of the digital header. I have bridged LIN and RIN and I have a speaker hooked up to the output channels. Songs are playing as expected, but I am getting a VERY audible high-frequency component coming out of the speakers. Not sure if this is a result of bridging the inputs, or if there is something else going on? I am not using analog controls; volume etc are all controlled via I2C protocol.

Thanks in advance for any assistance you can offer!

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: MAX9744 High frequency output

Post by adafruit_support_mike »

The MAX9744 is a Class-D amp, which means its output is also PWM operating at about 360kHz.

If you send it PWM input you'll end up with an effect called 'aliasing'.. the same thing that makes wheels in old movies look like they're spinning backwards. The result is an artificial signal that repeats at a frequency related to the PWM input and PWM output frequencies.

To get rid of it, try running the output from the Arduino through a low-pass filter to make it look more like a standard analog signal:
filter.jpg
filter.jpg (41.6 KiB) Viewed 414 times
That will trim out any frequencies higher than about 20kHz.

User avatar
torpi
 
Posts: 4
Joined: Thu Dec 30, 2021 7:47 pm

Re: MAX9744 High frequency output

Post by torpi »

Thank you for your response, it is very clear.
Unfortunately I have not been able to remove the background noise and I am starting to challenge the PWM as an amplifier for this.

You will find attached the project if you are curious. Just upload the 2 wav files and main will start reading it when GP22 is high.

Here is how you connect the HP or speakers:

For Headphones


2K
PIO2 -/\/\/-----+----- headphone left
|
=== 0.1uF
|
PIO4 -----------+----- headphone ground
|
=== 0.1uF
2k |
PIO3 -/\/\/-----+----- headphone right

For amplifier don't use PIO4 and the capacitor should be 2200pF and connected to GND.

I have tried the 2 stages filtering with and without this initial filtering. It has no real impact.

Have a good evening,
Torpi
Attachments
Archive.zip
(196.87 KiB) Downloaded 7 times

User avatar
cyndaquil123
 
Posts: 3
Joined: Fri Feb 25, 2022 3:34 pm

Re: MAX9744 High frequency output

Post by cyndaquil123 »

Hi! The 2nd order low pass filter looks really cool. May I ask why you choose 20k Hz as the cut-off freuency? How does it related to the alisaing frequency?

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: MAX9744 High frequency output

Post by adafruit_support_mike »

20kHz is the top of the human audio spectrum. Digital audio systems sample at 44kHz to get at least two samples per cycle across the whole spectrum (as required by the Shannon/Nyquist sampling theorem).

Aliasing happens as a side effect of periodic signals syncing up:
aliasing.png
aliasing.png (186.4 KiB) Viewed 353 times
The sine wave along the X axis is a 5Hz sampling frequency. The two above are input signals at 1Hz and 11Hz. Notice how both have the same value at each of the vertical lines through a peak in the sampling frequency. If you can only see the two input signals at the lines (the definition of sampling), both input frequencies look the same. In effect, every multiple of 5Hz is invisible to the sampler, and the output only contains the remainder.

Aliased square waves produce the same effect, but instead of different amplitudes, they produce pulses of different widths. That variation in width produces a new frequency when the signal goes through a speaker.

Filtering out any signals outside the human audio band eliminates signals that will alias and cause aliased noise at the speaker.

User avatar
torpi
 
Posts: 4
Joined: Thu Dec 30, 2021 7:47 pm

Re: MAX9744 High frequency output

Post by torpi »

Hello,

the filtering sounds promising but I've never been able to filter the noise with my simple circuit. Unfortunately I have to switch to another amplifier.

Thank you for your help,
Torpi

User avatar
thequantizer
 
Posts: 1
Joined: Sun Jun 05, 2022 1:55 am

Re: MAX9744 High frequency output

Post by thequantizer »

A simple RC low pass filter is easy to make, just a capacitor and a resistor, but you need to be sure to select the correct values to filter out the frequencies you want to reject while keeping the ones you want. It is also important to note that if you use an RC low pass filter than you have a non linear response as you get closer to the 3db point. But if you want to try the RC Low Pass filter option you can find more information about it here

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”