Raspberry Pi Media Player and Work Station With an Integrated Speaker




Introduction: Raspberry Pi Media Player and Work Station With an Integrated Speaker

A variety of frames for the Raspberry Pi touch screen are commercially available and published. Most of these solutions are silent, missing an active speaker. Adafruit has recently released a breakout with a I2S DAC & amplifier whichworks well with a RasPi and allows to directly attach a speaker.

So in the following I am describing how to build a Raspberry Pi media player and work station with a Raspberry Pi 2B, the official Raspberry Pi touch screen and an audio system, which consists just of the "Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A" and a 4 Ohm/3 W/3" speaker. It has been tested to be working under Raspian and OpenELEC.

In analogy to a previous Instructable I was using an IKEA tablet stand as frame, this time the model RIMFORSA. It is made from thick bamboo plywood, it is looking good enough to be placed in a living room and allows to place the screen in a nearly upright position. In addition it allows to place the Raspberry Pi and a speaker, and/or other units, inside of the stand, resulting in a clean layout.It has a slot in the back plate, which is nice for the cables, but also would allow, and was intended for, hanging it on a wall.

The device can be either used as a small tablet-type computer (in combination with a keyboard) or as a media player using LibreELEC (OSMC not tested yet). If you are running Raspian Jessie, the keyboard comes quite handy, but is not required for LibreELEC.

The resulting sound is estonishingly good and the system is impressively loud. Using VLC to play MP3s I have to reduce the loudness to about 50-60 %. The I2S amplifier seems (currently) not to be recognized by the ALSA system in Raspian. If required, you may modify the amplifiers gain settings on hardware level (see last step).

A limitation of the MAX98357A is that it is that it has only one speaker output, so if you want to build a stereo system you may need two of them. By default it is mixing the right and left channels.

To turn the device into mobile device you can use a 2A USB power pack (tested).

You may alternatively attach the Pi directly to the back of the touch display. But I prefer to use a Pi case, as this allows better access to the Pi's ports and to build up some distance between the magnetic field of the speaker and the electronics. Especially for the WLAN stick I would fear interferences.

Step 1: Materials Required

To build the device is a rather simple process and can be performed within about an hour.

Materials required:
- IKEA "RIMFORSA" tablet stand (only available at IKEA) (about 13 €/10 GBP)
- Raspberry Pi 2B or 3B w/ SD card (about 40 €)
- a case for the Pi (optional, but helpful; about 8 €)
- a official Raspberry Pi touch screen (about 80 €)
- Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A (about 6.50 €)
- a 4 Ohm speaker, e.g. the "Adafruit Speaker - 3" Diameter - 4 Ohm 3 Watt" (2 €)
- thick, good quality female/female jumper cables to connect the Pi's GPIO with the breakout's header
- a few cm of cable to connect speaker and breakout
- optional: a small keyboard, I use one from Revotec.

- 2 to 3A/5V USB charger with micro USB plug. Get a good one, as the official Pi3 charger.
- a USB/micro USB cable to power the Pi via the touch screen. Use a good, thick cable, as underdimensionized ones may not work well (Rainbow square). You just need a "power cable" version, as no data lines are required.
- an at least 10 cm long "Pi camera cable" to connect the video in port of the touch screen with the video connector of the Pi. You may use the short cable provided with the touch screen if you piggypack the Pi on the touch screen.
- optional: a small piece of plastic to protect the touch screen electronics.
- four M2.5 screws to fix the plastic shield, or the Pi, on the distance pieces on the screen
- two M2.5 x 10 mm screws & nuts and some plastic washers to fix the breakout.
- 2 x 8 or 3 x 10 mm aluminum rods (or similar), four 10 mm M3 screws with nuts to fix them.
- four pieces of plastic or wood, about 2 or 3 mm thick, to be placed between the alu rods and wood

Step 2: Building Procedure

As a first step I marked a rectangular area of 16.8 x 10.2 cm at the center of the front side of the tablet stand, then I cut at the lines and cleaned the edges. As the bamboo plywood is very stable, no additional supporting structures are required. As next the holes to hold the Pi case, the breakout and the speaker were drilled at the indicated positions at the backside. Now a grid pattern was cut out where the speaker shall be placed (see image at Intro). I used a Dremel to cut and mill the bamboo plywood, an surprisingly tough material.

Now the MAX98357A amplifier breakout was assembled and connected to the speakers. This was performed to large extent as described in the according Adafruit instructions, but the for my purpose the header was soldered to the front of the breakout. Now breakout and Pi were connected using jumper cables, but you may also solder the cables directly to the breakout. At least for the lines powering the amplifier and speaker, make sure to use cables of a sufficient thickness.

Connect as following:
- Amp Vin to Raspbery Pi 5V
- Amp GND to Raspbery Pi GND
- Amp DIN to Raspbery Pi #21 (i.e. GP21!)
- Amp BCLK to Raspbery Pi #18
- Amp LRCLK to Raspbery Pi #19

The Pi case and the speaker were fixed to the tablet stand using M3 screws, nuts and plastic washers, the breakout with two M2.5 screws, nuts and plastic washers, as shown in the images.

To protect the electronics of the touch screen controller, a 5.8 x 6.6 cm plastic plate was attached to the touch screen using the provided spacer elements and M2.5 screws. Now the cables were attached to Pi and the touch screen placed in the cutout. It was fixed in the cutout using two 2 x 10 mm aluminum strips, that were fixed with M3 screws at the screw threads on the touch screen housing.The rods may now be fixed using distance pieces of plastic or wood.

Step 3: Raspian and LibreELEC; Ideas for Further Modifications

Raspian Jessi:
I would recommed to install the touch screen and amplifier software before final assembly. Detailed descriptions on this can be found on the Raspberry Pi and Adafruit web sites. Check that everything is working well before final assembly. One potential issue are the connections between GPIO and amplifier. A look on the images may help and make sure that the jumpers are sitting tight on the headers.

As mentioned, with a 3W speaker the system is pretty loud. So for some applications it could make sense to change the gain of the amplifier. You can do this by connecting the GAIN pin with GND or VIN with or without a resistor, as indicated in the Adafruit instructions. Using another speaker, e.g. 8 Ohm/1 W may also help.

Another current limiation is that least in Raspian, currently either the I2S port or the headphone plug is working.

To be able to use the system without an external keyboard, you may want to install a virtual keyboard as "Florence". Details on this can be found elsewere, and there is an easy fix for the current Rapian Jessi/Florence problem.

The touch screen is working with the current version of OpenELEC out of the box. To activate the I2S and the DAC/amplifier you just have to add a few lines to the config.txt file (for further details look here: https://wiki.libreelec.tv/index.php?title=Config.txt)


based on a discussion I found here, I added another two lines, but I am not sure if they are really necessary:

amixer -c 0 set Digital 60%

To be able to modify the volume please install and activate DSP. You may also install the Kodi Audio Mixer add-on and many others. To be able to watch, more precise to hear, some videos you may have to buy a MPEG-2 licence for your RasPi from the Foundations website and enter the code(s) in the Config.txt file. German public TV and ARTE are working without.

So far LibreELEC it works like a charm.

I am currently using the Rii Mini i7 remote control that is working well with KODI. Simplifies handling significantly. You may modify the key definitions, a discussion on this (in german) is found here.

Further possible modifications:

Connecting the SD pin with GND puts the amplifier shut down. If you place a manual switch in the connection line it could allow to save energy (e.g. from a power pack) if the speaker is not used, or to manually mute the system.

Be the First to Share


    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    6 Discussions


    1 year ago

    Thanks for the manual! I didn't really get how you attached the display to the tablet stand without using screws going through the wood to the front side. Can you explain?

    Dr H
    Dr H

    Reply 8 months ago

    Sorry for the late reply.
    I used aluminum rods fixed to the backside of the screen using standoffs to fix the screen in place.

    Dr H
    Dr H

    Reply 1 year ago

    Hi. It is a bit hard to see in the images, but basically it is two aluminum rods screwed to the back of the screen which are a bit longer than the hole in the frame is wide. If I remember right, I placed a bit of foam between rods and the frame to fix it in place. As the frame fixes the position, the rods are just there to omit that the screen gets loose and drops out.


    4 years ago

    what about connecting to smartphone screen.? huhu Dr H

    Dr H
    Dr H

    Reply 4 years ago

    I have not tryed, but maybe it will work via SSH?


    4 years ago

    What do you think of the virtual keyboard? (I found it quite unusable, to the extent that I'm saving my display until I have some full-screen custom application I can use it on that doesn't require a keyboard.)