DIY Audio Amplifier Board
Greetings everybody, and welcome again.
Here’s a small audio-based venture I ready for an upcoming Game Boy venture.
The PAM8403 Audio Amplifier IC Setup, along with just a few extra elements, drives a 3 ohm speaker on this audio board.
Since the PAM8403 is a 5V machine and can quick circuit if given greater than 5V, we built-in the AMS1117 linear voltage regulator setup. To cost the battery, we now have added a con2 port that’s linked by way of a diode, and we are able to additionally join a DC barrel jack to this setup. The battery provide used on this audio board is a 12V Li-ion battery pack.
This audio board primarily serves as a battery energy distribution board, charging the battery and supplying different units with 12V and 5V energy from the battery along with a separate audio amplifier board for audio output.
This venture is about the entire building of this venture, so let’s get began with the construct.
Materials Required
Below are the supplies used on this venture:
- Custom PCB (Provided by Seeed Studio Fusion)
- PAM8403 Audio Amplifier IC
- AMS1117 Voltage Regulator 5V
- 1uF 0603 Capacitors
- 0.47uF, 0603 Capacitors
- 10uF 1206 Capacitor
- 1uF 1206 Capacitor
- 220pF 0603 Capacitors
- SR206 Diode
- M7 Diode SMA Package
- CON2 JST Connector
- Rocker Switch
- 3 Ohms Speaker
- 3.5mm Audio Jack Cable
- XIAO SAMD21
PCB Design
We began the venture by first trying into the PAM8430 datasheet and understanding the workings of the amplifier IC.
Using the offered minimal connection diagram for PAM8403, we created the design. Following the datasheet’s directions, we included a coupling of capacitors to cut back noise and clean out the output facet (speaker facet) of the sign.
Since the PAM8403 is a 5V machine and we intend to make the most of a 12V battery supply, we chosen the broadly used AMS1117 voltage regulator IC, a low dropout (LDO) voltage regulator that’s steadily used to regulate voltage ranges in quite a lot of electrical tasks and purposes.
Checkout its datasheet right here. https://www.advanced-monolithic.com/pdf/ds1117.pdf
Additionally, we added a CON2 Port, which we’ll use to attach a rocker swap for switching the Audio Board ON and off, between the battery positives and the VDD Pin.
In order to cost the battery pack, we added a further CON2 port, which is linked to the anode of a diode and its cathode to the constructive port of the battery.
Additionally, there’s an LED and resistor linked to the CON2 port that function a charging indication. The indicator LED will illuminate when 12+V is utilized to the CON2 port.
Following the completion of the schematic, we used the PCB define—which was modeled for the subsequent venture—to provide the PCB design and full the board.
Seeed Fusion Service
After finalizing the PCB and producing its Gerber information, it was despatched to SEEED Studio for samples.
The PCB was ordered in a white solder masks with black silkscreen.
PCBs had been obtained in every week, and their high quality was tremendous good contemplating the speed, which was additionally fairly low.
Seeed Fusion PCB Servicepresents one-stop prototyping for PCB manufacture and PCB meeting, and because of this, they produce superior-quality PCBs and quick turnkey PCBAs inside 7 working days.
Seeed Studio Fusion PCB Assembly Servicetakes care of the complete fabrication course of, from Seeed Studio Fusion Agile manufacturingand {hardware} customization to elements sourcing, meeting, and testing providers, so you’ll be able to ensure that they’re getting a top quality product.
After gauging market curiosity and verifying a working prototype, Seeed Propagate Service might help you convey the product to market with skilled steering and a powerful community of connections.
Next is the PCB meeting course of.
PCB Assembly Process
- Using a solder paste dispencing syringe, the solder paste is first added to the PCB throughout PCB meeting.
- Next, we choose and place all of the SMD elements of their locations utilizing an ESD tweezer.
- Following the choose and place process, we positioned the PCB on the SMT Reflow hotplate, which heats the board from under to the melting level of the solder paste. The solder melts at that temperature, soldering each element to its pad.
- The THT course of adopted subsequent. To start, we positioned the THT diode and soldered its pads to the PCB’s backside facet. We positioned CON2 Port on the PCB Next and repeated the identical course of.
PCB meeting was accomplished.
Wiring
For testing this audio board, we wanted to first join the battery to it together with the rocker swap and the speaker.
We did wiring by following the wiring schematic hooked up.
The audio module was examined utilizing the XIAO SamD21 M0 Dev Board. We uploaded a take a look at sketch that output the Super Mario Theme music on loop through the D3 Pin of the XIAO. We linked the D3 pin of XIAO to the R-IN port of the audio module.
CODE
Here’s the Super Mario theme tune code that was used on this venture.
#outline NOTE_B0 31
#outline NOTE_C1 33
#outline NOTE_CS1 35
#outline NOTE_D1 37
#outline NOTE_DS1 39
#outline NOTE_E1 41
#outline NOTE_F1 44
#outline NOTE_FS1 46
#outline NOTE_G1 49
#outline NOTE_GS1 52
#outline NOTE_A1 55
#outline NOTE_AS1 58
#outline NOTE_B1 62
#outline NOTE_C2 65
#outline NOTE_CS2 69
#outline NOTE_D2 73
#outline NOTE_DS2 78
#outline NOTE_E2 82
#outline NOTE_F2 87
#outline NOTE_FS2 93
#outline NOTE_G2 98
#outline NOTE_GS2 104
#outline NOTE_A2 110
#outline NOTE_AS2 117
#outline NOTE_B2 123
#outline NOTE_C3 131
#outline NOTE_CS3 139
#outline NOTE_D3 147
#outline NOTE_DS3 156
#outline NOTE_E3 165
#outline NOTE_F3 175
#outline NOTE_FS3 185
#outline NOTE_G3 196
#outline NOTE_GS3 208
#outline NOTE_A3 220
#outline NOTE_AS3 233
#outline NOTE_B3 247
#outline NOTE_C4 262
#outline NOTE_CS4 277
#outline NOTE_D4 294
#outline NOTE_DS4 311
#outline NOTE_E4 330
#outline NOTE_F4 349
#outline NOTE_FS4 370
#outline NOTE_G4 392
#outline NOTE_GS4 415
#outline NOTE_A4 440
#outline NOTE_AS4 466
#outline NOTE_B4 494
#outline NOTE_C5 523
#outline NOTE_CS5 554
#outline NOTE_D5 587
#outline NOTE_DS5 622
#outline NOTE_E5 659
#outline NOTE_F5 698
#outline NOTE_FS5 740
#outline NOTE_G5 784
#outline NOTE_GS5 831
#outline NOTE_A5 880
#outline NOTE_AS5 932
#outline NOTE_B5 988
#outline NOTE_C6 1047
#outline NOTE_CS6 1109
#outline NOTE_D6 1175
#outline NOTE_DS6 1245
#outline NOTE_E6 1319
#outline NOTE_F6 1397
#outline NOTE_FS6 1480
#outline NOTE_G6 1568
#outline NOTE_GS6 1661
#outline NOTE_A6 1760
#outline NOTE_AS6 1865
#outline NOTE_B6 1976
#outline NOTE_C7 2093
#outline NOTE_CS7 2217
#outline NOTE_D7 2349
#outline NOTE_DS7 2489
#outline NOTE_E7 2637
#outline NOTE_F7 2794
#outline NOTE_FS7 2960
#outline NOTE_G7 3136
#outline NOTE_GS7 3322
#outline NOTE_A7 3520
#outline NOTE_AS7 3729
#outline NOTE_B7 3951
#outline NOTE_C8 4186
#outline NOTE_CS8 4435
#outline NOTE_D8 4699
#outline NOTE_DS8 4978
#outline melodyPin 3
//Mario fundamental theme melody
int melody[] = {
NOTE_E7, NOTE_E7, 0, NOTE_E7,
0, NOTE_C7, NOTE_E7, 0,
NOTE_G7, 0, 0, 0,
NOTE_G6, 0, 0, 0,
NOTE_C7, 0, 0, NOTE_G6,
0, 0, NOTE_E6, 0,
0, NOTE_A6, 0, NOTE_B6,
0, NOTE_AS6, NOTE_A6, 0,
NOTE_G6, NOTE_E7, NOTE_G7,
NOTE_A7, 0, NOTE_F7, NOTE_G7,
0, NOTE_E7, 0, NOTE_C7,
NOTE_D7, NOTE_B6, 0, 0,
NOTE_C7, 0, 0, NOTE_G6,
0, 0, NOTE_E6, 0,
0, NOTE_A6, 0, NOTE_B6,
0, NOTE_AS6, NOTE_A6, 0,
NOTE_G6, NOTE_E7, NOTE_G7,
NOTE_A7, 0, NOTE_F7, NOTE_G7,
0, NOTE_E7, 0, NOTE_C7,
NOTE_D7, NOTE_B6, 0, 0
};
//Mario fundamental them tempo
int tempo[] = {
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
9, 9, 9,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
9, 9, 9,
12, 12, 12, 12,
12, 12, 12, 12,
12, 12, 12, 12,
};
//Underworld melody
int underworld_melody[] = {
NOTE_C4, NOTE_C5, NOTE_A3, NOTE_A4,
NOTE_AS3, NOTE_AS4, 0,
0,
NOTE_C4, NOTE_C5, NOTE_A3, NOTE_A4,
NOTE_AS3, NOTE_AS4, 0,
0,
NOTE_F3, NOTE_F4, NOTE_D3, NOTE_D4,
NOTE_DS3, NOTE_DS4, 0,
0,
NOTE_F3, NOTE_F4, NOTE_D3, NOTE_D4,
NOTE_DS3, NOTE_DS4, 0,
0, NOTE_DS4, NOTE_CS4, NOTE_D4,
NOTE_CS4, NOTE_DS4,
NOTE_DS4, NOTE_GS3,
NOTE_G3, NOTE_CS4,
NOTE_C4, NOTE_FS4, NOTE_F4, NOTE_E3, NOTE_AS4, NOTE_A4,
NOTE_GS4, NOTE_DS4, NOTE_B3,
NOTE_AS3, NOTE_A3, NOTE_GS3,
0, 0, 0
};
//Underwolrd tempo
int underworld_tempo[] = {
12, 12, 12, 12,
12, 12, 6,
3,
12, 12, 12, 12,
12, 12, 6,
3,
12, 12, 12, 12,
12, 12, 6,
3,
12, 12, 12, 12,
12, 12, 6,
6, 18, 18, 18,
6, 6,
6, 6,
6, 6,
18, 18, 18, 18, 18, 18,
10, 10, 10,
10, 10, 10,
3, 3, 3
};
void setup(void)
{
pinMode(3, OUTPUT);//buzzer
pinMode(13, OUTPUT);//led indicator when singing a word
}
void loop()
{
//sing the tunes
sing(1);
sing(1);
sing(2);
}
int tune = 0;
void sing(int s) {
// iterate over the notes of the melody:
tune = s;
if (tune == 2) {
int measurement = sizeof(underworld_melody) / sizeof(int);
for (int thisNote = 0; thisNote < measurement; thisNote++) {
// to calculate the word period, take one second
// divided by the word kind.
//e.g. quarter word = 1000 / 4, eighth word = 1000/8, and so forth.
int noteDuration = 1000 / underworld_tempo[thisNote];
buzz(melodyPin, underworld_melody[thisNote], noteDuration);
// to tell apart the notes, set a minimal time between them.
// the word's period + 30% appears to work properly:
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
// cease the tone taking part in:
buzz(melodyPin, 0, noteDuration);
}
} else {
int measurement = sizeof(melody) / sizeof(int);
for (int thisNote = 0; thisNote < measurement; thisNote++) {
// to calculate the word period, take one second
// divided by the word kind.
//e.g. quarter word = 1000 / 4, eighth word = 1000/8, and so forth.
int noteDuration = 1000 / tempo[thisNote];
buzz(melodyPin, melody[thisNote], noteDuration);
// to tell apart the notes, set a minimal time between them.
// the word's period + 30% appears to work properly:
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
// cease the tone taking part in:
buzz(melodyPin, 0, noteDuration);
}
}
}
void buzz(int goalPin, lengthy frequency, lengthy size) {
digitalWrite(13, HIGH);
lengthy delayValue = 1000000 / frequency / 2; // calculate the delay worth between transitions
//// 1 second's value of microseconds, divided by the frequency, then break up in half since
//// there are two phases to every cycle
lengthy numCycles = frequency * size / 1000; // calculate the variety of cycles for correct timing
//// multiply frequency, which is absolutely cycles per second, by the variety of seconds to
//// get the entire variety of cycles to provide
for (lengthy i = 0; i < numCycles; i++) { // for the calculated size of time...
digitalWrite(goalPin, HIGH); // write the buzzer pin excessive to push out the diaphram
delayMicroseconds(delayValue); // watch for the calculated delay worth
digitalWrite(goalPin, LOW); // write the buzzer pin low to drag again the diaphram
delayMicroseconds(delayValue); // wait once more or the calculated delay worth
}
digitalWrite(13, LOW);
}
RESULT
Considering that the audio board is solely do-it-yourself, it sounds pretty wonderful. We had been in a position to function it efficiently after importing the code into the XIAO and powering it externally utilizing a USB cable
I’ve included a brief clip that incorporates a small audio observe and the general sound of the setup.
Furthermore, we linked the GND of a 3.5MM Audio Jack cable to the audio board’s GND and the correct channel pin of the audio Jack to the audio board’s R-IN.
Then, we had been ready to make use of the smartphone with the three.5mm Audio Jack. This audio board was functioning pretty properly general, indicating that it’s ready to be used within the upcoming venture.
What’s subsequent?
We shall be utilizing this audio board in an upcoming Gameboy venture as the subsequent step or part. This audio board shall be utilized in that venture to each provide energy and output the audio produced by the Raspberry Pi. To receive an audio sign, we’ll hyperlink the enter pins of the audio board by way of the Raspberry Pi’s GPIO.
Overall, this venture is working and requires no additional revisions.
Leave a remark in case you want any assist concerning this venture. This is it for at the moment, people.
Thanks to Seeed Studio for supporting this venture.
You guys can examine them out in case you want nice PCB and stencil service for much less price and nice high quality.
And I’ll be again with a brand new venture fairly quickly!
HI-FI News
through Explore all tasks – Page 1 – Hackster.io https://www.hackster.io
May 13, 2024 at 05:06PM
-
Product on sale
Audiophile Vinyl Records Cleaning BundleOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Product on sale
Easy Start Vinyl Records Cleaning KitOriginal price was: €69.90.€59.90Current price is: €59.90. incl. VAT -
Vinyl Records Cleaner Easy Groove Concentrate€34.95 incl. VAT -
Easy Groove Super Set€199.00 incl. VAT -
Easy Groove Enzycaster – vinyl records prewash cleaner€34.95 incl. VAT -
Easy Groove Extreme MK. II- vinyl records prewash cleaner€45.00 incl. VAT -
Vinyl Records Cleaner – Easy Groove Virgin Concentrate€35.00 incl. VAT -
Easy Groove Spray&Wipe vinyl records cleaner€34.95 incl. VAT








