Voice Recorder Module Breakout for Arduino Wiki - DFRobot

Introduction

Wanna buy a simple & practical voice recorder? This one is right for you! The voice recorder module supports 4 controlling modes Arduino, AT command, on-board buttons and ADKEY, and multi-segment voice recording. You can directly press the on-board buttons to record or play voice without using a controller. Moreover, the 16MB storage on the module can store up to 40 minutes voice recording and the recorded files can be copied to your computer via the type-C interface.

Features

Application

Specification

Dimension

Board Overview

Board Overview

NO. Slikscreen Function
1 VIN +
2 GND -
3 RX UART Receive
4 TX UART Transmit
5 SPK+ Speaker Output +
6 SPK- Speaker Output -
7 PLAY Function Button
8 REC Function Button
9 KEY ADAKY
10 DAC DAC Output
11 GND -
12 MIC Microphone Input

Tutorial

When using for the first time, you need to connect the voice recorder module to a computer via an USB cable and format it.

Format module

Requirements

Connection Diagram

Connection

Indicator Description

Module Indicator

Status Orange LED Blue LED
Slave Mode OFF OFF
Recording Mode Quick Flash OFF
Recording.. ON OFF
Recording Pause Slow Flash OFF
Playing OFF ON
Playing Pause OFF Slow Flash
Switching OFF Flash Twice

Button Controlling

  1. In slave mode, press the REC button to enter recording mode, then the orange LED will flash quickly(press the Play button to exit the recording mode).
  2. Under the recording mode, press the REC button to start recording, and the orange LED keeps ON(Press the REC button to pause or continue ).
  3. In recording or recording paused, press the Play button to save and exit the recording mode.
  1. In slave mode, press the Play button to enter the music mode, then the blue LED will flash slowly(press the REC button to exit the music mode).
  2. Under the recording mode, press the Play button to start playing, and the blue LED keeps ON(Press the Play button to pause or continue).
  3. In playing, press the Play button for 2 seconds to switch the previous song(the blue LED flashes twice).
  4. In playing or playing paused, press the REC button to exit the music mode.

Software Controlling

  /**
   * @brief Set baud rate(Need to power off and restart, power-down save) 
   * @param 9600,19200,38400,57600,115200
   * @return true or false
   */
  bool setBaudRate(uint32_t baud);

  /**
   * @brief Set playback mode
   * @param ePlayMode_t:SINGLECYCLE,ALLCYCLE,SINGLE
   * @return true or false
   */
  bool setPlayMode(ePlayMode_t mode);

  /**
   * @brief Set indicator LED(Power-down save) 
   * @param true or false
   * @return true or false
   */
  bool setLED(bool on);

  /**
   * @brief Set prompt tone(power-down save) 
   * @param true or false
   * @return true or false
   */
  bool setPrompt(bool on);

  /**
   * @brief Set volume 
   * @param vol:0-30
   * @return true or false
  */
  bool setVol(uint8_t vol);

  /**
   * @brief Set working mode 
   * @param eFunction_t:MUSIC,RECORD,UFDISK
   * @return true or false
   */
  bool switchFunction(eFunction_t function);

  //bool operation( );
  /**
   * @brief Next 
   * @return true or false
   */
  bool next();

  /**
   * @brief Last
   * @return true or false
   */
  bool last();

  /**
   * @brief Play(in music mode) or Record (in recording mode)
   * @return true or false
   */
  bool start();

  /**
   * @brief Playing Pause(in music mode) or recording pause(in recording mode)
   * @return true or false
   */
  bool pause();

  /**
   * @brief Save the recorded voice
   * @return true or false
   */
  String saveRec();

  /**
   * @brief Delete the currently-playing file 
   * @return true or false
   */
  bool delCurFile();

  /**
   * @brief Play the file of specific path
   * @param The designated path
   */
  void playSpecFile(String str);

  /**
   * @brief Play the file of specific number(only valide for the default file name),
   * @  play the first one if there is no file designated.  
   * @param File name number: 0-999
   */
  void playSpecFile(int16_t num);

  /**
   * @brief Get volume
   * @return vol
   */
  uint8_t getVol();

  /**
   * @brief Get playback mode 
   * @return ePlayMode_t
   */
  ePlayMode_t getPlayMode();

Sample Code 1 - Recording

Power on the module then it enters the recording mode. Start recording after 2 seconds and save the recorded voice file 5 seconds later. Print the file name repeatedly at the serial port.

/*!
 * @file record.ino
 * @brief Recording
 * @n Experiment Phenomenon:Power on the module then it enters the recording mode. 
 * @n                       Start recording after 2 seconds and save the recorded voice file 5 seconds later. 
 * @n                       Print the file name repeatedly at the serial port.
 * @copyright   Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @licence     The MIT License (MIT)
 * @author [fengli](li.feng@dfrobot.com)
 * @version  V1.0
 * @date  2020-07-16
 * @get from https://www.dfrobot.com
 * @url https://github.com/DFRobot/DFRobot_DF1101S
 */
#include <DFRobot_DF1101S.h>
#include <SoftwareSerial.h>

SoftwareSerial df1101sSerial(2, 3);  //RX  TX

DFRobot_DF1101S df1101s;

String RECFileName;  //Recording file name 

void setup(void){
  Serial.begin(115200);
  df1101sSerial.begin(115200);
  while(!df1101s.begin(df1101sSerial)){
    Serial.println("Init failed, please check the wire connection!");
    delay(1000);
  }
  /*Set baud rate, power-down data save,need to power down and restart*/
  //df1101s.setBaudRate(115200);
  /*Open LED prompt, power-down save*/
  //df1101s.setLED(true);
  /*Open voice prompt, power-down save*/
  //df1101s.setPrompt(true);

  /*Enter Recording mode */
  df1101s.switchFunction(df1101s.RECORD);
  /*Wait for the end of prompt tone*/
  delay(2000);
  /*Start recording*/
  df1101s.start();
  /*Pause*/
  //df1101s.pause();
  delay(5000);
  /*Save*/
  RECFileName = df1101s.saveRec();
}

void loop(){
  Serial.println(RECFileName);
  delay(1000);
}

Result 1

Result

Sample Code 2 - Playing

Power on the module then it enters the music mode. Start playing the previously-recorded file, pause 3s later, play the next song 3s later, play the last song 3s later, and play the file of specific number(FILE0000) once 3s later.

/*!
 * @file play.ino
 * @brief Playing
 * @n Experiment Phenomenon:Power on the module then it enters the music mode. 
 * @n                       Start playing the previously-recorded file, pause 3s later, 
 * @n                       play the next song 3s later, play the last song 3s later, 
   @n                       and play the file of specific number(FILE0000) once 3s later.
 * @copyright   Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @licence     The MIT License (MIT)
 * @author [fengli](li.feng@dfrobot.com)
 * @version  V1.0
 * @date  2020-07-16
 * @get from https://www.dfrobot.com
 * @url https://github.com/DFRobot/DFRobot_DF1101S
 */
#include <DFRobot_DF1101S.h>
#include <SoftwareSerial.h>

SoftwareSerial df1101sSerial(2, 3);  //RX  TX

DFRobot_DF1101S df1101s;
void setup(void){
  Serial.begin(115200);
  df1101sSerial.begin(115200);
  while(!df1101s.begin(df1101sSerial)){
    Serial.println("Init failed, please check the wire connection!");
    delay(1000);
  }
  /*Set volume to 20*/
  df1101s.setVol(20);
  Serial.print("VOL:");
  /*Get volume*/
  Serial.println(df1101s.getVol());
  /*Enter music mode*/
  df1101s.switchFunction(df1101s.MUSIC);
  /*Wait for the end of prompt tone*/
  delay(2000);
  /*Set playback mode to "repeat all"*/
  df1101s.setPlayMode(df1101s.ALLCYCLE);
  Serial.print("PlayMode:");
  /*Get playback mode*/
  Serial.println(df1101s.getPlayMode());
}

void loop(){
  /*Start*/
  df1101s.start();
  delay(3000);
  /*Pause*/
  df1101s.pause();
  delay(3000);
  /*Next*/
  df1101s.next();
  delay(3000);
  /*Last*/
  df1101s.last();
  delay(3000);
  /*Play the specific file(FILE0000) in recording files once*/
  df1101s.playSpecFile(0);
  while(1);
  /*Delete the currently-playing file*/
  //df1101s.delCurFile();
}

Result 2

Result 2

ADKEY Controlling

Get AD Button from DFRobot Store or DFRobot Distributor.

Key Resistor in Series Click Long-press
K0 0R Pause & Play
K1 3K Last Volume +
K2 6.2K Next Volume -
K3 9.1K Switch Play Mode
K4 15K REC
K5 24K PLAY
K6 33K Volume - Volume -
K7 51K Volume + Volume +
K8 100K Switch Working Mode
K9 220K Delete Currently-playing File

DFR0745ADKEY

NOTE:

  1. "\r\n is" omitted in all the commands below, and you need to add it to the end of the command in actual use. For example "AT+VOL=5\r\n", designate volume to "5".
  2. Default serial baud rate: 115200
  1. AT+FUNCTION=2 //Enter recording mode
  2. AT+REC=RP // Start Recording
  3. AT+REC=SAVE //Save recorded file
  1. AT+FUNCTION=1 //Enter music mode
  2. AT+PLAY=PP //Playing
/**
 * @brief Test connection 
 */
AT  //Test connection 

/**
 * @brief Volume control(volume degree: 0-30)
 * @param -n:Volume-n
 *        +n:Volume+n
 *         n:Designate volume to n
 *         ?:Query volume
 */
AT+VOL=-5  //Volume-5

AT+VOL=?   //Query volume
Return:VOL = [10]   //Current volume is 10

/**
 * @brief Function switch 
 * @param  1: Music mode 
 *         2: Recording mode 
 *         3: Slave mode 
 */
AT+FUNCTION=1  //Switch to music mode 

/**
 * @brief Playing mode control 
 * @param  1: Repeat one song 
 *         2: Repeat all 
 *         3: Play one song only
 *         ?: Query current playing mode 
 */
AT+PLAYMODE=1   //Switch to repeat one song 

AT+PLAYMODE=?   //Query current playing mode 
Return:PLAYMODE =1  //Current playing mode: repeat one song 

/**
 * @brief Playing control 
 * @param    PP: Play & Pause 
 *         NEXT:Next song 
 *         LAST:Last song 
 */
AT+PLAY=NEXT   //Next song 

/**
 * @brief Play the file of the designate number (default file name) or specific file once 
 * @param        n: Play the music file with name number n()(0-999),play the first file if there is no one.
 *         File path: play the file of specific path 
 */
AT+PLAYFILE=5                       //Play FILE0005.mp3 once 
AT+PLAYFILE=/DF_REC/test.MP3        //Play test.mp3 under DF_REC once

/**
 * @brief Delete the currently-playing file 
 */
AT+DEL

/**
 * @brief Recording control 
 * @param    RP:Record & Pause
 *         SAVE:Save the recorded file 
 */
AT+REC=SAVE    //Save the recorded file 

/**
 * @brief Set baud rate(power-down save, valid after repowering on)
 * @param    9600, 19200, 38400, 57600, 115200
 */
AT+BAUDRATE=115200  //Set baud rate to 115200

/**
 * @brief Prompt tone ON/OFF commands (power-down save)
 * @param    ON, OFF
 */
AT+PROMPT=ON   //Enable prompt tone 

//LED prompt ON/OFF commands(power-down save) 
/**
 * @brief LED Prompt ON/OFF commands(power-down save) 
 * @param    ON, OFF
 */
AT+LED=ON   //Enable LED prompt

FAQ

1. When entering the music mode, the module will play from the last audio file.

2.If you find that your module cannot record sound properly, please update the firmware by the following steps:

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get Voice Recorder Module-Breakout from DFRobot Store or DFRobot Distributor.

Turn to the Top