Using my micro board to trigger an MP3 sound card

The sketch won't "press a switch", it will (should) execute a line of code that will result an MP3 Play every 20 seconds or whatever you like.

This sketch plays an MP3 every 5 seconds (the MP3s I made are very short) --

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

// Use pins 2 and 3 to communicate with DFPlayer Mini
static const uint8_t PIN_MP3_TX = 2; // Connects to module's RX 
static const uint8_t PIN_MP3_RX = 3; // Connects to module's TX 

SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
DFRobotDFPlayerMini player;  // Create the Player object

void setup() 
{
  Serial.begin(19200);
  softwareSerial.begin(9600);
  if (player.begin(softwareSerial)) 
  {
   Serial.println("OK");

    // Set volume to maximum (0 to 30).
    player.volume(22); //30 is very loud
  } 
  else 
  {
    Serial.println("Connecting to DFPlayer Mini failed!");
  }

  pinMode(13,OUTPUT);
  digitalWrite(13,LOW);
}

void loop() 
{
  Serial.print("Playing #1 \t");
  player.play(1);
  delay(5000);

  Serial.print("Playing #2 \t");
  player.play(2);
  delay(5000);

  Serial.print("Playing #3 \r\n\r\n");
  player.play(3);  
  delay(5000);
}

If the bladder voiding Olympics (is that the disability category?) were to cease, that would not be required, would it? :roll_eyes:

Thanks so much for really making things much clearer for me. I understand the frustration when someone your trying to help is using all the wrong terms. I deal with it constantly with my customers in the HVAC industry. They'll use "compressor" when its the "condensing unit" and they'll use "thermocouple" when its the "pilot generator" etc so I can see everyone's aggravation on this forum when dealing with guys like me. I'm learning it albeit slowly.

1 Like

Not that much of a problem, only uses some more time and work.

Hi,
Sorry to bug you again. I was able to transfer the MP3 program you sent to my Uno board but unfortunately nothing is happening. I tried both Tx and Tr and 10 and 11 on the board.
I do have 5 vdc at the board so that's good.
Any ideas?

Thanks so much

Have You posted the schematics?
Trying different pins "at random" makes me think that some hardware uncertainty exist.
Tx/Rx? Likely. Mind sync the code and the wiring....

Read the comments in the beginning of the sketch.

It states what pins it uses

checked, checked and rechecked again. all pins are exactly where they should be. Different boards etc.
As I said, the audio card works perfectly without the arduino.

Gotta give up on this. Ive wired complicated circuits a million times successfully. This only requires 4 lousy wires.
I may have shown lack of knowledge and some ignorance with this project but im not that stupid.
And based on so many others past input in not having much better luck, apparently I'm not alone.

Thanks for your time.

Show your work.

#include <FireTimer.h>

#include <DFPlayerMini_Fast.h>

#if !defined(UBRR1H)
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
#endif

DFPlayerMini_Fast myMP3;

void setup()
{
  Serial.begin(115200);

#if !defined(UBRR1H)
  mySerial.begin(9600);
  myMP3.begin(mySerial, true);
#else
  Serial1.begin(9600);
  myMP3.begin(Serial1, true);
#endif
  
  Serial.println("Setting volume to max");
  myMP3.volume(30);
  
  Serial.println("Looping track 1");
  myMP3.loop(1);
}

void loop()
{
  //do nothing
}

Hope you can see how I wired it.

Thanks

better pic

IMG_2682

I uploaded a sketch several Replies ago?
Why won't you try that?

PE - A 1kΩ is resistor is needed between Uno Pin2 and MP3 Pin2.
If you don't ken that - then say so.

Hi,

I did try your sketch. It uploads fine.
I did install a resistor before. Same results. Also because the audio card works beautifully without the Uno board or a 1K resistor, I didnt install one this time.
I will give it another go though.

Thank you.

IMG_2685
Added the 1k resistor.
I also loaded your sketch.

Sorry. except for a click when applying power its still dead.

Ugh

My sketch uses pins 2 and 3 (not 10 and 11) -- 2 goes to 2 and 3 goes to 3.
It also uses a different library (DFRobotDFPlayerMini.h)