-
Notifications
You must be signed in to change notification settings - Fork 0
Audio Module Construction
The audio module consists of a Raspberry Pi that’s responsible for input and output. Three buttons allow users to control playback (next, previous, and play/pause), and an LCD displays information about the current piece of audio. The LCD is also connected to a potentiometer to control its contrast.
Since the Raspberry Pi’s built-in audio-output is very low quality and noisy, a dedicated DAC (digital to analog) “hat” (i.e. Raspberry Pi-compatible board) is added to produce a better audio signal at line-level amplitude.
A potentiometer is used as volume control, after which the signal is passed through a switched mini-jack, and then to an amplifier that drives the audio module’s speaker. If headphones are plugged into the mini-jack, the amplifier and speaker are bypassed.
The amplifier has a trimpot as its own output volume control, allowing the maximum speaker volume to be set.
Some parts can be substituted with alternatives, but the following instructions assume that the parts listed below are used. The parts need not be bought from the mentioned retailers; the links are only given for reference.
The following assumes you know the basics of painting, soldering, woodworking, etc. in order to fully assemble a Klogskabet audio module.
Additionally, the laser-cut audio module front panel and brackets should be prepared.
As mentioned, the following instructions assume that the exact items on the list above have been acquired. However, some components can be substituted with very similar alternatives though they may require alterations to the overall design. Notable alternatives are:
- The JustBoom DAC can be replaced with a HiFiBerry DAC+ (standard) (requires different software setup, and possibly different wiring)
- The AdaFruit MAX9744 20W amplifier can be replaced with any other simple amplifier circuit that can take line-level input and drive a 8Ω speaker.
- The speaker can be replaced with a a 13.5cm, 8Ω speaker, though the laser cut speaker bracket will need to be redesigned.
- The switched mini-jack can be replaced with any other switched mini-jack (stereo or mono), provided wiring is altered to match.
- The LCD can be replaced with another 2 rows by 20 character Hitachi HD44780-compatible display with LED backlighting (or no backlighting), though the laser cut front panel and LCD bracket may need to be altered to fit. The display can in theory be any Hitachi HD44780-compatible LCD, provided the audio player software is altered to account for changes in row/character resolution. Note: LCDs with cold-fluorescent backlighting draw significantly more current, and should not be powered through the Raspberry Pi’s pins!
- The 1kΩ volume potentiometer (VR1) can be either logarithmic or linear.
- The 10kΩ LCD contrast adjustment potentiometer (VR2), can be replaced with any 10kΩ potentiometer or trimpot, though it may need to be mounted differently to the front panel.
- The 3.5mm mini-jack pig-tail cables can be replaced assembled from parts instead of bought as cable assemblies.
- The volume knob can be replaced with any other volume knob that fits the overall look of the module, and that fits on the VR1 potentiometer’s shaft.
- The push buttons can be replaced with other momentarily-closed push buttons, provided they fit the laser cut front panel and overall look, or the front panel is altered to match.
- The power supplies for the Raspberry Pi and amplifier can replaced with any other compatible power supply (i.e. ones that supply the required voltage and current).
- All solder connections can be replaced with pin headers/crimp sockets - and vice versa. The following instructions make use of both techniques to leave the circuit fairly friendly to disassembly and modification, but everything could be soldered in place instead or use crimp connections.
For software setup and testing
- Computer monitor with HDMI input
- HDMI cable
- USB keyboard
- Accessible WiFi or Ethernet cable
For electronics assembly and testing
- Soldering iron + solder
- Wire stripper
- Cutting pliers
- Heat-shrink tubing and heat gun
- Multimeter (recommended)
- A pair of headphones
For module assembly
- Paint (same as for furniture)
- Black paint for button symbols
- Strong wood glue
- Sandpaper (coarse and fine grit)
- Superglue
- Sharp knife
- 13mm hex socket
- Adjustable spanner
- 1.5mm Allen wrench (unbrako) to secure the volume knob’s grub screw
- Short wood screws for attaching components
- Screwdriver
- Hacksaw blade
- Cable ties and cable tie pads
- Hot glue gun or silastic
See the general Raspberry Pi setup instructions and the readme for the receipt module software.
The basic audio assembly goes as follows: The line-out signal from the DAC is volume-controlled by the 1kΩ logarithmic potentiometer; from there it’s connected to the switched mini-jack; then to the amplifier’s line-in; and finally to the speaker.
If headphones are plugged into the mini-jack, the speaker is cut out, and audio only plays over the headphones.
- Solder pin headers to the top of the JustBoom DAC’s two long rows of through-holes. These are pass-through to the Raspberry Pi’s GPIO pins when the DAC hat is mounted. Note: Not all the pins will be (or should be!) used, so it’s not necessary to add and solder all 40 pins. Refer to the pinout diagrams below. Note: The JustBoom DAC comes with 4 threaded plastic standoffs and plastic screws and an IR receiver. The IR receiver won’t be used, but keep the plastic standoffs and screws for later!
- Assemble the amplifier (solder on capacitor and screw terminals)
- Cut a 3.5mm mini-jack pigtail cable down to about 30cm (and keep the piece of cable you cut off for later).
- Solder the ends of the pigtail cable to the 1kΩ logarithmic potentiometer: Ground/sleeve lead to pin 3. Left and right leads to pin 1 (since the output is mono anyway)
- Cut the loose piece from before down to about 30cm.
- Solder the loose length of cable to the 1kΩ logarithmic potentiometer: Ground/sleeve lead to pin 3 (same as above). Left and right leads to pin 2.
- Solder the other end of the loose length of audio cable to the switched mini-jack socket: Ground/sleeve lead to pin 1. Left lead to pin 2. Right lead to pin 5. (Alternatively, pins 2 and 5 can be connected with a bit of wire, and both left and right leads connected to either pin)
- Solder another 3.5mm mini-jack pigtail cable to the switched mini-jack socket: Ground/sleeve to pin 1. Left and right leads to pin 4.
- Solder medium gauge wires to the speaker’s terminals. Also tin the other end of the wires to prevent fraying.
- Screw the other ends of speaker wires into the amplifier’s left or right speaker output terminal blocks.
- Test the audio assembly:
- Mount the DAC on the Raspberry Pi
- Plug the mini-jack cable running to the potentiometer into the DAC’s line-out jack.
- Plug the other mini-jack into the amplifier’s line-in jack.
- Ensure the volume potentiometer is turned to low.
- Ensure the amplifier’s volume potentiometer is turned to roughly 50%.
- Plug in the Raspberry Pi’s power supply and let it boot
- Plug in the amplifier power supply
- The Raspberry Pi should begin playing a track automatically once it boots. Adjust the volume potentiometer and ensure the sound/music is coming through the speaker. Also ensure that turning the potentiometer clockwise increases volume, and counter-clockwise lowers it (if not, pins #1 and #3 on the potentiometer should be swapped).
- Plug in a pair of headphones (after lowering the volume, just to be safe), and ensure that audio plays in the headphones only (i.e. the speaker is cut out).
- Once satisfied, turn off all the components again. If things do not work, check all wiring, and that the Raspberry Pi’s software has been correctly installed and running.
The three buttons make use of the Raspberry Pi’s internal pull-up resistors, and are arranged to connect a GPIO pin to ground when pressed (i.e. momentary pull-low). I.e. the buttons share common ground on one side, but individual pins on the other.
- Cut off one end of 4 female-female jumper wires and strip 3-5mm of insulation.
- Prepare 3 push buttons by soldering a jumper wire to one of each button’s terminals.
- Solder the other terminal of the each button in series with small lengths of wire.
- Solder the 4th jumper wire to the series-connected side of one of the push buttons.
- Plug the free ends of the jumper wires onto the pin headers on the DAC: Series-connected to pin #9 (ground) The remaining three wires to pins #11, #13, and #15 (GPIO 17, 27, and 22 respectively)
- Test the button assembly:
- Turn on the Raspberry Pi and amplifier, and let the Raspberry Pi boot
- Test each of the buttons. One should go to the next track (pin #11), one should act as play/pause (pin #13), and one should go to the previous track (pin #15).
- Once satisfied, turn off all the components again. If things do not work, check all wiring, and that the Raspberry Pi’s software has been correctly installed and running.
The LCD is a Hitachi HD44780-compatible parallel data bus driven display. It’s driven in 4-bit mode, with its R/W pin tied to ground. The LCD is also equipped with a 5V LED backlight with a built-in current-limiting resistor.
- Solder pin headers to the back of LCD board (i.e. pointing backwards from the screen itself). Note: Not all the pins will be (or should be!) used, so it’s not necessary to add and solder all 40 pins. Refer to the pinout diagrams below.
- Prepare 2x 1-to-3 spliced female-female jumper wire harnesses
- Connect the single end of one the spliced cables to pin #4 (5V DC) on the DAC.
- Connect (or cut and solder) one of the three loose ends to pin #1 of the 10kΩ linear potentiometer.
- Connect the other two loose ends to pins #2 and #16 of the LCD
- Connect the single end of the second spliced cable to pin #6 (ground) on the DAC.
- Connect (or cut and solder) one of the three loose ends to pin #3 of the 10kΩ linear potentiometer.
- Connect the other two loose ends to pins #1 and #15 of the LCD
- Connect a female-female jumper wire from pin #2 of the 10kΩ linear potentiometer to pin #3 of the LCD.
- Test the LCD power assembly:
- Turn on the Raspberry Pi.
- The display should light up (as its backlight is connected).
- There will not be anything readable on the display, since no data lines are connected, but you should see one full row of black blocks. If both lines are black blocks, the contrast is set too high; if nothing shows up, the contrast may be too low. Turn the potentiometer to adjust contrast.
- Once satisfied, turn off all the components again. If things do not work, check all wiring. If the display does not show a full row of blocks, regardless of contrast, it may be defective.
- Now connect the the remaining pins on the LCD to the remaining pins on the DAC in the following order: LCD pin #4 (RS) → DAC pin #29 (GPIO 05) LCD pin #5 (R/W) → DAC pin #39 (ground) LCD pin #6 (Enable) → DAC pin #31 (GPIO 06) LCD pin #11 (DB4) → DAC pin #33 (GPIO 13) LCD pin #12 (DB5) → DAC pin #37 (GPIO 26) LCD pin #13 (DB6) → DAC pin #38 (GPIO 16) LCD pin #14 (DB7) → DAC pin #36 (GPIO 20)
- Test the full assembly:
- Turn on the Raspberry Pi and let it boot up.
- Once booted, the LCD should display the title of the current track, and the current timestamp. Adjust the contrast as necessary to have high contrast while minimizing flickering during screen updates (updates happen each second while a track is playing - since the timestamp updates). Flickering means the contrast is probably set too low.
- Once satisfied, turn off all the components again. If things do not work, check all wiring, and that the Raspberry Pi’s software has been correctly installed and running. Checking wiring with a multimeter, the following should hold true: 1. Voltage across LCD pins #2 and #1 should be +5V 2. Voltage across LCD pins #16 and #15 should be +5V 3. Voltage across LCD pins #3 and #1 should be between 0V and +5V depending on the contrast adjustment potentiometer’s setting. 4. Continuity between LCD pins #1, #5, and #16, and a DAC ground pin.
- Test-fit the front panel in the furniture to make sure it fits with just a little bit of tolerance (to allow for layers of paint).
- Sand the front of the panel with fine-grit sandpaper to produce a smooth surface (do not sand the back of the panel, as it’ll be used for glue, and is better left rough).
- Paint the front panel (several coats should be applied and each allowed to dry for at least a day; the paint will fully cure/harden over several days). Note: The inner edges of the LCD and mini-jack cutouts should be sanded and painted. Other cutouts can be left unpainted. The speaker grill holes should receive only a single coat, and care should be taken that they don’t get plugged with paint.
- Paint the symbols onto the panel using the stencil, or vinyl cut the symbols and glue them in place.
- Glue the speaker and potentiometer brackets into place on the backside of the front panel. Be sure to carefully align the brackets with the cutouts in the front panel. Allow the glue some time to set.
- Screw the LCD loosely onto its bracket.
- Hold the LCD + bracket in place on the back of the panel to figure out where the bracket should be glued to properly align the LCD screen with its cutout. Mark the bracket’s position.
- Unscrew the LCD from the bracket, and glue it onto the back of the panel in the place you’ve marked. Allow the glue some time to set.
- Mount the mini-jack to its bracket. Its locking nut can be tightened by hand, by turning the jack itself, rather than the nut.
- Screw (or glue, using epoxy or superglue) the headphone jack bracket in place, again making sure to center/align it well with the cutout.
- Mount the speaker to its bracket. Be careful not to over-tighten the screws, but make them tight enough to hold the speaker so it won’t vibrate when playing.
- Mount LCD with four screws, making sure it’s still centred and aligned to its cutout.
- Carefully unmount the DAC from Raspberry Pi.
- Screw the Raspberry Pi into place with two screws and standoffs making sure its micro-USB power port can be accessed (align it so the power cable will run between the volume potentiometer bracket and the LCD bracket)
- Remount the DAC, and use 2 plastic threaded standoffs from the DAC to secure its “free“ side to the Raspberry Pi.
- Cut the two remaining plastic standoff in half, being careful to leave a clean, flat cut.
- Screw 3 of (halved) plastic standoffs onto the amplifier board as “feet”
- Use superglue to adhere the 3 plastic feet to the back of the front panel (making sure the surface is cleaned of splinters and the glue binds well).
- Mount the right-angle bracket in a convenient place using glue or screws.
- Mount the LCD contrast adjust potentiometer to the bracket.
- Unclip the switch housings from the push buttons, and insert the push buttons from the front, tightening the nuts from the back with a spanner. If the buttons came with a rubber gasket, that can be removed. Click the switch housings back in place. Note: After this, take care when moving/placing the panel, as it’ll have buttons standing slightly proud of the front.
- Mount the 1kΩ volume potentiometer - use the hex socket to tighten the nut holding the potentiometer in place. Note: After this, take care when moving/placing the panel, as it’ll have the potentiometer shaft sticking out the front.
- Test the whole assembly.
- Secure the loose wires with cable ties and/or hot glue/silastic. Hot glue/silastic is especially useful to hold the pin header-attached cables in place.
- Measure how much to cut off of the volume potentiometer’s shaft to fit the volume knob, and cut it to size (this can be done - carefully - with a hacksaw blade).
- Attach the volume knob, using a couple of sheets of paper to give it a bit of clearance to the panel itself.
- Plug in the power lines to the Raspberry Pi and amplifier, and secure the cables so they won’t be pulled out when mounting the module in the furniture.
And you're done!