Example Code for Arduino-Recording
Last revision 2025/12/17
This article demonstrates the setup and coding required for an Arduino voice recording project using the DFRobot DF1101S library and hardware components. It includes hardware preparation, software installation, wiring guides, and sample code, enabling users to successfully record and save voice files using Arduino.
Hardware Preparation
- DFR0216-2 DFRduino UNO R3 with IO Expansion Shield and USB Cable A-B x 1
- DFR0745 Fermion: Voice Recorder Module x 1
- FIT0916-FF DuPont Wires x4
- Stereo Enclosed Speaker-3W 8Ω x1
Software Preparation
- Download Arduino IDE: Click to download Arduino IDE
- Download the DFRobot_DF1101S library: DFRobot_DF1101S library
- About how to install the library?
Wiring Diagram

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

Sample Code
/*!
* @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]([email protected])
* @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
The serial port outputs the recording information.

Was this article helpful?
