Arduino Audio Player
by Andre-Microcontroller in Circuits > Arduino
77 Views, 0 Favorites, 0 Comments
Arduino Audio Player
This is your ultimate and complete audio player. It is a fully open source, programmable player with a powerful ARM Cortex M0 processor and included 3W amplifier. The player is complete with microSD card reader, sensor input, test button, programmable led and a 10-position switch (which you can use for volume setting, mode select or any other purpose). To make it even more versatile, the player has an RTC to give you the possibility to play your audio at certain times and dates. The audio player is designed to fit in a standard enclosure. Front and back panel are available.
You can use this player for many different applications, such as doorbell with different sounds, burglar alarm, storytelling when entering a room, talking garbage can, animated sounds, talking clock, etc.
The player is affordable and easy to build. The design consists of a carrier board on which you can plug-in readily available modules from Adafruit.
With Arduino IDE you can program the player and on the microSD card you can store the audio files in WAV format.
Supplies
The Audio Player Carrier Board (Antratek ATE-550) is complete with connectors, switches, components and a DC/DC converter.
The Feather M0 Adalogger (Adafruit Product ID: 2796) is an 'all-in-one' Cortex M0 data logger (or data reader) with built-in USB connector and LiPo battery charger. It's an Adafruit Feather M0 with a microSD holder. The heart of the Feather M0 is an ATSAMD21G18 ARM Cortex M0 processor clocked at 48 MHz and with 3.3V logic, the same one used in the Arduino Zero/M0.
It has an I2S bus and an SD card holder with its own SPI interface with which you can play audio files. I2S (not to be confused with I2C) is a digital audio protocol used to exchange audio data between chips. The Arduino Sound Library is available to play and analyze audio data.
Adalogger supports microSD cards up to 32GB.
The MAX98357 I2S Amp Breakout (Adafruit Product ID: 3006) takes standard I2S digital audio input and, not only decodes it into analog, but also amplifies it directly into a speaker. This small mono amplifier is surprisingly powerful - able to deliver 3.2 Watts of power into a 4 ohm impedance speaker.
The RTC module is optional. If you want to play audio which is time dependent, you can add this module.
DS3231 Precision RTC (Adafruit Product ID: 5188) is a compact, breadboard-friendly breakout. It has an extremely accurate I2C-integrated Real Time Clock (RTC) with a Temperature Compensated Crystal Oscillator (TCXO). With a CR1220 12mm coin cell (not included) plugged in, you can get years of precision timekeeping, even when main power is lost.
Add Feather to Carrier Board
You can use the included header connectors to solder on the Feather module and plug it into the carrier board.
Add Amp
Solder the included header on the module, but do not use the terminal block. Instead solder two bare wires on top and screw these wires on the terminal block of the carrier board.
Add RTC
For the Audio Player you can use the DS3231 module with or without STEMMA QT/Qwiic connectors.
It is important you plug it upside down into the Carrier Board. You have to solder the 8-pin header on top of the module. In this way it is easier to (re)place the CR1220 battery.
Connections
You can connect a speaker by using a 3.5mm mono audio plug. Or use a speaker with plug, like this one from Monacor.
The sensor input is a 3-pin female AMPMODU MTE connector. Pin 2 is connected to D6 of Adalogger and has 10K to GND. Pin 3 is connected to 3V3. If your sensor has a switch as output, it can be connected to pin 2 and 3. To connect a sensor to this input, you can use for example cable assembly 1-2267795-2 from TE Connectivity.
To power the audio player 9 Vdc to 24 Vdc can be used with 1 A max. A standard power supply with a 5.5x2.1mm, center-positive barrel jack can be used. The power input is protected against reverse voltage and has a current limiting fuse.
First Program
The first program you can use is the ArduinoSound SDWaveFile example. This reads a wave file from the SD card and plays it using the I2S interface to the I2S Amp Breakout board.
The file on the SD card for this example should have the name MUSIC.WAV. You can convert many sound files to a wav-file by using for example Audacity. In Audacity use as output file WAV (Microsoft) Signed 16-bit PCM.
Use a micro USB cable to connect Adalogger to your PC, load the example, open the serial monitor and you will hear the sound file. To setup the Arduino IDE for Adalogger, see the website of Adafruit.
Program Example 2
Example 2 plays 6 audio tracks, named track001.wav, track002.wav, and so on. At each push on test button or high at sensor input one track is played. At the next push or high the next track is played.
The rotary switch is used to adjust volume and the LED is on during playing.
Downloads
Program Example 3
You can test the RTC by using ds3231 example as described on the website of Adafruit.
Example 3 uses the RTC and is a kind of cuckoo clock. Every hour it plays an audio track. At one o'clock it plays track001, at two o'clock track002, and so on.
Downloads
Enclosure
The Audio Player fits inside a Hammond 1593L enclosure. Front and back panel design are available as PDF and DXF.