Skip to main content

GR-CITRUS Special Project: Play MP3, WAV Files with Micro SD

Overview

Play MP3 and WAV format files saved on a Micro SD. As the audio is played while reading the file, the file size is not limited as long as the capacity of the Micro SD can handle it. Note that boards equipped with 32-bit microcontrollers such as GR-SAKURA and GR-CITRUS can play MP3 files, but boards such as GR-COTTON and GR-KURUMI can not play MP3 files.

Preparation

Prepare a Micro SD card and a piezoelectric sounder for storing music files.

micro-sd-storage
piezoelectric-sounder

However, because the sound is small with a piezoelectric sounder, the recommended configuration is to use a stereo mini jack sold by Akizuki Denshi, and connect a speaker with an amplifier or an earphone.

stereo-mini-jack

GR-SAKURA & GR-KAEDE

The Micro SD socket is installed on the GR board from the beginning, so prepare the board and the USB cable. Audio signals are output from pins 6 and 7. Both pins are the same audio signal. Connect as shown in the image on the right.

For piezoelectric sounders, connect to pin 6 and GND. The connection is simple but the sound is small.

piezoelectric-sounder-preparation
Piezoelectric Sounder GR-SAKURA/GR-KAEDE
Connect to 6 or 7
Connect to GND

For stereo jacks: Connect the jack to the breadboard and connect it to the board with a wire. Connect pin 6 and GND to the R and G of the jack respectively. Also, pin 7 and GND to L and G respectively. It becomes stereo if it connects.

play-music-prepare-jack-2
Speaker GR-SAKURA/GR-KAEDE
L 7
R 6
GND GND

GR-CITRUS

It is convenient to connect a WA-MIKAN board which is equipped with a Micro SD socket. The WA-MIKAN board can be purchased from Akizuki Electronics.

Since the audio signal is output from pin 0, connect a piezoelectric sounder or stereo jack using the example of GR-SAKURA mentioned above. There is one wire in the picture, but the L of the stereo jack is connected to pin 0 of GR-CITRUS.

prepare-music-with-gr-citrus
Speaker GR-CITRUS
L OR R 0
GND GND
Piezoelectric Sounder GR-CITRUS
Connect to 0
Connect to GND

GR-COTTON & GR-KURUMI

It is necessary to connect the module of Micro SD socket. When using the Micro SD DIP kit sold by Akizuki Electronics, connect as follows. Since audio signals are output from pins 3 and 5, connect a piezoelectric sounder or stereo jack using the example of GR-SAKURA described above.

prepare-sdmodule-with-gr-cotton
Speaker GR-COTTON/GR-KURUMI
L or R 3
R or L 5
GND GND
SD Side Pin Pin Name GR Board Side Pin Remarks
1 DAT2 None  
2 CD/DAT3 10 SS
3 CMD 11 MOSI
4 VDD VCC or +3V  
5 CLK 13 SCK
6 VSS GND  
7 DATA0 12 MISO
8 DATA1 None  
9 For Detection 9 Even with GND fixed OK
10 For Detection GND  

Create a Project with the Web Compiler

There is a template for playing back sound from an SD card in the Web compiler, just select a template for the board to be used, create a project, build it, and write a bin file.

sd-music-web-compiler