DFRduino_Player_module(.NET_Gadgeteer_Compatible)_(SKU_TOY0008) - jimaobian/DFRobotWiki GitHub Wiki

 DFRduino Player module

Introduction

This DFRduino Player module is a MP3 module compatible with .net gadeteer.The Player is able to play MP3/WAV/Midi sound tracks on SD card. It supports two kinds of interfaces UART and gadgeteer which allow other microcontroller to talk to the player. You just put the audio files into SD card. Arduino or other microcontroller will play the audio files by sending the relevant name of audio files. The play is thus able to be controlled by PC. In addition,this module provides a port which will output high level after fishing a song.Now, it is the time to make your project talk with DFRduino Player module. Specification

  • Supply Voltage:5V(via Pin) 3.3V(via IDC10)
  • Working Current:>200mA(with load)
  • Output Power:3W per channel
  • MCU:Atmega 168P
  • Interface:
    • UART
    • .NET gadgeteer connector (IDC10)Socket
  • UART:19200/8/N/1 (TTL level)
  • Output Power:2x3W,can directly connect to speaker
  • Support Media:MP3,WAV,MIDI
  • Support Meida Card: 1 GB Micro Card
  • Support command: Pause/Next Sound/Previoud Sound/Play Sound/ Volume Control
  • size:52x37mm

Diagram

 DFRduino Player module

OUT:output 1ms Low level after finish a song

Attention

  • The sd card must be formated at FAT format.
  • YOU MUST Create a "sound" directory
  • put mp3/wav/midi files under the SD card
  • make sure the length of file name do not exceed 8 letters.
  • The current should higher than 1000mA if use two speakers
  • UART must be set 19200.

Support Commands

  • Play music via receiving filename command "filename\r\n" Return "Play ok\r\n" if success. Return "Not found\r\n" if failed to find the file.
  • Return "over\r\n" if finish playing one song.
  • Pause Play "\:p\r\n" Return "pause\r\n" if success
  • Continoue Play "\:s\r\n" Return "start\r\n" if success
  • Play next "\:n\r\n" Return "next\r\n" if success,Return "false\r\n" if failed
  • Play previous "\:u\r\n" Return "key up\r\n"
  • Set the volume "\:v 255\r\n",set the volume, from 0 (minimum)-255 (maximum), Return "vol set ok" if success

Sample Code 1

// Product name: DFRduino Player Module
// # Product SKU :TOY0008
// # Version     : 0.1

// # Description:
// # This sample code is for testing DFRduino Player Module

// # Connection:
// #   Arduino     MP3
// #    TX         RX
// #    RX         TX
// #    5V         +5V
// #    GND        GND

// # Support Commands:
// #        1. Pause Play "\:p\r\n" Return "pause\r\n" if success
// #        2. Continoue Play "\:s\r\n" Return "start\r\n" if success
// #        3. Play next "\:n\r\n" Return "next\r\n" if success,Return "false\r\n" if failed
// #        4. Play previous "\:u\r\n" Return "key up\r\n"
// #        5. Set the volume "\:v 255\r\n",set the volume, from 0 (minimum)-255 (maximum), Return "vol set ok" if success
void setup() {
  Serial.begin(19200);
  delay(2000);
  Serial.println("\\:v 200");    // Set the volume to the maxmum, range: 0-255 =
  delay(50);
}

void loop() {
  delay(5000);
  Serial.println("\\:n");  // play next song
}

Sample Code 2

// # Description:
// # This sample code is for testing DFRduino Player Module to realize MP3 player.

// # Connection:
// #    TX              RX
// #    RX              TX
// #    5V              +5V
// #    GND             GND
// #    ADKeyBoard      Anolog 0


int adc_key_val[5] ={50, 200, 400, 600, 800 };
int NUM_KEYS = 5;
int adc_key_in;
int key=-1;
int oldkey=-1;

void setup()
{
  Serial.begin(19200);
  delay(2000);          //Wait for 2 seconds
  Serial.println("\\:v 200");    // set the volume, from 0 (minimum)-255 (maximum)
  delay(50);
}


void loop()
{
  adc_key_in = analogRead(0);    // read the value from the sensor

  key = get_key(adc_key_in);     // convert into key press

  if (key != oldkey)      // if keypress is detected
   {
    delay(50);      // wait for debounce time
    adc_key_in = analogRead(0);    // read the value from the sensor
    key = get_key(adc_key_in);     // convert into key press
    if (key != oldkey)
    {
      oldkey = key;
      if (key >=0){
        switch(key)
        {
           case 0:
                  Serial.println("\\:p"); // Pause
                  Serial.println("OK");
                  break;
           case 1:
                  Serial.println("\\:s");// Continoue to play
                  Serial.println("OK");
                  break;
           case 2:
                  Serial.println("\\:n");  // Play next
                  Serial.println("OK");
                  break;
           case 3:
                  Serial.println("\\:u"); // Play previous
                  Serial.println("OK");
                  break;
           case 4: //Play
                   //The volume must be set before playing the sound
                  Serial.println("\\:v 200");    // set the volume, from 0 (minimum)-255 (maximum)
                  Serial.println("\\yours");
                  Serial.println("OK");
                  break;
        }
      }
    }
  }
 delay(100);
}

// Convert ADC value to key number
int get_key(unsigned int input)
{
    int k;

    for (k = 0; k < NUM_KEYS; k++)
    {
      if (input < adc_key_val[k])
    {
            return k;
        }
   }
    if (k >= NUM_KEYS)k = -1;  // No valid key pressed
    return k;
}

link=http://www.dfrobot.com/

  • DFRduino Player module(.NET Gadgeteer Compatible) (SKU:TOY0008)

BUY from DFRobot Store or DFRobot Distributor List

  • Digital Push Button(SKU:DFR0029)

BUY from DFRobot Store or DFRobot Distributor List

  • ADKeyboard Module(DFR0075)

BUY from DFRobot Store or DFRobot Distributor List

category: Product Manual category: TOY Series category: Module

category: Diagram category: DFRobot