0

Trinket Pro 5V able to initialize DFPlayer Mini when running
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Trinket Pro 5V able to initialize DFPlayer Mini when running

by WedgeTheJedi on Mon Jul 22, 2019 10:08 pm

Hi,
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)
TrinketDFPlayer_FTDIIssues.PNG
Breadboard Setup
TrinketDFPlayer_FTDIIssues.PNG (390.3 KiB) Viewed 100 times

WedgeTheJedi
 
Posts: 4
Joined: Mon Jul 22, 2019 9:47 pm

Re: Trinket Pro 5V able to initialize DFPlayer Mini when run

by adafruit_support_mike on Mon Jul 22, 2019 11:26 pm

The Pro Tinket's Serial port is connected to GPIO pins 0 and 1, so you shouldn't have any pin conflict with 3 and 5.

As a sanity check, take a voltage measurement on the DFPlayer's 5V pin while the FTDI cable is connected. It's always a good idea to check power before looking for anything more esoteric.

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Re: Trinket Pro 5V able to initialize DFPlayer Mini when run

by WedgeTheJedi on Tue Jul 23, 2019 2:04 am

That is a great idea, it would make sense if for some reason with FTDI it just isn't pulling enough power from the FTDI cable as it is from the USB. I'll check that tomorrow and get back.

WedgeTheJedi
 
Posts: 4
Joined: Mon Jul 22, 2019 9:47 pm

Re: Trinket Pro 5V able to initialize DFPlayer Mini when run

by WedgeTheJedi on Tue Jul 23, 2019 11:24 am

Ok you were right about the voltage. With my Uno I verified that the power inputs on the DFPlayer Mini were getting the full 5V when the Trinket was plugged into USB, but only 3.3V when plugged into my FTDI cable. I looked up the cable I ordered and I guess I misinterpreted the description. This is the cable that I ordered (as it was one I could get delivered the fastest):
https://www.amazon.com/gp/product/B06ZYPLFNB/ref=ppx_yo_dt_b_asin_title_o04_s00?ie=UTF8&psc=1

However now I see in the title it says USB to TTL Serial 3.3V UART Converter Cable, I thought I had ordered a 3.3V / 5V (it could do both) because the description said "Moyina USB TTL +3.3V levels (signals only, VCC= +5V)". I thought the VCC= +5V meant it would do either 3.3 or 5V :S.

Is there a specific FTDI cable or board that I should target to avoid this again or just search for one that says specifically 5V in the title?

WedgeTheJedi
 
Posts: 4
Joined: Mon Jul 22, 2019 9:47 pm

Re: Trinket Pro 5V able to initialize DFPlayer Mini when run

by adafruit_support_mike on Wed Jul 24, 2019 12:39 pm

USB data signals are limited to 3.3V, but a USB cable has a 5V line to power the device plugged into the cable.

Most USB-toSerial converters follow the same protocol, and the page you linked says the cable has a 5V output line. Try measuring the voltage between the 5V and GND lines while the cable is disconnected from the Pro Trinket.

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Re: Trinket Pro 5V able to initialize DFPlayer Mini when run

by WedgeTheJedi on Wed Jul 24, 2019 12:58 pm

I returned the old cable and ended up getting a DFRobot FTDI board that has a jumper for 3.3v and 5v. After plugging that in, everything works great. With the DFRobot FTDI board I don't even have to press the reset button on the Trinket Pro which I had to do even with the FTDI Cable (had to hold it down until compile was finished then let it go for deployment).

So if someone is having similar issues, I would recommend just getting a real FTDI module board. It was cheaper and actually works.

WedgeTheJedi
 
Posts: 4
Joined: Mon Jul 22, 2019 9:47 pm

Please be positive and constructive with your questions and comments.