Introduction: Audio Alert
The PCB I designed is named Audio Alert. This board is placed between a stereo audio source and a stereo audio consumer such as an FM transmitter or amplifier. When the board wirelessly receives an encoded message it breaks into the audio stream from the current source and plays the MP3 sound clip related to the message received. After the clip finishes playing the board switches back to the original source (in my case an iPod.)
I designed this board as a companion board for a board I designed to detect when my woodshop dust collector is full. Even though the dust collector full board would turn on a flashing strobe, I would still occasionally not notice it. The shop is quite loud when the dust collector and other stationary tools are running so I’m almost always wearing my hearing protector with a built-in FM receiver. Using this board I now hear “Dust collector full” though my hearing protector. See https://www.instructables.com/id/Dust-Collector-F...
The mcu used is an ATmega328p. The mcu receives notification from an RFM69CW transceiver. The audio switch is an I2C controlled PT2314 chip. The PT2314 is a 4 to 1 stereo switch. The board exposes 2 of the 4 possible inputs as standard 3.5mm stereo jacks. A 3rd source is an onboard MP3 player chip, and the 4th source is unused. The output is through a standard 3.5mm stereo jack.
The MP3 player has 3 possible sources: SD card, USB Stick, and NOR Flash.
The MP3 player is the same YX5200-24SS chip found on many DF Player modules (although most of the cheaper versions of this module use counterfeit chips that lack all of the functionality of the original chip.) The major difference of this implementation using the YX5200-24SS chip is that it is stereo and it supports NOR Flash EEPROM.
You can preload the NOR Flash with MP3 clips or use either of the other sources. At startup the MP3 player will default to USB if it’s available, followed by the SD card, and then NOR Flash. You can modify the software to change the source precedence, or have the MP3 source based on the message received.
As programmed the external input is passed through to the output. As with the MP3 source, this behavior can be changed in software. Also volume, balance, treble, and several other audio switch features can be controlled through the software.
The board also has the option of adding a headphone amplifier module. I use the amplifier in my configuration because the output feeds an FM transmitter and the transmitter performs better with the amplifier than when it’s fed line level audio.
All of the unused pins have been brought to the edge of the board. The board has an I2C connector with an interrupt line for future development (display, keypad, etc.. )
The schematic is enclosed in the next step.
As with the other boards I’ve designed, this board’s gerber files are shared on PCBWay. https://www.pcbway.com/project/shareproject/Audio_...
A 3D printed enclosure is available on Thingiverse: https://www.thingiverse.com/thing:3102114
Step 1: Instructions for Assembling the Board
Instructions for assembling the board (or almost any small board) follows. In the following steps I'm assembling a board without the optional headphone amplifier.
If you already know how to build an SMD board, skip to step 13.
Step 2: Gather Parts
I start by taping a piece of paper to the worktable with labels for all of the very small parts (resistors, capacitors, LEDs). Avoid placing capacitors and LEDs next to each other. If they mix, it may be hard to tell them apart.
I then populate the paper with these parts. Around the edge I add the other, easy to identify parts.
(Note that I use this same piece of paper for other boards I've designed, so only a few of the locations in the photo have parts next to/on the labels)
Step 3: Mount the Board
Using a small piece of wood as a mounting block, I wedge the PCB board between two pieces of scrap prototype board. The prototype boards are held to the mounting block with double stick tape (no tape on the PCB itself). I like using wood for the mounting block because it’s naturally non-conductive/antistatic. Also it’s easy to move it around as needed when placing parts.
Step 4: Apply Solder Paste
Apply solder paste to the SMD pads, leaving any through hole pads bare. Being right handed, I generally work from top left to bottom right to minimize the chances of smearing the solder paste that I’ve already applied. If you do smear the paste, use a lint free wipe such as those for removing makeup. Avoid using a Kleenex/tissue. Controlling the amount of paste applied to each pad is something you get the hang of through trial and error. You just want a tiny dab on each pad. The size of the dab is relative to the size and shape of the pad (roughly 50-80% coverage). When in doubt, use less. For pins that are close together, like ICs in a TSSOP package, you apply a very thin strip across all of the pads rather than attempt to apply a separate dab to each each of these very narrow pads. When the solder is melted, the solder mask will cause the solder to migrate to the pad, kind of like how water won’t stick to an oily surface. The solder will bead or move to an area with an exposed pad.
I use a low melting point solder paste (137C Melting Point)
Step 5: Place the SMD Parts
Place the SMD parts. I do this from top left to bottom right, although it doesn’t make much difference other than you’re less likely to miss a part. The parts are placed using electronics tweezers. I prefer the tweezer with a curved end. Pick up a part, turn the mounting block if needed, then place the part. Give each part a light tap to ensure that it’s sitting flat on the board. When placing a part I use two hands to aid in precise placement. When placing a square mcu, pick it up diagonally from opposite corners.
Inspect the board to make sure any polarized capacitors are in the correct position, and all chips are oriented correctly.
Step 6: Time for the Hot Air Gun
I use a YAOGONG 858D SMD Hot Air Gun. (On Amazon for less than $40.) The package includes 3 nozzles. I use the largest (8mm) nozzle. This model/style is made or sold by several vendors. I’ve seen ratings all over the place. This gun has worked flawlessly for me.
I use a low temperature solder paste. For my model gun I have the temperature set to 275C, airflow set to 7. Hold the gun perpendicular to the board at about 4cm above the board. The solder around the first parts takes a while to start melting. Don’t be tempted to speed things up by moving the gun close to the board. This generally results in blowing the parts around. Once the solder melts, move on to the next overlapping section of the board. Work your way all around the board.
Step 7: Reinforce If Needed
If the board has a surface mounted SD card connector or surface mounted audio jack, etc., apply extra wire solder to the pads used to attach it to the board. I’ve found that solder paste alone isn’t generally strong enough to secure these parts reliably.
Step 8: Cleaning/removing the SMD Flux
The solder paste I use is advertised as being “no clean”. You do need to clean the board, it looks much better and it will remove any small beads of solder on the board. Using latex, nitrile, or rubber gloves in a well ventilated space, pour a small amount of Flux Remover into a small ceramic or stainless steel dish. Reseal the flux remover bottle. Using a stiff brush, dab the brush in the flux remover and scrub an area of the board. Repeat till you’ve entirely scrubbed the board surface. I use a gun cleaning brush for this purpose. The bristles are stiffer than most tooth brushes.
I pour the unused flux remover back in the bottle. I don’t know if this is correct or not. I haven’t noticed any issues related to doing this.
Step 9: Place and Solder All of the Trough Hole Parts
After the flux remover has evaporated off the board, place and solder all of the trough hole parts, shortest to tallest, one at a time.
Step 10: Flush Cut Through Hole Pins
Using a flush cutter plier, trim the through hole pins on the underside of the board. Doing this makes removing the flux residue easier.
Step 11: Reheat Through Hole Pins After Clipping
For a nice appearance, reheat the solder on the through hole pins after clipping. This removes the shear marks left by the flush cutter.
Step 12: Remove the Through Hole Flux
Using the same cleaning method as before, clean the back of the board.
Step 13: Apply Power to the Board
Apply power to the board (6 to 12V). If nothing fries, measure 5V and 3.3V from the large tab on the two regulator chips.
Step 14: Load the Bootloader
This step sets the processor speed, clock source and other fuse setting as well as loading the bootloader.
You’ll need an ISP for this step. You can use any ISP such as Arduino as ISP, provided the ISP is 3v3. The ISP that I designed has a 3v3 ISP connector. See https://www.instructables.com/id/AVR-Programmer-W...
Very important: You must use a 3v3 ISP or you may damage components on the board.
From the Arduino IDE Tools menu, select “Arduino Pro or Pro Mini” for the board, and “ATmega328P (3.3V 8MHz)” for the processor.
Disconnect power from the board if you use a 6 wire ISP cable.
Connect the ISP cable from the ICSP header on the board to the 3v3 ISP. Set the DPDT switch near the ICSP header to "PROG".
Select “Arduino as ISP” from the Tools->programmer menu item (or whatever is appropriate for the ISP you’re using), then select burn bootloader. In addition to downloading the bootloader, this will also correctly set the fuses. In the photo, the board on the left is the target. The board on the right is the ISP.
Disconnect the ISP cable.
Step 15: Upload the Sketch
Attach a 3v3 TTL serial adapter module to the serial connector on the board.
Update: 18-Mar-2021: I've made some minor changes to the sketch to fix a bug that occurs when the alert is already playing when it receives another message. Contact me if you'd like the updated version of the sketch.
Download the software.zip attached to this step. You can either mix these sources into your Arduino folder or change the Sketchbook Location in the Arduino preferences to point to these sources. The preferred method is to keep these sources separate.
Verify/Compile the AudioAlertRFM69 sketch.
Upload the sketch if it compiles without any errors.
Step 16: Create the MP3 FAT Hex File
This step assumes you plan on using the onboard NOR Flash chip as a MP3 source. You can skip to step 18 if you’re not planning on using the NOR Flash chip as an MP3 source. This means that you will be using an SD card or USB stick as the MP3 source.
The goal of this step is to get an image of a FAT16 file system containing the MP3 clips to be played from NOR Flash as the source onto the NOR Flash EEPROM. The file order within the FAT root directory determines the MP3 index you will reference from the software when playing an alert.
The MP3 FAT Hex file can be created using my Mac OS FatFsToHex application.
If you own a Mac, or have access to one, download the FatFsToHex application from GitHub: https://github.com/JonMackey/FatFsToHex
Note that you don't have to build the application, there's a zip file in this repository containing the built application.
After you've decided on the MP3 files you'd like to play on the board, launch the FatFsToHex application and drag the files into the file list. Set the order of play by arranging the files in the list. If this is a set of MP3s you think you may use more than once, save the set to disk using the save command (⌘-S). Export (⌘-E) the MP3 hex file to an SD card, naming the file FLASH.HEX. This should be the only file on this SD card.
I doubt anyone will actually build one of these boards, but if someone does, and you get stuck creating the MP3 hex file, contact me and I'll build it for you.
Step 17: Load the MP3 Files Onto the NOR Flash EEPROM
For this step you need an Arduino as ISP (or the board I designed), and a 5 or 6 wire ISP cable. Disconnect power to the board if you use a 6 wire cable.
If you're not using the ISP I designed, the ISP you use needs to be loaded with my Hex Copier sketch and it needs to have a SD card module as per the instructions in the HexCopier sketch. The HexCopier sketch can be run on any Arduino with a ATmega328p (and several other ATMegas.) This sketch is in the GitHub FatFsToHex repository.
Set the DPDT switch near the NOR Flash EEPROM to PROG. Connect the ISP cable between the 3v3 ISP and the NOR FLASH header using the ground pin to determine the correct orientation of the connector. This is the blue connector in the photos.
Once power is applied with the SD card inserted, and the baud rate of a serial monitor set to 19200, send the sketch a letter C and a return character ("C\n" or "C\r\n"), to start the copy. See the screen shot for the expected response from the copier sketch running on the ISP.
Note that the FatFsToHex application has a serial monitor (see photo.)
Step 18: Test the Board
Connect an iPod or some other sound source to the 3.5mm audio jack labeled “IN”. Connect a pair of headphones to the jack labeled “OUT”.
Apply power to the board. Play tracks on the iPod. You should hear what is being played through the headphones.
Attach a 3v3 TTL serial adaptor to the board. Set the baud rate to 9600.
Play an alert by sending the board “p1”. You should hear the alert cut into whatever is coming from the iPod. There are too many test parameters that can be sent serially to the board to describe here. Look at the AudioAlertRFM69 sketch’s loop function. You’ll see a switch statement that lists all of the test parameters.
To test the transceiver you need another board such as the remote control described in my Varmint Detector instructable or the dust collector full board I designed. See https://www.thingiverse.com/thing:2657033 These boards can be programmed to send messages to the audio alert board.
You can also build a test set on a breadboard as shown in the photos. I’ve designed breakout boards for the RFM69CW and HCW. These boards provide level shifting so that you can use these transceivers with a 5V mcu. (The RFM69 is 3v3.)
If anyone in the US is interested in acquiring any of my boards, bare or built, hard to locate parts, contact me (via message, not as a comment.) As noted in the introduction, the board Gerber files are shared on PCBWay.
Participated in the