MAX9744 Guide Datasheet by Adafruit Industries LLC

m E t s V. s n: n n r a m .h u r f a d a
Adafruit 20W Stereo Audio Amplifier - MAX9744
Created by lady ada
Last updated on 2021-05-29 11:38:13 PM EDT
2
3
6
6
7
8
9
11
11
13
16
18
20
20
23
23
25
26
29
29
30
30
30
31
31
32
33
34
35
35
35
35
Guide Contents
Guide Contents
Overview
Pinouts
Power connections
Audio Inputs
Speaker outputs
Breakouts
Assembly
Power capacitor
Speaker Terminals
Power and Line In Terminal Blocks
Basic Test
Analog Control
Preparation
Arduino Digital Control
Assembling Breakout Headers
Connecting up to an Arduino
Run code
Changing the I2C address
Connecting to a Raspberry Pi or BeagleBone Black
Python & CircuitPython
CircuitPython Microcontroller Wiring
Python Computer Wiring
CircuitPython Installation of MAX9744 Library
Python Installation of MAX9744 Library
CircuitPython & Python Usage
Full Example Code
Python Docs
Downloads
Datasheets & Files
Schematic
Layout Dimensions
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 2 of 37
Overview
Pump up the volume with this 20W stereo amplifier! This slim little board has a class D amplifier onboard
that can drive 2 channels of 4-8 ohm impedance speakers at 20W each. Power it with 5-12VDC using the
onboard DC power jack and plug stereo line level into the 3.5mm stereo headphone jack and jam out with
ease. Since it's class D, its completely cool-running, no heat sinks are required and it's extremely efficient -
up to 93% efficiency makes it great for portable or battery powered rigs.
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 3 of 37
m 0.0... o a :71 age , fl Mummy. :9. 12 "ed My: g Kvey ammo, mane er Connnguiz: m a-swfi%fia “OCIose euher am w znz .0 man" ad _ ' urixe axa-exar m [2c «7 30 v , Far Anilaq uni -» g nose nnaxno, an; 95m? jumpers " °Dr_:annacx SL14ADf/flDE-nins w and g comm 1K vol m cm mg: _ J , Douay pg nanny: Lsu a su-mn uH‘i2I1->En 3.6” a tau-x 17u4g1u->~n ’ % ggrul , O 'ooocococacoooa O
We like the MAX9744 amplifier at the heart of this board because its very easy to use, but it also has
both
analog and digital
volume control capability. Use a single 1K Ω pot (we include one) to adjust volume
analog-style. Or hook it up to your favorite microcontroller and send I2C commands to set 64-steps of
volume amplification.
Some great stats about the MAX9744
Power from 4.5V-14V DC voltage
Up to 93% efficient (88-93% typical)
20mA quiescent current (or put into shutdown for 1uA quiescent)
Up to 29.5dB max gain
Use DC or AC coupled line-level input, up to 3Vpp
Filterless Spread-Spectrum Modulation Lowers
Radiated RF Emissions from Speaker Cables
20W Stereo Output (4Ω, VDD = 12V, THD+N = 10%)
Low 0.04% THD+N
Integrated Click-and-Pop Suppression
Short-Circuit and Thermal-Overload Protection
We took this lovely chip and wrapped it up into a breakout for you, with polarity-protection, jacks and
terminal blocks, i2c level shifting, and a spot to solder in a volume pot.
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 4 of 37
Each order comes with one MAX9744 breakout board with all surface-mount parts fully assembled and
tested. We also include 3 x 2pin and 1 x 3pin terminal blocks, a 470uF power filter capacitor and 1KΩ trim
pot. To use this board, a little soldering is required to attach the terminal blocks and other components,
but its fairly easy and expect it should take less than 15 minutes.
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 5 of 37
my aqua SCL , .1W 'pHUIJQL/Qu 50R UiZ: HUIE SYNC RD?
Pinouts
Power connections
The MAX9744 amplifier can use between 5-14VDC power. The higher the voltage, the more gain you can
get. So if you want 20W per channel, you'll need to supply 12VDC. The amplifier is a Class D - so it only
draws current when its playing audio, but the voltage requirement is still pretty important. If you pick a
voltage too low, you'll hear distortion on the speakers because the output is 'clipping'
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 6 of 37
There's two ways to get power into this board, either by the 2.1mm DC jack (on the left) or the 3.5mm
terminal block breakout (in the middle). Both are connected up together so use whichever you like.
The 2.1mm DC jack is a 'standard' 2.1mm/5.5mm barrel jack, with center positive connection. The terminal
block has markings showing which pin is positive and which is negative. If powering from a wall adapter,
use the DC Jack, the terminal block is best for battery packs with wires coming out of them. You'll need to
solder the terminal block into this spot, see the Assembly page for details
To the right of the terminal block is a polarity protection MOSFET, it will make sure you only provide
positive voltages to the board! If the polarity is negative, it just wont work. Its more likely to happen with
the terminal blocks but its always nice to have a protection circuit.
All the way on the right is a spot for a electrolytic capacitor. We include a 470uF capacitor in the kit. This
capacitor helps smooth out the power supply. This isn't required when running off of batteries, but if
you're using a wall adapter, especially a really old 'transformer' style one, this will be required. If you want
the capacitor, solder it in using the instructions in the Assembly section
The MAX9744 board draws about 30-50mA quiescent current - that means that even when not amplifying
audio you'll be drawing that much current from the power supply. On top of that, you have to add the
current usage for audio amplification which will vary widely based on audio volume, speaker impedance,
amplification, etc.
Audio Inputs
This audio amplifier takes in stereo audio, either using a 3.5mm stereo jack or terminal blocks. Line in
audio is a-OK. The audio inputs are not differential! The ground connection is connected directly to the
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 7 of 37
power ground, this chip simply does not handle differential inputs. However, the inputs do have blocking
capacitors, so if your audio levels have DC bias, its OK to connect them up directly without extra audio
blocking caps.
Line level audio (about 1Vpp) is suggested, but it can handle up to ~3Vpp inputs.
The headphone jack is a classic 3.5mm as seen in just about every audio device. You can connect this
directly to any audio output. The terminal blocks are for if you have some direct-wiring project and you
want a more permanent connection. You'll have to solder in the terminal blocks if you want to use that
technique, see the Assembly page
Speaker outputs
You got this amp to amplify, and this is where you get that amplified signal out! We use two dual 3.5mm
terminal blocks for the speakers, Left and Right
Oops, on the first rev of the PCB we made a mistake with the breakout labeling, swapping the
two channels. The top pin is LEFT and the bottom pin is RIGHT. The middle pin is still GND
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 8 of 37
- » " _ Alainlnz m—me _‘ 7 ‘ - ,_ c‘ .‘ I i» am new SCL 'SHDN SYNCD am END ‘1 , ,m-w,»m;lmm1(:UU O LIN sun uizc nun: smc M32 UDD
The speakers can be 4 to 8 ohm impedance, 20W maximum power. Since it is a class D amplifier, the
signal out of these speaker blocks is a high frequency (~300KHz) PWM square wave. The inductance of
the speaker smooths out this signal into audio frequencies of 20-20KHz.
The outputs are Bridge-Tied-Load which means you can only connect speakers up directly. Don't
connect the outputs to another amplifier! And you can't "parallel" the two BTL outputs for one 40W load
either.
To connect up the speakers you'll want to solder in the terminal blocks, see the Assembly section for
details
Breakouts
At the very bottom, we break out all the pins you're likely to use with this amplifier. If you're using the amp
in Analog Mode you don't need to connect to any of these, most likely. If you're using the amp in Digital
Mode, you may want to connect to some of them. See the tutorials for each section on how to use the
board in either mode.
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 9 of 37
.00... o c I. o...
Above the pinouts there are three solder jumpers (Analog / AD1 / AD2 ) and then on the left, a 3-pin
breakout called Pot. Vol - these are used in analog mode, the solder jumpers are closed to tell the chip
we'll be using a potentiometer to set the volume. The Pot Vol connection is how we wire up the 1K
potentiometer. This is covered in more detail in the Analog Wiring section.
Starting from the left, here are what each pinout connects to:
RIN - this is a duplicate of the audio input terminal block, right channel
LIN - this is a duplicate of the audio input terminal block, left channel
AGND - analog reference ground, the 'quieter' ground for audio signal referencing
SDA - i2c digital signal data, if using Digital Mode to control volume over i2c
SCL - i2c digital signal clock, if using Digital Mode to control volume over i2c
Vi2c - the i2c voltage reference for logic. Only used in Digital mode - connect to 3V or 5V whichever
your microcontroller uses
SHDN - digital Shutdown pin. Connect to ground to turn off the entire chip and put it into low power
mode
MUTE - digital Mute pin. Connect to ground to turn off only the audio output stages, its faster than
shutdown and keeps the digital i2c audio levels
SYNCO - Sync output, this is the high frequency signal from the PWM generator, about 1.4MHz
SYNC - Sync input, for advanced users who want to clock in their own PWM frequency, keep it
above 800KHz.
AD1 - I2C address select pin #1
AD2 - I2C address select pin #2
GND - Power ground
VDD - 5-12VDC power, from the terminal block/DC jack
after
the polarity protection. You can use this
to power your other projects that can handle 5-12VDC power input.
The solder jumper on the back allows you to connect AGND (analog ground) to DGND (digital ground)
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 10 of 37
Assembly
Begin by placing the amplifier board in a vise so you can
easily work on it. Heat up your soldering iron to 650-700
degrees F and get some solder and hand tools ready!
Power capacitor
We'll start with the power supply capacitor. This cap isn't required if you're powering off of batteries or a
good quality supply, but if you're using wall adapter, this might give you just a little cleaner power
especially with high amplification levels
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 11 of 37
Capacitors are polarized, they have to be placed in the
right way!
The longer lead goes into the pad marked +
Place the capacitor against the PCB and bend the two
leads out so that it sits flat.
Flip over the board so you can solder the two pads
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 12 of 37
Solder in both pads, heating the pad and pins at the same
time with the edge of the soldering iron and dipping a
little solder in.
The ground (-) pin may be a little tough to solder since the
ground plane acts like a large heat sink
Clip down both of the long leads using diagonal cutters
so they are nice and neat
Speaker Terminals
You'll want to do this step, where we add the terminal blocks for the speaker outputs. Otherwise you'd
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 13 of 37
have to solder wires directly to the board which isn't suggested.
Place two of the 2-pin blue terminal blocks so that the
holes point outward
These don't have long leads to bend, so some tape can
keep them in place while you solder
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 14 of 37
Flip over the board again and solder in all 4 pads.
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 15 of 37
You don't need to clip them because they are already
quite short
Remove the tape once you've checked your work
Power and Line In Terminal Blocks
There's also terminal blocks for Power and line-in. These are optional, you can use the DC jack and
headphone jack but if you want to hard-wire in, use these instead of soldering directly to the board!
Place the 2-pin and 3-pin terminal blocks so the holes
point out
Tape can help here, to keep the blocks in place while you
solder.
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 16 of 37
Solder in all the connections
Check your work before moving onto the Basic Test
procedure
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 17 of 37
Basic Test
Before you decide whether you want to use Analog control mode or Digital control mode, you should test
your amplifier. By default, it will start up with about 6dB of gain, definitely loud enough to be heard!
Begin by connecting two speakers to the BTL speaker outputs of the amplifer
Next up connect 5-12VDC power to the board using a wall adapter. Then connect up an audio source. I
just used a 3.5mm male/male cable to connect it to my audio player.
Don't forget to gently yank on each wire after clamping it into the terminal block, it should be a
solid connection, not possible to yank out of place. Loose wires will be a problem!
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 18 of 37
Starting with low audio volume, slowly turn up the volume on your mp3 player/computer/etc until you
hear audio come out. 20W is pretty loud so don't put the speaker next to your ear!
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 19 of 37
An
Analog Control
Analog control is the easiest way to get going with the amplifier board. No microcontrollers are required.
Just wire up a single 1Kohm potentiometer to select the volume. The potentiometer sets the volume for
both
channels. There is no way to control channels individually.
Preparation
By default, the amplifier breakout is in digital mode. To put it in analog mode we need to close the three
solder jumpers labeled Analog, AD1 and AD2.
Solder closed AD1 on the right side of the board
Solder closed AD2 right next to AD1
Before you begin, perform the Basic Test, to make sure that the amplifier is overall working! Then
you can add volume control
If you want to use I2C volume control, do not solder in the potentiometer
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 20 of 37
a». I .‘ an; MD scL “ m . .“ LIN son on: nun SW: «02 mm
Finally, solder closed the Analog jumper on the left side.
When finished, your amp should look like this, with all three jumpers closed.
When you power up the amplifier and feed in audio you won't hear anything! This is normal! If the
potentiometer is not installed, it will default to lowest volume.
Now place the potentiometer that came with your kit into the three holes labeled Pot Vol - don't solder
them in yet, try to just touch the pads to the pins so that you can adjust the volume. As you twist the pot,
the volume will go up and down
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 21 of 37
11k moum: If you want a Ipotentiometer that will fit exactly' In the slot. check out this side- -adjustment pot httg //www.adafru com/groduct/1789 1.x3«m:;;;\
Once you have that working, you can solder wires to the Pot Vol pads, so you can place the volume
adjustment pot elsewhere (say mounted to the outside of a box)
If you want a potentiometer that will fit exactly in the slot, check out this side-adjustment pot
http://www.digikey.com/product-detail/en/bourns-inc/3362M-1-103LF/3362M-103LF-ND/1088401
For mounting onto a box or panel check out https://www.adafruit.com/product/1789 (https://adafru.it/Ec3)
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 22 of 37
Arduino Digital Control
Digital control allows you to set the volume of the amplifier using a microcontroller via I2C protocol. The
I2C data pins are connected on a breakout at the bottom of the board.
Assembling Breakout Headers
You can solder wires directly to the breakout pads but its easier to prototype if there are headers
attached. Follow along to attach headers!
The easiest way to attach headers to the breakout board
is to take advantage of a solderless breadboard you may
have.
Break off a piece of 0.1" male header, 14 pins long and
stick it long pins down into the solderless breadboard
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 23 of 37
lallic=al
This will keep it in place when you put the audio amplifier
on top! Put the breakout board onto the short header pins
so they stick out thru the breakout pads
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 24 of 37
Solder in all of the header pins to the breakout board.
Connecting up to an Arduino
We'll be using an Arduino to test the digital control, but really the I2C protocol is so simple, you can easily
port the code to any microcontroller you like.
First, though, we'll have to wire up the digital data pins.
Connect the following header pins:
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 25 of 37
SCL SHDN SYNCQ R01 5ND new IOOOIOOOOOOOO. LIN SDR U12: "UTE SYNC H02 UDD
GND from the MAX9744 connects to the common ground connection on your Arduino
Vi2c from the MAX9744 connects to the logic level voltage of your board. For most Arduinos, 5V
works well. If you have a 3V microcontroller, use 3.3V
Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino,
this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2
Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino,
this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
Run code
If you want to use I2C volume control, do not solder in the potentiometer
Make sure the AD1 AD2 and Analog solder jumpers are not closed before running the I2C tests,
or it won't work! For digital mode, these jumpers must be un-soldered
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 26 of 37
Since the MAX9744 has pretty much no protocol for sending data other than "write the volume level you
want" we didn't write a library, just an example sketch as shown below
Upload this sketch to your Arduino, and keep it connected to your computer. Don't forget to power the
MAX9744 with 5-12VDC separately via the DC jack!
#include <Wire.h>
// 0x4B is the default i2c address
#define MAX9744_I2CADDR 0x4B
// We'll track the volume level in this variable.
int8_t thevol = 31;
void setup() {
Serial.begin(9600);
Serial.println("MAX9744 demo");
Wire.begin();
if (! setvolume(thevol)) {
Serial.println("Failed to set volume, MAX9744 not found!");
while (1);
}
}
// Setting the volume is very simple! Just write the 6-bit
// volume to the i2c bus. That's it!
boolean setvolume(int8_t v) {
// cant be higher than 63 or lower than 0
if (v > 63) v = 63;
if (v < 0) v = 0;
Serial.print("Setting volume to ");
Serial.println(v);
Wire.beginTransmission(MAX9744_I2CADDR);
Wire.write(v);
if (Wire.endTransmission() == 0)
return true;
else
return false;
}
// Read in + and - characters to set the volume.
void loop() {
if (! Serial.available()) return;
// read a character from serial console
char c = Serial.read();
// increase
if (c == '+') {
thevol++;
}
// decrease
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 27 of 37
// decrease
else if (c == '-') {
thevol--;
}
// ignore anything else
else
return;
if (thevol > 63) thevol = 63;
if (thevol < 0) thevol = 0;
setvolume(thevol);
}
Run the sketch and open up your Arduino Serial console. If there's a problem you'll get a failure to set the
volume initially
If it's OK, you can send multiple +'s and -'s to increase or decrease the volume. The volume can go down
to 0 or up to 63 (which is 29dB of gain)
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 28 of 37
gmk‘ - m7“ dam A setting van: m :1 km valu- m 21 Sect-inn van: ca 3: mung van: m :u Sauna vuln: ca 35 setting van: m as km vnlu- m 21 Elm—nu loin-u; v mm . If you'd like to control the Adaerm MAX9744 Pfihon libram
Changing the I2C address
if you need to change the address from the 0x4B default to something else, you can close the AD1 or AD2
jumpers but not both to change the address to 0x4A (AD1 closed or tied to ground) or 0x49 (AD2 closed
or tied to ground)
Connecting to a Raspberry Pi or BeagleBone Black
If you'd like to control the MAX9744 from a Raspberry Pi or BeagleBone Black then check out this Adafruit
MAX9744 Python library (https://adafru.it/idA). The readme for the library has instructions on connecting
to the board, installing the library, and demonstrating the usage with an example. Using this library you
can set the volume and increase or decrease it using Python and an I2C connection from your board.
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 29 of 37
It‘s easy to Adafruit Circuithlhon MAX9744 You ca e this sensor with any CircuitFython microcontrolier board or with a c and Py thanks to Adafruit Blinka our Circuiththon-for-Pvthon comoetibiiitv iibrary Mun-(— ‘ man...- rum-r; 0... Since there' dozens of Linux computers/boards you can use we wili show wiring for Raspberry other platfo Dlease visit the quide for Circuiththon on Linux to see whether our Dlatform is supported
Python & CircuitPython
It's easy to use the MAX9744 amplifier with Python and CircuitPython, and the Adafruit CircuitPython
MAX9744 (https://adafru.it/C5j) module. This module allows you to easily write Python code that controls
the volume of the amplifier over its I2C connection.
You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO
and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility
library (https://adafru.it/BSN).
CircuitPython Microcontroller Wiring
First wire up a MAX9744 to your board exactly as shown on the previous pages for Arduino using an I2C
connection. In addition just like the basic test page mentions be sure to also wire up a power supply,
speakers, and audio input to the amplifier.
Here's an example of wiring a Feather M0 to the sensor with I2C:
Board 3V to sensor Vi2c
Board GND to sensor GND
Board SCL to sensor SCL
Board SDA to sensor SDA
Python Computer Wiring
Since there's
dozens
of Linux computers/boards you can use we will show wiring for Raspberry Pi. For
other platforms, please visit the guide for CircuitPython on Linux to see whether your platform is
supported (https://adafru.it/BSN).
In addition to wiring the sensor to your computer, just like the basic test page mentions, be sure to also
wire up a power supply, speakers, and audio input to the amplifier.
Here's the Raspberry Pi wired with I2C:
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 30 of 37
a... Adafrult CircuitPfihon MAX9744 latest version of Adafruit Clrcuithtnon stall the necessary libraries to use the hardware--c ies from Adafrult‘s CircultFfihon librafl bundle (h a great page on how to install the library bundle t connect to the board’s serial REPL
Pi 3V3 to sensor VIN
Pi GND to sensor GND
Pi SCL to sensor SCL
Pi SDA to sensor SDA
CircuitPython Installation of MAX9744 Library
Next you'll need to install the Adafruit CircuitPython MAX9744 (https://adafru.it/C5j) library on your
CircuitPython board.
First make sure you are running the latest version of Adafruit CircuitPython (https://adafru.it/Amd) for your
board.
Next you'll need to install the necessary libraries to use the hardware--carefully follow the steps to find
and install these libraries from Adafruit's CircuitPython library bundle (https://adafru.it/zdx). Our
introduction guide has a great page on how to install the library bundle (https://adafru.it/ABU) for both
express and non-express boards.
Remember for non-express boards like the, you'll need to manually install the necessary libraries from the
bundle:
adafruit_max9744.mpy
Before continuing make sure your board's lib folder or root filesystem has the adafruit_max9744.mpy
file copied over.
Next connect to the board's serial REPL (https://adafru.it/Awz) so you are at the CircuitPython >>> prompt.
Python Installation of MAX9744 Library
If you want to use I2C volume control, do not solder in the potentiometer
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 31 of 37
You’ll need to install the AdafruitiBlinka library that provides the Circulththon support in Python. T may also require enabling IZC on your platform and verifying you are running Python 3. Since each glatform is a little different and Linux changes often please visit the Clrcuiththon on Linux guide to get your comguter ready
You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This
may also require enabling I2C on your platform and verifying you are running Python 3. Since each
platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get
your computer ready (https://adafru.it/BSN)!
Once that's done, from your command line run the following command:
sudo pip3 install adafruit-circuitpython-max9744
If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to
use CircuitPython on Python 2.x, it isn't supported!
CircuitPython & Python Usage
To demonstrate the usage of the amplifier we'll initialize it and control the volume from the board's Python
REPL. Run the following code to import the necessary modules and initialize the I2C connection with the
amplifier:
import board
import busio
import adafruit_max9744
i2c = busio.I2C(board.SCL, board.SDA)
amp = adafruit_max9744.MAX9744(i2c)
Make sure some audio is playing through the amplifier, then you can control the volume using a few
commands.
The first option is to set the volume property to an explicit value. This can be any number from 0 to 63
where 0 is off/muted and 63 is maximum intensity (be careful, this amplifier can produce 20 watts of
output which might damage small speakers!)
For example to set a moderate half-way to max volume:
amp.volume = 31
Or to mute/turn off the output:
amp.volume = 0
In addition you can call the volume_up and volume_down functions to tell the amp to move up or down a
single volume level. This might be handy if your project only has an up/down volume control.
For example to move up 2 levels and then back down 1 level:
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 32 of 37
amp.volume_up()
amp.volume_up()
amp.volume_down()
Again be careful to not increase the volume to such a high level that it damages your speakers!
That's all there is to using the MAX9744 amplifier with CircuitPython!
Below is a complete example of setting the volume of the amplifier. Save this as code.py on the board
and it will set the volume to a moderate/half-way level.
Full Example Code
# SPDX-FileCopyrightText: 2018 Tony DiCola for Adafruit Industries
# SPDX-License-Identifier: MIT
# Simple demo of the MAX9744 20W class D amplifier I2C control.
# This show how to set the volume of the amplifier.
import board
import busio
import adafruit_max9744
# Initialize I2C bus.
i2c = busio.I2C(board.SCL, board.SDA)
# Initialize amplifier.
amp = adafruit_max9744.MAX9744(i2c)
# Optionally you can specify a different addres if you override the AD1, AD2
# pins to change the address.
# amp = adafruit_max9744.MAX9744(i2c, address=0x49)
# Setting the volume is as easy as writing to the volume property (note
# you cannot read the property so keep track of volume in your own code if
# you need it).
amp.volume = 31 # Volume is a value from 0 to 63 where 0 is muted/off and
# 63 is maximum volume.
# In addition you can call a function to instruct the amp to move up or down
# a single volume level. This is handy if you just have up/down buttons in
# your project for volume:
amp.volume_up() # Increase volume by one level.
amp.volume_down() # Decrease volume by one level.
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 33 of 37
Pylhon Docs
Python Docs
Python Docs (https://adafru.it/C5l)
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 34 of 37
0 Datasheet for the MAX9744 (httpsz/lada 0 Fritzing ob'ect in Adafruit Fritzing libram O EagleCAD PCB files on GitHub manage yx/mv a u an ‘ smu: m 9mm K Ymnumu “mm xmwm o x a ‘ ‘
Downloads
Datasheets & Files
Datasheet for the MAX9744 (https://adafru.it/dc8)
Fritzing object in Adafruit Fritzing library (https://adafru.it/aP3)
EagleCAD PCB files on GitHub (https://adafru.it/qpd)
Schematic
Layout Dimensions
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 35 of 37
© Adafruit Industries https://learn.adafruit.com/adafruit-20w-stereo-audio-amplifier-class-d-max9744 Page 36 of 37
© Adafruit Industries Last Updated: 2021-05-29 11:38:13 PM EDT Page 37 of 37