I have a project that I'm working on where I'm using the DFPlayer Mini to play mp3 sound files and using the Trinket Pro 5V along with it. I have this working great off the Uno and am now trying to get the code running on the Trinket Pro. However I've run into some issues. It mostly works when I upload over USB, but I then don't get any debug info from my serial port. The DFPlayer Mini talks over a SoftwareSerial connection on ports 3 and 5, which again work just fine when running from the USB. But when I attach my FTDI cable to try and get my debug info over the Serial port the DFPlayer Mini no longer initializes.
Is there something that would cause a serial conflict when running with FTDI cable that doesn't happen when I power and upload from the Micro USB connection? Is there a potential power issue through FTDI vs the USB?
Here is my initialization code that I'm using when I see this:
- Code: Select all | TOGGLE FULL SIZE
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
#include <Adafruit_NeoPixel.h>
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
#include <avr/power.h>
#endif
///////////////////////////
//// DFPlayer Mini Config
///////////////////////////
SoftwareSerial dfPlayerSerial(3, 5);//(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
// Initial Start-up
void setup()
{
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
// Serial port to control the DFMini Player
//Serial.begin(9600);
//dfPlayerSerial.begin(9600);
// Serial port for debug output
Serial.begin(115200);
// Initialize the push button pins as input
// Since we are not using a draw resister
// these will be INPUT_PULLUP
pinMode(MinusButtonPin, INPUT_PULLUP);
pinMode(PlusButtonPin, INPUT_PULLUP);
pinMode(A0, INPUT_PULLUP);
Serial.println();
Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
if (!myDFPlayer.begin(dfPlayerSerial)) { //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!"));
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
while (true);
}
Serial.println(F("DFPlayer Mini online."));
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
myDFPlayer.volume(30); //Set volume value. From 0 to 30
//Initialize Boot-up effect
BootUpEffect();
}
Here is what my breadboard looks like.
Blue wire from Pin ~3 goes to the DFPlayer Mini's RX pin
Green Wire goes from Pin ~5 to a 1K resistor and then to the Mini's TX pin as outlined in the instructions from the module's maker. (https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299#target_5)