Arduino Giga R1 WiFi Mini Mp3 Player Module
The Arduino Giga R1 WiFi is a feature-rich board built on the STM32H747 dual-core processor, with WiFi and Bluetooth connectivity, multiple hardware serial ports, and 3.3V logic. Its abundant resources make it an excellent platform for audio projects using the DIYables Mini Mp3 Player module.
What you will accomplish in this tutorial:
- Wire the Mini Mp3 Player to the Giga R1 using hardware serial — no resistor necessary.
- Correctly format an SD card and load mp3 files.
- Program the Giga R1 to play tracks, adjust volume, and navigate a playlist.
- Implement looping, shuffling, and folder-organized playback.
- Read real-time status from the module (current track, volume, play state).

Hardware List
Or you can buy the following kits:
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
The Giga R1 runs at 3.3V logic. No series resistor is needed on the UART lines.
Overview of the Module
The DIYables Mini Mp3 Player module houses the YX5200-24SS decoder. It pulls mp3 files from a micro SD card and drives a small speaker directly (up to 3W) through its built-in amplifier. For higher-fidelity setups, the DAC output pins can feed an external amplifier.
Control is via UART at 9600 baud:
- Complete transport: play, pause, resume, stop, next, previous
- Volume from 0 (mute) to 30 (maximum)
- Six EQ presets: Normal, Pop, Rock, Jazz, Classic, Bass
- Repeat a single track, repeat a folder, repeat all, or shuffle
- Folder-organized playback for categorized audio content
- Advertisement overlay — interrupt and resume seamlessly
- Query the module for its current state at any time
Pin Layout
| Pin | Role |
|---|---|
| VCC | Power input (3.2V – 5.0V) |
| GND | Ground reference |
| RX | Serial data in (from Giga TX) |
| TX | Serial data out (to Giga RX) |
| SPK_1 | Speaker positive (internal amplifier, max 3W) |
| SPK_2 | Speaker negative |
| DAC_R | Right channel line output |
| DAC_L | Left channel line output |
| BUSY | Pulled LOW during playback |
| IO_1 | Short press → previous track; long press → vol down |
| IO_2 | Short press → next track; long press → vol up |

Wiring
We use Serial1 on the Giga R1 WiFi. The board operates at 3.3V so the connection is direct.
| Mini Mp3 Player | Arduino Giga R1 WiFi | Notes |
|---|---|---|
| VCC | 5V | |
| GND | GND | |
| RX | Pin 1 (Serial1 TX) | Direct — matched 3.3V logic |
| TX | Pin 0 (Serial1 RX) | Direct |
| SPK_1 | Speaker + | |
| SPK_2 | Speaker − |
The Giga R1 also has Serial2, Serial3, and Serial4 available if Serial1 is already in use.

This image is created using Fritzing. Click to enlarge image
SD Card Configuration
Prepare the micro SD card before inserting it into the module:
- Format as FAT16 or FAT32.
- Copy mp3 files to the root directory:
- Optionally create numbered folders for organized playback:
Key details:
- Numbering begins at 1, not 0.
- The module assigns track numbers based on the sequence in which files were copied, not alphabetical order of filenames. Format the card first, then copy each file individually in the intended sequence.
- Folder names: 2 digits (01 to 99). File names within folders: 3 digits (001 to 255).
Library Installation
- Connect the Giga R1 WiFi to your computer via USB-C.
- In the Arduino IDE, select Arduino Giga R1 WiFi and the correct port.
- Navigate to the Libraries panel.
- Search for "DIYables_MiniMp3" and install the library by DIYables.

The library is self-contained — no dependencies.
Foundation Code
With the Giga R1's hardware serial, the setup is clean:
Giga R1 — Play a Track
Steps
- Load the SD card, wire the module, and connect the Giga R1 via USB-C.
- Select Arduino Giga R1 WiFi and upload.
Playback Reference
| Function | Description | Code |
|---|---|---|
| play(n) | Play track number n | mp3.play(1) |
| playNext() | Advance to next | mp3.playNext() |
| playPrevious() | Return to previous | mp3.playPrevious() |
| pause() | Pause playback | mp3.pause() |
| resume() | Resume playback | mp3.resume() |
| stop() | Halt playback | mp3.stop() |
Giga R1 — Sequential Track Playback
Giga R1 — Pause / Resume
Giga R1 — Repeat a Track
Repeat & Shuffle Methods
| Function | Behavior | Code |
|---|---|---|
| loopTrack(n) | Repeat track n continuously | mp3.loopTrack(1) |
| loopFolder(f) | Repeat all tracks in folder f | mp3.loopFolder(1) |
| loopAll() | Repeat every track on the card | mp3.loopAll() |
| stopLoop() | Cancel active repeat | mp3.stopLoop() |
| shuffle() | Randomize play order | mp3.shuffle() |
Giga R1 — Playing from Folders
Folder Functions
| Function | Description | Code |
|---|---|---|
| playFolder(f, t) | Play track t in folder f (max 99 folders, 255 tracks) | mp3.playFolder(1, 1) |
| playLargeFolder(f, t) | Extended mode (15 folders, 3000 tracks) | mp3.playLargeFolder(1, 2000) |
| playFromMP3Folder(t) | Play from dedicated /mp3 folder | mp3.playFromMP3Folder(1) |
Giga R1 — Control via Serial Monitor
| Command | Action |
|---|---|
| 1–9 | Play track by number |
| + / − | Volume adjustment |
| p | Pause |
| r | Resume |
| s | Stop |
| n | Next track |
| b | Previous track |
| ? | Status display |
EQ Presets
| Constant | Value | Description |
|---|---|---|
| DIYables_MiniMp3::EQ_NORMAL | 0 | Neutral |
| DIYables_MiniMp3::EQ_POP | 1 | Pop |
| DIYables_MiniMp3::EQ_ROCK | 2 | Rock |
| DIYables_MiniMp3::EQ_JAZZ | 3 | Jazz |
| DIYables_MiniMp3::EQ_CLASSIC | 4 | Classical |
| DIYables_MiniMp3::EQ_BASS | 5 | Bass-heavy |
Querying the Module
Each of these methods blocks for up to 100 ms while awaiting a response. A return value of −1 signals a timeout or communication error.
| Method | Returns | What It Tells You |
|---|---|---|
| isPlaying() | bool | Whether audio is currently active |
| getVolume() | int16_t | Current volume setting (0–30) |
| getEQ() | int16_t | Active equalizer preset (0–5) |
| getTrackCount() | int16_t | Total mp3 files on the SD card |
| getCurrentTrack() | int16_t | Track number being played |
| getFolderCount() | int16_t | Number of folders on the card |
| getTrackCountInFolder(f) | int16_t | Number of tracks inside folder f |