Sonntag, 20. September 2015

Mobile Boombox with PAM8403

Last Update: 13.11.2015
Out of curiosity and fun I wanted to build a mobile speaker as do-it-yourself project which can be fed with auxiliary music via line in from an iPod or cellphone or even directly use some SDcard or USB stick with MP3s on it. This should work with a single LiIon battery. So I went along and ordered a few cheap components.

4x Fullrange speaker with 3W and 4R: around 7€ @aliexpress
5x Amplifier boards with PAM8403: 1,10€ @aliexpress
1x MP3 decoder board: 3,55€ @aliexpress
1x MP3 decoder with Bluetooth: 4,55€ @aliexpress
10x 20 kOhm audio potentiometers: 4€ @aliexpress
10x Knobs for the potentiometers: less than 1€ @aliexpress
10x 2A step-up ICs TD8208: 3€ @aliexpress

Additionally, you need some more components like capacitors, resistors, power inductors and so on.

Push-Pull / class AB amp try-out
The PAM8403 PCBs took quite long to arrive, so I started building a push-pull-transistor amplifier for first tests - it's less efficient, but at least I could test if the rest of the setup works. (In fact a friend 'forced' me to do it, for learning/education sake; thanks Andre, it worked. I now see capacitors not solely as equivalent of a battery anymore, but also as a frequency dependant resistor. Well done, sir!)

As always, clicking on the pictures will increase their size.

The layout of the DIY Class AB-amplifier circuit.

Top view - it's quite small, too! It's actually amazing how simple it is to build.

Some more photos and explanations from the build process:
The decoder board had a 78M05 low dropout regulator which I needed to desolder; I just bridged the remaining Vin/Vout terminals. The 5V supply stem from a small TD8208 step-up regulator. As it can deliver up to 2A, this will be enough for the 2 * 3W of the PAM8403 amplifier and the little supply current needed by MP3 decoder board. So the whole Boombox will run with a stable supply when using a LiIon cell.

The MP3 decoder output inspected via DSO toy oscilloscope. Vpp is bigger than 1V. And also notice: It works!

Since I lack craftmenship capabilities, I used simple cardboard for putting the stuff together so far. The output of the MP3 decoder passes through a 20kOhm stereo potentiometer so the output volume will be adjustable.

Hot glue is working very well to keep the components in place.
Since the step-up PCB and the MP3 decoder will draw small amounts of current even in off-mode, I added an on-off-switch between the positive terminal of the battery and the positive input of the TD8208 board.

Not pretty, but working. The display is running multiplexed at a quite low frequency, thus not the whole information is readable with a too short shutter time of the camera.

Then connected everything together. The best thing is it worked immediately! Well, kind of. The volume was a bit too low and the sound distorted. Reviewing everything I found that I soldered the PNP transistor the wrong way - it needs to be emitter against emitter. After that change - wow, that is loud! And the sound quality is nice, too. Except for the prominent hissing noise / white noise at low volume.

And then the PAM8403 PCBs arrived. Soldered one board in unmodified for a first fast test. Have a look at its small size compared to the AB-amp!

So the first draft version of the Boombox can be closed now. This is the front view. Need to decorate it a little, it already looks a bit like No. 5 or Wall-E :)

And this is the back view. I added some Velcro to 'the lid' so the battery can be easily accessed. But since I plugged the cell in a few days ago, its voltage just dropped by 0.2V to 3.9V even with prolonged usage (with the AB amp before as well, no recharge done since plugging it in the first time). The circuits thus are very efficient.

According to the PAM8403 datasheet, even if the Class D amplifier is working filterless, some components should be added to reduce EMI. In all cases, the power supply should have added capacitance of about 1000µF. I didn't want to add electrolytic capacitors as they tend to age, so I used two additional 100µF ceramic capacitors in parallel.
Next Diodes Inc. suggests to use ferrite beads in the lines to the loudspeakers and also 220pF capacitors to ground. This shouldn't be needed for wires less than 20cm long, but well - I don't want to disturb the neighbourhood with a 2*3W sender (the PAM amp switches with 260kHz and the harmonics of this frequency will be disturbed).

Update 25.09.2015: Now with some denoising - the signal lines to and from the potentiometer were receiving noise from other components. The MP3 decoder board isn't shielded at all, so over a layer of capton tape I added some copper foil and soldered it to GND as well, like the copper foil around the potentiometer wires. The PAM8403 PCB got 100µF and 10µF additional ceramic capacitos for proper decoupling. The GND and positive connections of the step-up-boards are done via ferrite beads. The cables for the GND and plus connections of the TD8208 stepup are thicker now. An additional step-up (BL8530) now supplies power to the MP3 board and is fed directly from the LiIon battery as well. This leads to massively less noise. Make sure to have some shielding in place and make the wires as short as possible.
Oh, and using a CD75 4,7µH power inductor instead of the 22µH for the TD8208 decreases noise quite a lot. The datasheet just has some complex formulas for calculating a suitable dimension and makes no suggestions about the proper range for the inductors.
Next step for improvement is a so-called Pi filter between the step-up boards and the periphery. This is a simple solution with ferrite beads, where I added 1µF ceramic capacitors between the + and - lines - one before and one after the ferrite. This helps filtering quite a lot of humming and noise, too.
Now I'm satisfied as the sound quality is very acceptable for a mobile MP3 speaker.

Update 03.10.2015: Finally, the improved wooden version of the PAM8403 mobile Boombox in action. Please bear in mind that the cellphone microphone doesn't have adequate frequency response and the real sound is different, it is actually really good. Depending on the location where you put the box the sound even improves as the sound body will be extended. On a closed bucket, the bass is much more pronounced, for example. The box is loud enough to fill a huge room like kitchen or living room so that the people in there need to shout in order to understand each other! :)

Update 30.09.2015: Today my new saw, some glue for wood and some wood arrived. As the proof-of-concept works, it is time to make a more solid enclosure. Now waiting for the glue to dry so I can continue. :)

Update 01.10.2015: And now nearly finished. Everything is working and the sound significantly improved.

Still no real beautiful design object, but far better than being made only out of cardboard.

Only little left on the todo-list. Fix the battery, add a USB-charger (I think I have a few ;) ). And maybe make a lid from wood to, either to slide in or to flip.

Update 02.20.2015: Done. Charger works. Cotton / wool filling for the empty space to dampen the backward reflections of the speakers massively improves the sound. Unbelievable what this little sucker spits out now. Defined bass, clear heights, very transparent sound. Only a proper lid is missing, it currently is improvised with cardboard again - which is ok, but ... :)

Update 04.10.2015: First real-life test on a big open soccer field. Training for a choreography in dog school, the DIY Boombox had to take care of the music. In 50m distance it was still nicely audible. After two hours of straight usage, the battery voltage fell to 4.04V, starting from 4.14V. That is only very few percent of the battery's capacity (you have to keep the discharging curve of a LiIon battery in mind). Amazing!

And now with a proper lid. Finished! :)

Update 13.11.2015: I'll build three boom boxes - at least, now that several speakers lie around here. This is a Boombox made with Peiying PY-1010C. allegedly RMS 60W. Fed with PAM8403 currently gives nice bass and it is really loud. Have some 2x15W PAM8610 in the reception pipeline, also a TDA7492 amp. For the TPA3116D2 I have some better Blaupunkt GTx 542 SC; that will get a blog article of its own though as the power supply will be interesting there.

Of course, a clip of this beauty at work is available, too. This is during the first test.