Arduino is an open-source prototyping platform based on easy-to-use hardware and software. Over the years Arduino has been the brain of thousands of projects, from everyday objects to complex scientific instruments. This project use DFPlayer module to create a storyteller toy.
Preparing the hardware
Just use the diagram to connect every component.

– Arduino board (pin11) to RX of DFPLayer (pin2)
– Arduino board (pin10) to TX of DFPLayer (pin3)
– (pin1) of DFPLayer to +5v of Arduino board
– (pin7) of DFPLayer to gnd of Arduino board
– (pin6) and (pin8) of DFPLayer to speaker
– Arduino board (pin9), (pin7) and (pin6) to push buttons used for play/pause, previous and next
Preparing the software
You need to create a new sketch using Arduino IDE and upload to you Arduino.
– Open the Arduino IDE
– Create a New sketch and paste our code.
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
const int prevButton = 6;
const int nextButton = 7;
const int playButton = 9;
int buttonState = 0;
int playState = -1;
void setup() {
mySoftwareSerial.begin(9600);
Serial.begin(11520);
if (!myDFPlayer.begin(mySoftwareSerial)) { //Use softwareSerial to communicate with mp3.
Serial.println(F("Unable to begin:"));
Serial.println(F("1.Please recheck the connection!"));
Serial.println(F("2.Please insert the SD card!"));
while(true);
}
pinMode(prevButton, INPUT);
pinMode(nextButton, INPUT);
pinMode(playButton, INPUT);
myDFPlayer.enableLoop();
myDFPlayer.volume(29); //Set volume value. From 0 to 30
}
void loop() {
if (digitalRead(prevButton) == LOW) {
if(buttonState == 2){
buttonState = 0;
playState = 1;
myDFPlayer.previous();
}
} else {
buttonState = 2;
}
if (digitalRead(nextButton) == LOW) {
if(buttonState == 3){
buttonState = 0;
playState = 1;
myDFPlayer.next();
}
} else {
buttonState = 3;
}
if (digitalRead(playButton) == LOW) {
if(buttonState == 1){
buttonState = 0;
if(playState == 1){
myDFPlayer.pause();
playState = 0;
} else {
if (playState == -1 ){
myDFPlayer.play();
} else {
myDFPlayer.start();
}
playState = 1;
}
}
} else {
buttonState = 1;
}
if (myDFPlayer.available() && myDFPlayer.readType() == DFPlayerPlayFinished){
//
}
delay(100);
}
– You need also to install a library using Include library under Sketch and Manage library
– Search for DFPlayer and install this library

– Verify and upload the sketch to Arduino
Build your own prototype
Use a prototype pcb to move this project form breadboard to pcb.
If you don’t have an Atmega328 with bootloader you need to burn a bootloader to upload the sketch.
Also if you intend to use a 9v battery, you need to use a voltage regulator.

Assembles the toy
Use a plastic case to encapsulate the project.
