This is a class D audio amplifier, the D stands for digital. The analog input signal is digitally processed all the way to the speakers where it is restored to an analog voltage in the speaker’s coil. The signal is pulse width modulated instead of amplitude modulated.
I had a minor problem with the amplifier I was using to power the speakers attached to my computer. Rather than fix it I decided it would be fun to make my own. I hadn't made an audio project in years and I have been in the mood to make something different than the kinds of microcontroller and computer projects I usually do.
You will need:
- Stereo 20W Class D Audio Amplifier http://www.adafruit.com/product/1752
- Enclosure - Aluminum (120x95x35mm) https://www.sparkfun.com/products/11351
- Half-size breadboard http://www.adafruit.com/products/64
- Speaker Terminal - 4 Spring https://www.sparkfun.com/products/11145
- Panel Mount 2.1mm DC barrel jack http://www.adafruit.com/products/610
- 1/4" Panel Mount Audio Jack (purchased locally at RadioShack)
- Toggle Switch (purchased locally at RadioShack)
- Panel Mount 1K potentiometer http://www.adafruit.com/products/1789
- Potentiometer Knob http://www.adafruit.com/product/2046
- 5mm Metal Wide LED Holder
- 5mm LED (Your choice of color, I used red)
- 2 470 - 680 Ohm resistors (for LED) *
- 18 Gauge Stranded hook-up wire (Red, Black, and Green)
- 22 Gauge Solid hook-up wire (Red, Black, and Green)
- 4 Stick-on Rubber Feet
- 2 6-32x3/8" round head machine screws with nuts.
- 9 - 12 volt power supply http://www.adafruit.com/products/63
- 1/8 - 1/4 phono jack adapter (purchased locally at RadioShack)
* This is a very handy assortment of resistors https://www.sparkfun.com/products/10969
Step 1: Assemble the Amplifier Board
Assemble the Amplifier board. All the surface mount parts are soldered for you, you only need to solder the through hole parts.
Follow the instructions provided by Adafruit located here:
Don't forget to close the three jumpers to set the amplifier for analog operation.
When soldering the header strip the only connections that will be used are the VDD and the Ground. Make sure these two get soldered, and then solder a couple on the other end. They do not all need to be soldered. They are used only for mounting the board.
Cut 3 pieces of 22 gauge solid hookup wire about 1 1/2" long, one black, one green, and one red.
Strip 1/4" of insulation of of each end and solder the wires to the three volume control connections.
Step 2: Drill Holes for the Back Connectors
The back of the box has connections for the speaker terminals, power input, and signal input.
Drill a 1/4" diameter hole, the first hole for the speaker terminals, 3/4" from the left side of the box and 1/2" up from the bottom.
The next three 1/4" holes are drilled 5/8" apart 1/2" up from the bottom.
Place the speaker terminals in the four holes.
Make sure it is centered, mark the location of the mounting holes.
Remove the speaker terminals and drill the mounting holes 5/32" in diameter. The hole on the left is a little too close to the edge, this was necessary to save room.
Drill a 1/2" hole 3 1/4" from the left side of the box and 9/16" up from the bottom. This hole is for the barrel jack to connect the power supply.
Drill a 3/8" hole 4" from the left side of the box and 9/16" up from the bottom for the audio input.
Step 3: Drill Holes for the Front Connectors
The front of the box has connections for a power switch, volume control, and an on/off LED.
All three of these holes will be drilled 3/4" up from the bottom of the box.
Drill a 5/16" diameter hole 1 1/4" from the left side of the box, for the volume control.
Drill a 1/2" Diameter hole 2 5/16" from the left side of the box, for the power switch.
Drill a 5/16" diameter hole 3 3/8" from the left side of the box, for the LED.
Clean the inside of the box, make sure you remove all the aluminium chips from the drilling. You don't want any shorts.
Step 4: Start Mounting the Components
Remove the power rails from the breadboard and mount the power switch and the breadboard as shown in the first photo.
Mount the amplifier board as shown in the second photo.
Step 5: Mount and Wire the Power Switch and Barrel Jack
Open the picture of the barrel jack to see which is the + and the - terminal.
Cut a piece of the black 18 gauge stranded wire about 1 1/2" long, strip the insulation off of the first 1/4" of both ends.
Solder one end to the negative terminal of the barrel jack.
Cut a few strands out of the end so it will fit into the terminal, and twist it together tightly. It will be necessary to remove a few strands of wire from every end that will connect to the terminals on the amplifier board.
Cut a piece of the red 18 gauge stranded wire about 8" long strip the insulation off of the first 1/4" of both ends.
Solder one end to the positive terminal of the barrell jack.
Mount the barrel jack in the large hole in the back of the box.
Put the short black wire in the terminal negative side of the terminal strip marked "12V" and tighten the screw.
Route the long red wire around the breadboard and solder it to the switch.
Cut another piece of the red 18 gauge stranded wire which will be soldered to the switch and connected to the positive side of the "12V" terminal.
Step 6: The Volume Control
Plug the three wires for the volume control into three different columns on the breadboard as shown in the first photo.
Cut 3 pieces of the 22 gauge solid wire 1 1/2" long, one black, one red, and one green.
Strip 1/4" of insulation off each end of all three wires.
Solder the three wires to the pot like in the second photo.
Cut off any excess wire sticking out. It is very close to the case and you don't want to short out the volume control.
Break the little tab off of the pot so it will sit level and mount the pot in it's hole.
Connect the three wires from the pot to the column with the corresponding color wire in it.
Step 7: The LED
Mount the 5mm LED in the LED holder.
The short lead is the cathode (ground) and the longer lead is the anode (positive).
Solder one of the two 470-560 Ohm resistors to each lead of the LED.
Solder the resistor to the shorter lead closer to the LED so you can still tell which lead is which. See the first photo.
The cathode lead (resistor closer to LED) connects to the GND connection on the amplifier board, the anode connects to the VDD connection like in the second photo.
Step 8: The Audio Input
Cut two pieces of the 18 gauge stranded wire about 1 1/2" long, one black, and one green.
Cut one piece of the red wire about 2" long.
My red wire was the same length as the other two. That made it real hard to get the wire into the terminal.
Strip of 1/4" of the insulation from each end.
Cut a few strands out of one end of each wire so it will fit into the terminal blocks.
Solder the wires onto the 1/4" Panel Mount Audio Jack.
The red wire is the left channel, right is green, and black is common.
Mount the jack in it's hole and connect the three wires to the terminal block as shown in the second photo.
Step 9: Speaker Terminals
Cut 4 pieces of the 18 gauge stranded wire about 3" long, one green, two black, and one red.
Strip 1/4" of insulation off of each end and cut a few strands out of one end of each wire.
Solder the wires to the speaker terminals like in the first photo.
Mount the speaker terminals in the holes.
Use the 2 6-32x3/8 screws to hold them in place.
Make sure they are centered so there are no shorts.
Connect the wires to the speaker terminals on the amplifier board as shown in the second photo.
Hold the lid of the box in place with the 4 screws provided and stick the 4 feet to the bottom to finish the project.