top of page
Search
  • Writer's pictureIfrim Ciprian

Breakout Board - DFPlayer - Nicla Sense ME Implementation

Updated: Mar 3, 2022

The voice lines output of the device will be done through the DFPlayer Mini which uses the UART interface to receive the command representing the volume and file to play.

The original code in its simplest form looks like the following:

#include "DFRobotDFPlayerMini.h"
#include "Nicla_System.h"
#include "SoftwareSerial.h"

// Create the Player object
SoftwareSerial mySoftwareSerial(2, 1);
DFRobotDFPlayerMini player;

void setup() 
{
  mySoftwareSerial.begin(9600);
  nicla::begin();
  player.begin(mySoftwareSerial);
}


void loop() 
{
  player.volume(30);
  player.playMp3Folder(1);
  delay(5000);
  player.playMp3Folder(2);
  delay(2000);
}

The original library code uses the SoftwareSerial library to communicate, which generates a separate UART to the hardware one, the issue is that the Nicla Sense ME does not support Software Serial, and can only use hardware, so the code needs to be modified to use Nicla's hardware UART as shown here: https://docs.arduino.cc/tutorials/nicla-sense-me/cheat-sheet#uart

Once the SoftwareSerial library gets removed, and the hardware Serial1 is passed, the code looks like the following:

#include"DFRobotDFPlayerMini.h"
#include"Nicla_System.h"

// Create the Player object
DFRobotDFPlayerMini player;

voidsetup() {  
Serial1.begin(9600);
nicla::begin();  
player.begin(Serial1);
}

voidloop() {  
player.volume(30);  
player.playMp3Folder(1);
delay(5000);  
player.playMp3Folder(2);
delay(2000);
}

And here is a little demo of the system working accordingly:


NOTE: While creating the original prototype found here: https://ciprianaa30.wixsite.com/aurismartwatch/post/a-smartwatch-prototype

I found out that the DFPlayer does not play nice with 3.3 volts, and it would need 5v. After testing it with 1 LiPo cell battery, which when fully charged has a voltage of 4.2v and discharged 3.7v, the DFRobot was working perfectly fine.


5 views0 comments

Recent Posts

See All
bottom of page