現貨供應最新開發模組

Grove - UART 介面 MP3 / WAV 模組 w/ WT5001

  • 標準Grove接口
  • 異步串口控制模式
  • 示忙器
  • 復位按鍵
  • 標準迷你SD卡槽:最大支持2GB
  • 支持FAT16和FAT32文件系統

代號
grove-serial-mp3-player

SKU 即原廠標號
107020002

定價
500
特價
400 (含營業稅)

商品停售

本產品停產,請參考 [Grove - MP3 2.0](https://makehub.tw/spot/grove-mp3v2)

MCUapps 獨家撰寫 Arduino 驅動函式庫

原廠只提供範例程式,還得讓使用者自行查閱規格書,再一一合成命令或解析傳回字串,為了替大家節省開發時間,特地撰寫打包了一個基本的 Arduino 驅動程式,放在 https://github.com/MCUapps/Grove_Serial_MP3_Player,目前框架已經完成並測試成功,近期將逐漸補完。

客戶們可以參考函式庫所附的範例 MP3_Console,直接呼叫打包好的函式,並且獲得排列整齊的回傳碼,就能很便利的套用在您自己的應用當中。以下是一個最基本的使用範例。

#include <Arduino.h>
#include <SoftwareSerial.h>
#include "MP3.h"

SoftwareSerial mp3Serial(2, 3); // RX, TX
MP3 player(mp3Serial);

void setup()
{
    delay(100);
}

void loop()
{
    player.setMode(1);
    player.playSong(1);
    player.pushSong(2);
    player.getStatus();
}

使用注意 使用之前必須先備妥 microSD 卡,並且要滿足兩個條件:

  1. microSD 卡本身或第一個分割 partition 要小於或等於 2GB。
  2. microSD 卡上必須要存放有 .mp3 或 .wav 檔案。

因為晶片的韌體有點愚蠢,若不符合上述條件就不會回應任何命令。所以請先插入符合條件的 microSD 卡再進行開發。

原廠連結:http://www.seeedstudio.com/wiki/Grove_-_Serial_MP3_Player_串口MP3播放器

產品介紹

Grove- Serial MP3 Player是一款基於高品質MP3音頻芯片-WT5001的簡易MP3播放設備。它可以支持8kHz~44.1kHz採樣頻率以及MP3和WAV的文件格式。這款產品有一些外設端口:一個標準的UART Grove接口,一個雙聲道耳機接口,一個外部接口以及一個迷你SD卡槽。您可通過串口工具向模塊發送命令來控制MP3播放狀態,如切歌,調整音量及播放模式等。這個模塊雖然看起來很簡單,但功能強大。想知道它的音質如何?來試試吧!
Model:SEN01300P

Mp3sensor 02.jpg

產品特性

  • 標準Grove接口
  • 異步串口控制模式
  • 示忙器
  • 復位按鍵
  • 標準迷你SD卡槽:最大支持2GB
  • 支持FAT16和FAT32文件系統

接口功能


Mp3 interface.jpg

  • ①:左通道Grove接口
  • ②:3.5mm四段耳機
  • ③:右通道Grove接口
  • ④:WT5001
  • ⑤:LED 指示燈:當音樂播放時,LED亮.
  • ⑥:UART Grove 接口
  • ⑦:SD 卡槽

具體使用

Grove - Serial MP3 Player可由Arduino/Seeeduino控制。在這裡我們為您提供了串口MP3測試代碼。相信您能很快上手。獲取更詳細的信息,請參照下面的描述。硬件安裝:

  • 將Grove- Serial MP3 Player連接到Arduino或Seeeduino的數字端口2,請注意,您可更改根據您的喜好更改引腳,只要保證改變相應的代碼即可。接著用USB線將Arduino或Seeeduino連接到電腦。
  • 給Grove- Serial MP3 Player插上耳機,至此硬件部分安裝已完成。
  • 代碼載入完成後,打開串口工具發送命令。
  • 載入下面的代碼,如果您不知道如何讓載入代碼請點擊這裡

下面的代碼包括播放模式參數,您只需改變參數即可轉換播放模式。

/*****************************************************************************/
//    Function: control the seeedstudo Grove MP3 player
//      Hardware: Grove - Serial MP3 Player
/*******************************************************************************/
#include <SoftwareSerial.h>
SoftwareSerial mp3(2, 3);//modify this with the connector you are using.
void setup()
{
    mp3.begin(9600);
    Serial.begin(9600); 
    delay(100);
        if (true ==SetPlayMode(0x01))
        Serial.println("Set The Play Mode to 0x01, Single Loop Mode.");
        else
        Serial.println("Playmode Set Error");
        PauseOnOffCurrentMusic();
}
void loop()
{
SetPlayMode(0x01);
delay(1000);
SetMusicPlay(00,01);
delay(1000);
SetVolume(0x0E);
while(1);
}
//Set the music index to play, the index is decided by the input sequence
//of the music;
//hbyte: the high byte of the index;
//lbyte: the low byte of the index;
boolean SetMusicPlay(uint8_t hbyte,uint8_t lbyte)
{
    mp3.write(0x7E);
    mp3.write(0x04);
    mp3.write(0xA0);
    mp3.write(hbyte);
    mp3.write(lbyte);
    mp3.write(0x7E);
        delay(10);
     while(mp3.available())
    {
    if (0xA0==mp3.read())
    return true;
    else 
    return false;
        }
}
// Pause on/off  the current music
boolean PauseOnOffCurrentMusic(void)
{
 mp3.write(0x7E);
 mp3.write(0x02);
 mp3.write(0xA3);
 mp3.write(0x7E);
 delay(10);
 while(mp3.available())
 {
 if (0xA3==mp3.read())
 return true;
 else 
 return false;
 }
}
//Set the volume, the range is 0x00 to 0x1F
boolean SetVolume(uint8_t volume)
{
 mp3.write(0x7E);
 mp3.write(0x03);
 mp3.write(0xA7);
 mp3.write(volume);
 mp3.write(0x7E);
 delay(10);
 while(mp3.available())
 {
 if (0xA7==mp3.read())
 return true;
 else 
 return false;
 }
}
boolean SetPlayMode(uint8_t playmode)
{
  if (((playmode==0x00)|(playmode==0x01)|(playmode==0x02)|(playmode==0x03))==false)
  {
    Serial.println("PlayMode Parameter Error! ");
    return false;
  }
 mp3.write(0x7E);
 mp3.write(0x03);
 mp3.write(0xA9);
 mp3.write(playmode);
 mp3.write(0x7E);
 delay(10);
 while(mp3.available())
 {
 if (0xA9==mp3.read())
 return true;
 else 
 return false;
 }
}


注意: 1.SetPlayMode(uint8_t playmode)

這個函數用於設置MP3播放器模式。
uint8_t playmode:改變播放模式的參數。可以為 0x00、0x01、0x02 或 0x03。

2.SetVolume(uint8_t volume)

這個函數用於設置MP3播放音量。
uint8_t volume:改變播放音量的參數。參數範圍為0x00 至 0x1F。

3.SetMusicPlay(uint8_t hbyte,uint8_t lbyte)

這個函數用於設置音樂播放的索引,其是由音樂輸入的順序決定。
uint8_t hbyte:索引的高字節。
uint8_t lbyte:索引的低字節。

4.PauseOnOffCurrentMusic(void) 這個函數用於暫停/繼續當前音樂。 ‧現在您可以聽到SD卡中存儲的音樂了。播放模式中,D1指示燈亮著。如果在暫停模式,指示燈將會閃爍。還有更多體驗等你來發現!

還有另一種用串口工具控制MP3播放器的方法,您需要一個UartSBee將MP3連接到電腦。硬件安裝如下所示:
Using UartSBee to Control MP3.jpg
連接完成後,打開串口工具並發送命令。關於詳細的命令,請看參考部分。
Serial tool to send commands.jpg
還有更多體驗等你哦。

參考

常見命令描述如下表:

命令名 命令格式 描述
暫停 7E 02 A3 7E 第一次發送此命令音樂會停止,再發送一次,音樂會繼續。
停止 7E 02 A4 7E 這個命令可觸發下一首歌,如正在播放最後一首則會觸發第一首歌曲。
下一首 7E 02 A5 7E 這個命令可觸發下一首歌,如正在播放最後一首則會觸發第一首歌曲。
上一首 7E 02 A6 7E 這個命令可觸發上一首歌,如正在播放第一首則會觸發最後一首歌曲。
聲音控制 7E 03 A7 1F 7E 從00到31共有32個音量級,00音量最小,31音量最大。
指定的播放模式 7E 03 A9 XX 7E XX=00單曲播放(默認)。
XX=01單曲循環模式。
XX=02列表循環模式。
XX=03隨機播放模式。

資源

Grove- Serial MP3 PlayerEagle文件
Grove- Serial MP3 Player原理圖文件.PDF
Github上的演示代碼
規格書WT5001

資料來源:https://www.seeedstudio.com/Grove---Serial-MP3-Player-p-1542.html

Description

This product is retired, please consider our Grove - MP3 v2.0 as your alternative choice.

 
Grove-Serial MP3 Player is a kind of simple MP3 player device whose design is based on a high-quality MP3 audio chip---WT5001. It can support 8KHZ~44.1KHZ sampling frequency MP3 and WAV file formats. This product has several peripheral ports: a standard UART Grove interface, a dual track headphone jack, an external interface and also a  micro SD card interface. You can control the MP3 playback state by sending commands to module via serial port tools, such as switch songs, change the volume and play mode and so on. It seems a simple module, but it owns such strong function. Want to know how the sound quality? Please come to experience it!
 
Features
  • Standard Grove interface
  • Asynchronous serial port control play mode
  • Busy Indicator
  • Reset Button
  • Standard micro SD card Interface
  • Support FAT16 and FAT32 file system

 

For all Grove users (especially beginners), we provide you guidance PDF documents. Please download and read through Preface - Getting Started and Introduction to Grove before your using of the product.
 
Documents
Please visit our wiki page for more info about this product. It will be appreciated if you can help us improve the documents, add more demo code or tutorials. For technical support, please post your questions to ourforum.
See More


Line share