Hieveryone,
Apologies for cross-posting. I have posted this on the Audio Topic but have not had any reply. I thought I would try here. Please note I am not an expert and make a lot of silly mistakes, learning as I go.
I am have trouble connecting a DFRobot Mini Mp3 player to an Arduino Mega board. I have the following code:
If you want help solving the problem, describe the problem. I've read you other thread and this one twice. I still don't know what your issue is. What is it doing that it isn't supposed to or not doing that it is supposed to?
So far all you've said is that you've had trouble. I can sympathize, but I can't help without knowing the problem. So maybe instead of making more posts, add some information to this one. Imagine that I haven't been there with you this whole time and bring me up to speed on what you got going on.
Thank you so much for your reply, I see that in my frazzled state, I did not add what is not working, my sincere apologies. In short, nothing is working . The DFplayer is not initialising no matter what I do. I am pretty sure that I have watched every Youtube video and read most of the Forum posts and still no luck. I just end up with the Unable to begin message being printed to the serial monitor. I am using the DFRobot DFR0299 mini MP3 player and a 50MM 40HM 3W speaker. I have no idea where I am going wrong. Like I said, I have a lot to learn and would genuinely appreciate any help.
In the picture it looks like the Rx and Tx lines are backwards. Maybe your board has a different pinout than mine but that's worth checking. It should be Rx -> Tx and Tx -> Rx. But it looks to me like you have Rx -> Rx and Tx -> Tx.
But it won't fix his problem. If SoftwareSerial would work then regular serial would work. Think about that for a moment. What do you think SoftwareSerial can do better? Whatever it is I assure you that you are wrong about it.
If it uses SoftwareSerial then it is either because it is on a board with not enough serial lines, or it is because someone who didn't understand what SoftwareSerial was for used it just because they saw it in another piece of code.
As you'll have seen, I successfully use SoftwareSerial on my UNOs. But although I'm therefore unfamiliar with Hardware Serial, if you want tol stick with it then then shouldn't the string 'HardwareSerial' at least appear somewhere in your code.
I've tried several libraries, including your latest, but found the original DFR library the most versatile - and much better documented than DFPlayerMini_Fast. BTW, I assume you have included it, although not shown in your code?
No. HardWare serial comes with singleton instances. You use Serial all the time on an UNO. That's HardwareSerial. But you don't have to instantiate it. It's just there. It's the same with Serial1, Serial2, and Serial3 on a Mega. They do just what Serial does. They do exactly what SoftwareSerial does but they do it with UART hardware instead of bit banging and tying up interrupts.
Not at all. You're still sending the same types of commands to the player. The managing of large numbers of files happens in code. The serial link is just how reliably you can tell the player to play the right song. And that matters the same for 2 songs as for 20000.
I have also tried with and without the resistor. I am stumped. I can rewire everything tomorrow and take detailed photos ( I am from South Africa, there is a rather large time delay, so sorry for the delays in my reply). Maybe you can then spot whatever I am doing wrong.
Edit:
7. Are you confident about your file organisation on the micro-SD? The module is very fussy. From your play command I assume you have a file named 0001.mp3 (or WAV, or WMA) , or 0001xxxxwhatever.mp3. Either in the root or within a folder called mp3.
My project/idea is to have a button that when pressed will turn on a separate good size screen (maybe 6" or 7") perhaps using a relay of some soft and play an instructional video from an SD card that's also inserted within said screen.
However, the device must have the MCU next to the TFT, since the communication is by SPI. You could select the number of times the video will play continuously or choose it from a group of videos stored on the microSD.
Although there are some limitations of the library, it is possible to continuously play video files in avi format with audio, with good quality, but without the possibility of pausing it forward or backward. You can even add a speaker that has a 3.5 mm audio input or with a bluetooth adapter send the audio signal to a speaker.
I think it could be feasible to experiment with an arduino UNO and a normal TFT with touch panel, like an ILI9341 or a ST7735, equip it with a wireless transmitter that sends the control signal, to a receiver device installed in the teensy designed as playback equipment. The emitting equipment would remain on standby and at the end of the video playback the control would return to the controller TFT
Sure it is feasible to try, if you don't know it won't work. Maybe just think and put figures into the design for speed and memory requirements and know it won't work. That would be a better use if your time.
The Uno on the video not more than power supply for the shield. The most work done by external FT81x Embedded Video Engine. So this project has nothing to do with possibility to play the video on the Uno itself.
Adding an extra to my last answer, so as not to leave loose ends.
I reiterate, the arduino UNO cannot handle the job alone, it needs support to achieve it.
Do you really know or have you ever used EVE2, EVE3 or EVE4 graphics chips?
In the last example, the video file is processed jointly by the arduino UNO and the screen, although it is true that all the graphic processing is done by the screen chip; without support for microSD reader access on the host's SPI bus the display could not do anything.
I used the teensy 3.2 as a control center, with the possibility of keeping the video playing continuously or selecting from a list what the next video will be. Instead of teensy 3.2 you could use an arduino UNO, with some settings you could use a screen like ILI9341 and create a touch keyboard with which you can enter the video list number and the video index of the selected list to start the playback reproduction.
In the code, there is obviously a test to see if the MP3 player is properly connected. The problem is that I did some tests (unpluging the MP3 player, removing the SD card) and this test doesn't seem to work, as the monitor keeps telling me "DFPlayer Mini online."
Hello! Sorry for the late reply. I am glad you are inspired by what I did. It's nothing much. I figured out the problem a long time ago. And I will share it with you.
There is a multitude of issues that could go on: code, wiring, you name it! I will take a spin at your code (which I am assuming is part of mine (which is probably incorrect)), and will give you what I think is wrong. I will give you some options to try. I will even give you a new schematic/wiring diagram. I am much more skilled at the Arduino thing than I've ever been. Thanks for choosing me!
I will, again, look at everything and give you what I found.
Hello UptownKitten !
Thanks for your reply.
Finally, my MP3 player works.
I use the DFRobotDFPlayerMini library.
I don't know why but it seems that the other library ( DFPlayerMini_Fast) doesn't work with my MP3 player.
I have a YX5300 MP3 player hooked up to my Mega 2560. I have power to the Mega via my laptop's USB port. The YX5300 has an LED on it that is red which shows it also has power. I have uploaded the sketch shown below and hit the reset on the Mega. At present, the red led is on and no music is coming out. The documentation says the light is solid green when playing and blinking green when paused. Any suggestions?
It's odd; I can't see any reference to mp3. in SerialMP3Player.cpp. So I'm at a loss to see what uncommenting that #define line is actually going to do. And that define isn't going to propagate to your sketch, so the changes you made there should be undone, I think.
It looks like this comment in the library code is leading us in the wrong direction.
I agree with @van_der_decken that it is inconsistent with the rest of the code.
Try fixing the begin of src/SerialMP3Player.cpp file this way:
That sounds reasonable. I think you'd also have to change all the instances of Serial3-> to Serial3. in SerialMP3Player.cpp, and probably get rid of the SoftwareSerial *Serial3; declaration in SerialMP3Player.h.
Given I am not skilled to correct a library function, do you think I should be looking at another option? The reason I started with the SerialMP3Player library is because the examples more closely matched the very basic needs of my arcade project. I basically want to play music in the background during game play AND have the ability to play a small MP3 clip in the event that certain switches are tripped (e.g. pinball hits target and chime sounds). I need the Mega because I have 40 other inputs/outputs. Other options i can think of are:
Purchase separate Uno/Nano for the sole purpose of controlling the MP3 clips. I could use the Mega to prompt the Uno/Nano to play the requested MP3. This would allow me to use the original code since we believe this library will work on one of those two devices.
OK thanks to the wiring clarification made by @van_der_decken, I'm happy (and somewhat embarrassed) to say that I can now successfully play MP3 files on the YX5300 using pins 14 and 15 of the Arduino Mega. In my case, the wiring clarification was to connect RX on one device to TX on the other and vice versa. Despite what is said in the dialog above, the SerialMP3Player library works just fine with the YX5300 style MP3 players AND with the Mega. Below I show the most basic code you will likely find to make this library work:
3a8082e126