Close

2024-05-02

A project log for M8B 2.0

Magic 8 Ball + User Guide 2.0

nelithzederdelleNelithzederdelle 05/02/2024 at 11:300 Comments

Ball

More tests for DF Player

Today we tried to solve the issue we had last week to make the DFplayer work with the ESP32:

 following this tutorial : (8650) DFPlayer Mini Interface with ESP32: Audio Playback Tutorial | Add voice to ESP32 - YouTube

here is the code from the video:

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

// Use pins 2 and 3 to communicate with DFPlayer Mini
static const uint8_t PIN_MP3_TX = 25; // Connects to module's RX 
static const uint8_t PIN_MP3_RX = 27; // Connects to module's TX 
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);

// Create the Player object
DFRobotDFPlayerMini player;

void setup() {

  // Init USB serial port for debugging
  Serial.begin(9600);
  // Init serial port for DFPlayer Mini
  softwareSerial.begin(9600);

  // Start communication with DFPlayer Mini
  if (player.begin(softwareSerial)) {
   Serial.println("OK");

    // Set volume to maximum (0 to 30).
    player.volume(20);
    // Play the first MP3 file on the SD card
    player.play(1);
  } else {
    Serial.println("Connecting to DFPlayer Mini failed!");
  }
}

void loop() {

 
   }

However, I get an error message :

I tried another code I found in the comments:
#include "DFRobotDFPlayerMini.h"

DFRobotDFPlayerMini player; // Create the Player object

void setup() {

  Serial.begin(9600); // Init USB serial port for debugging

  Serial2.begin(9600); // Init serial port for DFPlayer Mini

  // Start communication with DFPlayer Mini

  Serial.println("Connecting to DFplayer");

  while (!player.begin(Serial2))

  {

      Serial.print(".");

      delay(1000);

  }

  Serial.println(" DFplayer connected!");

  player.volume(20); // Set volume to maximum (0 to 30).

}


void loop() {

    player.play(1);

    delay(3000);

    player.play(2);

    delay(3000);

    player.play(3);

    delay(3000);

   }

 but I get the same error message.

SO, I tried another code from another source :

#include <DFPlayer_Mini_Mp3.h>


#include <SoftwareSerial.h>

#include <DFRobotDFPlayerMini.h>


SoftwareSerial mySerial(25, 27); // RX, TX

void setup() {
    mySerial.begin(9600);
    mp3_set_serial(mySerial);
    mp3_set_volume(15);       // fixe le son (30 maximum)
    mp3_set_EQ(0);            // equalizer de 0 Ã 5
}

void loop() {
    mp3_play();  // joue mp3/0001.mp3
    delay(5000); // pause de 5 secondes

}

and another one:

#include <SoftwareSerial.h>
#include <DFPlayer_Mini_Mp3.h>

SoftwareSerial mySerial(25, 27); // RX, TX

//
void setup () {
  Serial.begin (9600);
  mySerial.begin (9600);
  mp3_set_serial (mySerial);  //set softwareSerial for DFPlayer-mini mp3 module 
  mp3_set_volume (15);
}


//
void loop () {        
  mp3_play (1);
  delay (6000);
  mp3_next ();
  delay (6000);
}

However, the libraries involved might only work for Arduino and give this type of error message with the ESP32:


Then, I tried reinstalling the libraries, re-setting up the ESP32, and did all the updates.

But nothing works I still get this error message:

DEBRIEF :

I still have the same error message, the ESP32 set-up does not seem faulty, the last 2 libraries don't work for ESP32, something is still not clear in the first 2 codes


Ball

We also worked on the design of the ball and made a paper prototype to make sure that the dimensions are right and the ball would be nice looking.

We are still hesitating about the final material we'll use for the final version (either leather or cardboard with fabric covering it).

Discussions