Это видео недоступно.
Сожалеем об этом.
#40 Let the music play! Arduino based MP3 Player for music (or announcements)
HTML-код
- Опубликовано: 21 июн 2016
- Let the music play! This module can most certainly be used as a custom, Arduino-controlled player of music, in a pub or restaurant, for example, but it could equally be used to give out warning messages or instructions "3D printer has run out of material!" in a factory or workshop. The possibilities are endless. All you have to do is record your .mp3 or .wav files, put them onto a micro SD card, referred to as a TF TransFlash card in the documentation and you're good to go.
We're not using any libraries in this demo, so that you can see exactly how the commands are sent to the MP3 player and how the optional responses are returned too. It also demonstrates how easy it is to send out those commands via the SoftwareSerial library; why not the standard Serial port? Watch the video to find out!
However, you may feel more comfortable using the DFRobot MP3 Player library so I've included that in the links below. Just be aware that we have not experimented with that library in the video, but it looks very easy to use and takes away all the work, aka pain, in creating the command strings.
The library contains some examples that should get you going nicely too.
-----------------------------------------------
UPDATE UPDATE UPDATE
-----------------------------------------------
Just to clarify some queries some viewers had: YES you can play SPECIFIC tracks (that is, you can, if you want, play track 6 then track 1, then track 123). However, I haven't demonstrated that here (we just play them sequentially) but if you look at the code for the Wireless Rain Receiver (video #48) you'll see an example where I play different tracks depending on the level of rain detected.
Many thanks to Purple Planet for their music - link below
Music: www.purple-plan...
----------------------------------------------------------------------------------------------------
STOP! READ THIS IF YOU VALUE YOUR MP3 PLAYER MODULE
----------------------------------------------------------------------------------------------------
The RX and TX from the Arduino Uno or Nano will be 5V and will damage the MP3 player which requires 3.3V on these pins. All explained in the video!
I've included as many links below as I could find and I strongly recommend you print out the ones I've marked as you'll be referring to them often!
--------------------------------------------------------------
Essential reading - recommended print
--------------------------------------------------------------
(Note: ALL these links etc can be found here:
github.com/Ral...)
1. The DFrobot Wiki for the DFPlayer
www.dfrobot.com...
2. Link to the Mini DF Player Manual - more technical but essential if you want to know the commands
github.com/Ral...
3. Link to the sketch used in the demo:
github.com/Ral...
-------------------------------
Further information
-------------------------------
1. A massive amount of extra information from Yerke, via the Banggood forum (link was recently down but may reappear)
forum.banggood....
2. How to insert an advert track and then resume playing the original
www.dfrobot.com...
3. More on where I go the music for this demo
www.purple-plan...
4. The DFPlayer library (not used in this video but easy to use)
github.com/DFR...
All this can be found in Github:
github.com/Ral...
If you like this video please give it a thumbs up, share and if not already subscribed please do so
And my channel is here:
-----------------------------------------------------------------
/ ralphbacon
------------------------------------------------------------------
How can I remember this? Memory tip: "See" Ralph Bacon, geddit?
As always Thanks for Watching!
Brilliant video. Thanks for posting. I especially liked that you kept in the bits which didn't go to plan.
The thing is, Robert, if I kept *all* the bits that didn't go to plan the videos would be even longer than they already are! But thanks for posting, I really appreciate the feedback.
3:23 yet it is good to be free standing module as well - for simple applications Ralph, it is good that you mentioned that 👍😊
Indeed, it is a flexible module whether controlled by a μC or not!
Thank you for creating this comprehensive discussion on the MP3 Player module!
Thanks for your post, Herman, good to hear from you.
Great video! I look forward to see this used in a project where you go through code and how different audio files can be played. I will order a module and start experimenting as soon as it arrives.
I'm glad this piqued your interest; the possibilities are endless! I'm certainly going to add it to one of my projects, not sure which one yet but the water softener salt level seems a likely candidate... I must just make sure it only plays the messages during the daytime when someone is around not at 2am in the morning! Stay tuned...
I'm going to use 1 of those along with a RFID Reader to speak out what is in certain pill bottles etc. I will use the small sticky RFID tags and attach 1 the to the inside bottom, or bottom of the pill bottles. That way the better 1/2 can place the bottle on the reader and it will announce what is in it. I will stick them to other random things also, like spice bottles, and what ever else she has difficulty reading. ( Vodka / Rum / Vinegar / You get the idea.) She has Low Vision and I think this may help her a lot. Now, If she could only code. Guess that's up to me or Benny. Thanks for the Vid Ralph.
What a great use of the RFID reader and MP3 player. When you get it working make a video and you can link to it from here.
Another gem. Mom needs a music player. One without 13 buttons and three knobs. This one will have two buttons and a volume control. Thanks.
PLAY and STOP then? What about SHUFFLE? NEXT? Oh, two buttons you say. I guess you could automatically play things in SHUFFLE mode (randomly select a track not yet played) and maybe have a long press on PLAY (whilst playing) to move onto the next track? S what are your design plans, Dale?
@@RalphBacon Oh you futurey people and your need for new fangled buttons and such :)
My target demographic is aged Luddites. Mom has never been an early adopter, and now (in her 90s) is likely to unplug a thing, rather than work out how to make it do what she wants. Actually I was thinking... one button for on and off, and one for skip the current music. Either button will turn on the player. Once on, LEDs in the buttons (one red one white) will differentiate between the buttons for OFF and SKIP. The stop button will record the current selection, allowing the on button to continue were it left off. The skip button will be monitored, to identify any music that seems to be "out of favour," and we can cull from the "play list" at a later date. If it's not too difficult, I may work-in a priority function that would play skipped music, less often. Shuffle will be the defacto playback mode. Unless, of course, mom would prefer listening to her music in a repeatable/recognizable order. I anticipate a long UAT period. I'll probably look at a similarly adorned IR remote control (2B,1K), as she may need to halt playback from across the room.
As for admin functions... "press and hold" one or more buttons would get you into some level of programming/control. I haven't yet worked out the details, but I'd like my sister (lives within a 10 minute walk from mom) to be able to reset the skip data. Maybe edit the playlist via Blutooth. Also, I'll need to revisit your Mom-O-Vision concept, to see if we want to go there.
Perhaps you Mum needs an Alexa so she can just say "Alexa play the XXXX station" or "Alexa play Frank Sinatra". No need for any buttons. Not even volume. "Alexa, louder/quieter". Simples. Just sayin'.
@@RalphBacon Well... Let's see... I don't have an Alexa but i'm guessing there is some degree of customization involved before it is fully functional. I've also heard that Alexa has been responsible for some peculiar utterances. Giggles and such. Both of these concerns would bother me, (mom more so). It's going to be minor challenge to get acceptance of my two button intrusion. It'll "take up too much room", "get too hot", or possibly "only work in the morning."
I will however, keep Alexa in mind. A friend of ours, who lives alone, uses one as a "companion" of sorts.
@@RalphBacon heads-up... I deployed the MomP3 player a couple of weeks ago to critical acclaim. Well at least mom took to it like a duck to water. I think the kicker for her was all of the older music I'd installed.
Won't say that I'm a big fan of the mp3 module, but I was able to get it to work the way i wanted.
Hallo Ralph. I like your explanation and full documented example. Good startpoint to play with this MP3 player. Thanks for your time !
Thanks, Huib, I'm you liked it. There's more you can do with this player but once you get as far as the demo sketch I guess you will figure out what else you can do. Thanks for posting.
Hallo Ralph, I was playing around with the commands but some did not make sense to me. Looking on the internet I found a very complete document with all the commands and also code examples explained. My problem was how to found out how repeat play works in a folder. The link is :
www.trainelectronics.com/Arduino/MP3Sound/TalkingTemperature/FN-M16P%20Embedded%20MP3%20Audio%20Module%20Datasheet.pdf
Regards
Huib
Thanks for sharing that information, Huib, very useful indeed for everyone reading your post.
Thanks for this Ralph, makes it much clearer that this could be the right module for my miniature jukebox project I am thinking about. Thumbs up!
Yes, Ernst, this could make a great hub for a miniature jukebox. Just think about how you are going to list the tracks for people to select? I *believe* you can read the SD card to get a list of file names but I'm not sure any more. Worth reading the spec sheet on this though.
Ralph, I will do some more digging when I receive them. A digital display of the songs would be very welcome.
If you get this working in the manner that a user would expect (in being able to see a list of songs and being able to select them) do post back your success story (or what is not working as expected). Good luck!
I will!
Hi Ralph, still working on the jukebox. Being successfull getting to do the things I want it to do, except... I can't seem to figure out how to read the track number playing. If I can get that, I want to build an array of song titles and artists, linked to the right number and display that in a 128x64 OLED display. I know there is a command that 'Queries the current track' but I cannot seem to get any reading. Can you give me a hint? Thanks!
Hey, Ralph!
I stumbled upon this module once and it really picked up my curiosity. This will definitely will be one of my next projects. Ultimately, I would like to control the music from a portable device, but play it via Bluetooth to a « respectable » sound system .. on control it via Bluetooth, the device being already connected to that same sound system. Hmmm! This is definitely to be followed ... Take care, my friend!
The downside of this module, Daniel, is that you can't read the track name that is currently playing. So you would have to know that track 0001 is "Stand clear of the doors" and track 0006 is "Heavy rain forecast". But that works fine for my Benny Rain Alarm system which has been running for well over a year now.
@@RalphBacon Agree, but it is not that much of a downside .. for me. We could find a way to read tracks titles and display them one by one, coupled with the rest. Another project ! Hahaha!
Take care, my Friend !
Excellent content Ralph. I got my mp3 working in 10 minutes. Subbed :)
You are most welcome deapecunia, I'm glad you like the video and got your MP3 player working too. Nice to hear from you.
Great presentation. I bought one right after watching you video. If I can get it to work as well as you did it’ll be a good addition to my project. Thanks
No reason why it won't work, Ricky, it definitely out-performed my expectations of it! Even the music quality, when played through a proper speaker was quite acceptable. And for Arduino projects it's ideal. My cat-run rain-warning message is still running ("Attention - Rain has been detected") to alert us to get in the cat basket for Benny. Let us all know how you get on and what you're going to do with it.
Ralph Dude cheers for this vid love a bit of 7,0,2... Every time you said 1,0,0 I was expecting RUSH to start playing!!! TFS, GB :) (Thanks For Sharing, Graeme Brumfitt)
Glad you enjoyed it, Graeme, you comment made me smile! 😂
Hi Ralph, I went with the 2M flash version to save the SD Card requirement. Cost to the UK was £1.82 all included. Might be worth mentioning is the JQ6500 chip. This is excellent for our projects.
Most definitely a mention, MIchael, thanks for letting me know about this alternative. I've now ordered a couple (same price as you, couldn't get any cheaper not even on Ali Express, not even if I bought 5). So thanks for the heads-up, I'll be interested to test out the quality (good enough for a lift / elevator announcement but what about music) :)
Ralph, love your videos. Question about the voltage splitters. I can see why you need one for the TX pin on the Arduino to drop it from 5v to 3.3v but why do you need on on the RX pin. The voltage coming back from the MP3 player should be 3.3 V and that should not cause a problem for the Arduino and since you set that pin to INPUT why would it ever generate 5v? Are you concerned about transient voltages ?
Thanks,
-Richard-
Yes, Richard, I had wondered about that many a time, but I was following what was recommended on the datasheet. Even though the Arduino pin is an input pin I wonder if 5v is still present there? After all, if you set the input pin to a PULLUP then it will definitely have 5v. Without the PULLUP the pin is probably left floating but what exactly does that mean to the MP3 player? Long story short, it's just safer to include the level shifter, but it would probably work without (but at your own risk!). I'm very glad you like my videos, and thanks for posting here; always good to hear from my Arduinite followers!
Good video. Not sure you need the potential divider from the TX on the DPFPlayer back to the Arduino - those pins are 3.3V/5V tolerant. You only need them from Arduino to the player.
You're probably correct there. Output from the MP3 player might only be 3v3 anyway and if it were 5v the Arduino would not care.
Very good video, only a shame I didn’t see it earlier when I was doing my own trial. The issue I had which meant I shelved the project was the lag between asking for a track and it starting to play which for me was anything from 0.5 to 1.5sec .. I spent a while trying to see what I had done wrong but left it with the feeling that the unit is good enough for an MP3 player and I was expecting too much.
Keep up the good work!
I guess that the time lag is the buffering time when reading the requested track from the SD card, decoding the first few frames and starting to play. I wonder if there is a lag when pressing Play - Pause - Play? I'd expect it to play after a pause immediately (which would sort of prove the point). The only thing I did not like about this device was that you could not select a track based on file name.
Great to hear from you Chris, thanks for posting.
I had a pair of those type headphones and yes, awesome set of heaphones up until the day a friend sat on them and broke them.
I'm guessing, Mark, that I referred to my Sennheiser HD414s (my memory is vague)? They're hanging on their hook next to me, I use them when editing my RUclips videos! Very good headphones still after all these years! Merry Xmas.
I have enjoyed your Arduino videos, however, I have a question: I have not been able to locate a sketch/script/etc that demonstrates how to list the files on an serial MP3 player, like the DFPlayer and/or Catalex which seem to be nearly identical? e.g. filedump, dir, list, listfile etc sketch.
Hi John! You shouldn't have to look very far, as although I have never had a need, the Arduino website itself has an example that might suit or which you might be able to modify: www.arduino.cc/en/Tutorial/listfiles and demonstrates (well, mentions) the printDirectory() method.
Thanks for getting back to me. I've been to that page/link many times via Google searching for a working 4pin serial SD library, however that page states it has an error. The Catalex and DFPlayer seem to use the same libraries and pinouts and need only 4 connections (5volt or 3.2volt, ground/GND, RX and TX, no CS pin/lead). However none of their sketches or libraries show a simple file directory (DIR, list, dumpfile/filedump, etc command) for either of these devices. I know the Arduino and, ESP8266 families have very limited memories, but it seems only natural a directory listing command/function would be useful. I know I need one. I've left a couple posting elsewhere, but neither site could resolve this issue.
+John Turcott
I've reported that error to Arduino.cc but the code is also available at www.arduino.cc/en/Reference/FileOpenNextFile (see the function that does a PrintDirectory).
That all said, this is not going to help you when using the MP3 player, if that is your goal. Using a standard SD card reader it should work as expected.
The DFPlayer does allow you query the current file (see the datasheet www.picaxe.com/docs/spe033.pdf at just above the section 3.3. Returned Data of Module). However, I suspect, that as the module only really cares about the first 4 digits of the file name then this is all it will return.
However, if you wanted to use this in a jukebox application where a user could select a track to play then it would be "fairly simple" to put the SD card into an SD card reader, let the required info be extracted then place the SD card into the MP3 player and use some logic to tie the names together. A bit clunky but if this were my goal it would be on my short list to try.
Perhaps you just want to read the SD card though with no MP3 involvement at all?
Unfortunately what I need is to allow the user to turn on/power up their Esp8266 or Arduino and have it list the MP3s stored on the DFPlayer or Catalex serial MP3 player. Then allow the user to scroll through the directories and select an MP3s to play without having them or I to manually create a text based list/log of MP3s, especially since each user would add their own MP3s to their respective SD card(s).
I think I'm asking to much of your time; basically there just doesn't seem to be a command to list the MP3s on an either of these 2 devices. As far as other SD cards, I have no issue listing files etc, however these 2 devices seem to be missing an important command/function that I need. Thank you again for your time. I know you've got a lot of great videos out there, so, if no one else cares about listing serial MP3 SD content, then it must be not worth anyone's time resolving this issue.
Retrospect; I bet you're wishing you pressed the key.
Before you give up (or I press that DEL key!) I would test out what the MP3 player returns on the "Query current track" command; does it just return the first four digits or the whole name? Look at the datasheet I linked to (a post or two up from here) to find out the command. If you find that a step too far I'll add it to my Xmas Things To Do list (but no promises). But now you have indeed identified a need but no solution so my interest is piqued.
This vid's thumb don't go up! I tried. I'm thinking of including this concept in a plant-watering system, with brief sounds as indicators of a session watering house plants. Error message for failure to pump water, low water, announcement of start of session, end of session. Your examples will make things come together much faster. Best!
Absolutely, RJM, a brilliant application if ever I saw (or heard) one. And, just to make it interesting, use a sound changer program to make your voice very different in the MP3 recordings. Even reducing the pitch a tiny bit will make it sound most unlike yourself!
Sir, if you only knew how far down the scale I am from creating "brilliant applications". Though... perhaps I AM brilliant. My Mom frequently called me son. Brilliant? Son? 'Allo, is this mic on?
Thanks.
Hi Ralph. Thanx for the great content, recently found your channel due to the DFPlayer and i have learnt quite a few new tips and tricks. I was just wondering whether you have been able to get it to repeat a track?Just for clarity, i use the multiple folders option so my sounds/tracks are split into numbered folders. i have tried the following based off of the banggood link:
0x08 8 Specify repeat(NUM): This is very unstable, as every time the board reboots and a different track order is loaded, the hard coded repeat for the error/boot bugs out and plays what ever song was made to play first
0x19 25 Single loop: Cant seem to get this command to work, it specifies that it is able to loop a specified song, i have tried running the command before, during and after a track playing.
0x17 23 Loop Folder "01": This is the only one i seem to have success with, but this means isolating every track i would want to be able to repeat into their own folder, severely limiting my options.
Thanx in advance and also thanx again for the great vids!
Let me have a look at this when I get back to the UK, Marcelle, I can't remember what I tried without checking. Give me a nudge if you don't hear from me!
Thanx for the reply! I have also been experimenting with the little board and thus far for my project have run into some hoops with it. But i guess thats how you learn. The busy pin on it doesnt seem to transmit Low as it says it shoukd when playing a file, only when it receives and sends a command. And also cant seem to get the "get state" method to work. Dont know if anyone else experiences this and cant seem to find many forums on it
It is stereo, spk1 GND spk2 both speakers connect with one lead to GND and the other leads to spk1 and spk2
No, the speaker is mono but the line out is stereo. But that then requires an additional amplifier of course! Good question, thanks for posting.
Thanks for interesting video which prompted me to buy one. Have you or anyone else had trouble with songs not playing in the correct order. I recall reading somewhere that the order in which files are copied to the SD card is important with this module. For years I’ve noticed with all versions of Windows that if you select files like photos from top to bottom the LAST one is shown first and then in the correct order. If you select from bottom to top it’s fine. This applies to copying files to the SD card for this module. I’m working on a speaking clock and as a test got it to count from 1 to 59 and spent hours of head scratching and cursing wondering why the numbers were all over the place! All the files you need for units and tens of minutes must be copied in one go using the above method.
I guess it's down to the order of the entries in the FAT table that determines the play order. I wonder if there is a utility out there that can change that on the fly, as it were?
Thanks for the video. Subscribed and notified. I am waiting on a similar module from China ☹️, should be hear by end of next month. Looking to use voice playback for various projects including clock announcements or danger alerts. Plenty of voice synthesis available. Or my favourite is Google translate. English to french. Copy the french the reverse it back to English and record the audio on laptop via Jack input. Build any number of commands or warnings using Google voices. Ideal if you don't want a strong accent like mine from Newcastle in a non geographical project. Keep up the good work, only just discovered you.
Glad to have on my Arduinite journey, Graeme! There's another text to speech converter that I've used to great effect, that allows anything you type into the screen to be spoken - just capture the audio and you have a clear announcement. Or, make the French or German voice say the English sentence - very Peter Sellers, and hilarious. I just captured the audio from my speaker (as though it were me speaking) and put it on the MP3 player's SD card. Works like a dream. For higher quality, capture the actual PC output from your soundcard. Thanks for posting, great to hear from you.
onlinetonegenerator.com/voice-generator.html
great vid... I was able to get a lot out of this little device but still struggle with one bit. I want to loop or randomly play files in the MP3 folder... have you tried anything like that?
Hi James, good question!
To play files randomly I would generate a random number (between 1 and however many tracks are on the SD card) and ask the MP3 to play that. Turn the number into a four-character string by prefixing with the "0" character, eg 0001 to 9999 as the datasheet says that all tracks must be prefixed by that (although another poster here seems to have had success with just the name, but I haven' t tried that yet).
See the Arduino help on Random() [www.arduino.cc/en/Reference/Random] and also ensure you call RandomSeed() in your Startup() method otherwise you'll get the same 'random' sequence every time. Just read the value from an unused Analog port in that call to get your seed value, eg randomSeed(analogRead(A0)).
To loop (single track? all tracks?) you would have to know which tracks you want to loop. If it's the currently playing track then your code would just re-request the MP3 player to play the same track (perhaps the user pressed a button to mean 'play again, forever'). Tell me more what you want to do here and I'll see if I can help.
I may explore this MP3 more fully in the future but in the meantime thanks for posting, good question that may help others too!
Sorry, I meant Play only the songs in the MP3 folder, not all of the other folders. TheDFPlayer library seems to support only looping through all of the audio objects stored on the SD card... not allowing the MP3 Folder to be selected with the loopall() function.
Thank you loved your demo.
Thanks for that, Rainieman Lewis, nice to hear from you.
Thanks for the video, Ralph. very easy to follow. I'm just a beginner and trying to gain knowledge with a 'current' electronics knowledge just short of basic. I'm perplexed by the need for a voltage divider on the TX of the MP3 player. Isn't the voltage on this line provided by the MP3 Player rather than the Arduino so would be at its 'native' level of 3v3. If that is the case, wouldn't the voltage divider have the effect of dropping the voltage input to the Arduino RX pin to 2v2?
I don't want you to be perplexed any longer than need be, TheBLCBbob, so let's think about this. The output of the MP3 player is indeed 3v3 but the input voltage on the Arduino is still 5v (think about how an input pin on the Arduino can be biased high to the 5v line) so current would tend to flow from the Arduino to the MP3 player.
This *may* not matter or happen; a proper voltage shifter (as shown in other videos here) would deal with this, but the resistor way is a rough and ready (albeit safe) way to achieve more-or-less the same effect (although it does reduce the output voltage in the way you have calculated). If you're brave, don't put anything on the Tx pin of the MP3 player. It will probably be fine. I'll think about this post some more as time goes by. Thanks for posting.
thanks for the support sir.... could you pls make video on using a flash memory instead of sd card. which flash chip can be used and how to store audio files to that....
Well now, Abhin, that does seem quite an interesting idea. Let me dwell on it a while and see whether it is something that could be useful. Thanks for the suggestion.
Hi Ralph, I need create a program using this MP3 player and managing it with a keypad, but I can´t do by myself, I don´t have enough arduino knowledge yet. Please can I order you this project? Thanks in advance, kind regards, Oscar
Hi Oscar, thanks for your interest. Unfortunately I just don't have the time for custom software but I can strongly recommend the Arduino forum who can help you with the coding. forum.arduino.cc/index.php is the place to ask for assistance. When I'm back from vacation I'll see how you got on!
Thanks Ralph!!!
Good, informative video here, Thanks.
I have a question on the module here, of how long it takes to switch tracks? Maybe better asked as how much delay is there between sending a play command and when the file starts playing. I'm working on a project where various sound clips need to be played without any noticeable delay between them. I'm planing on having about 30 clips that need to transition from one to another without any dead space between them, and came across the video here while looking at various options.
Thanks for any information.
JGL
+John Galt Line
Hi John, interesting question. And it's not the answer you're looking for as I haven't tried this. However, this module does allow insertion of advertisement tracks into an existing running track (presumably music) and you wouldn't expect big (or any) gaps to appear in the sound stream. You may be able to ascertain the answer from the datasheet, otherwise you may have to buy one to try it out - let's face it, they are extremely cheap. If I get the time over the Xmas period I'll see if I can test this out but that is still several weeks away. Go on, get one and see if it works!
Thanks for the reply. I suppose I'll give it a try and see if it works out.
Hello sir Ralph. is it okay if i used CY-T16 v1.1? i`ve looked at CY-T16 and DFPlayer, they have the same pins.
Hi Arthur, the answer is "maybe". On the Arduino forum they seem to think these two modules are just rebranded from the same source but you just never know.
Or changes to one module are not applied to the other module and then the library doesn't work well (if at all). Depending on the price, you may have to take a chance. The DFPlayer I used though was remarkably good value from the source I showed in the video.
Pays your money, takes your choice, that's the best advice I can give as I have no direct experience of the CY-T16.
Thanks for posting your question though, others may have more experience of the module you refer to.
thanks for the reply Sir Ralph. I have a project right now, its called ANNUNCIATOR. you can set schedule with specific alarms and your time will be based on gps time so it will be accurate in terms of time.
and we will used an 3rd party program which is vb6, these will be the process. vb6 we`ll be the export and syncing tool of the schedules going to the arduino.
That's great Arthur, I wish you well with your project. Given the low price of GPS modules these days I'm almost coming to the conclusion that they are better value for money than the usual RTC modules, as the GPS module will always be accurate (unlike the DS3231 which has to be reset for Daylight Saving time and so on).
It's great that you're sharing that information as it will be inspirational to others too.
^_^ . I wish it would be a successful project Sir Ralph :) . In case i need some help, can u spare me some time to help me? TIA :)
Ok I'm a bit confused, you say to NOT use the RX and TX but in the documentation (and in video at 15:52) its hooked up to those ports....
That time-point was talking about mp3 tracks! But, in normal use you don't want to connect anything up to the TX and RX pins of your Arduino Uno/Nano as they are used when uploading a sketch. Better option is to use SoftwareSerial library so you can allocate other GPIO pins for your own RX/TX. I don't know whether I do that in this video (it was a long time ago) but that would work just fine. Sorry for the confusion, J.
Quick question: Is the speaker out - line level? Or should I take the DAC outs to go to an external device, say an AUX in of a car?
The L/R line outputs are line-level and can drive an AUX input. The speaker output cannot be used to drive an amp (no common ground, it's mono / blended stereo). Any good?
Thanks!! Great work! Help me a lot!
Hi there Ricardo! Glad it helped you, amazing what that small piece of electronics is capable of. I'm also going to cover a solid-state version in the future (no SD card, just on-board memory). Thanks for your feedback.
sir, all your tutorials are great.... . could you please explain how to use the advertising function. i dont want to use the library.
Thanks for the support, Abhin. The spec sheet has details of the registers to use for the advertising function on page 3. DFRobot (the makers) have a web page for this (www.dfrobot.com/forum/viewtopic.php?f=2&t=1524) but it does need their library. Why do you not want to use their library? If you don't you will have to pick out the library functions and include them in your main sketch. I would suggest getting a sketch working 100% WITH the library first to prove it all works, the create another sketch WITHOUT the library and see how you get on.
In summary, you can inject a different audio announcement (or anything else) whilst the music is playing. the main music pauses whilst the advert is running, and then resumes when the advert is finished, exactly as you might expect.
I have several of these little guys laying around in different state of build. I built some up on boards and wired them to the Arduino that way, then decided it wasn't worth the effort and simply mounted some push buttons on the same board and use it direct to the device instead of through the little Arduino's. TO avoid the voltage problem I was using the 3 volt Arduino what were they called micro or mini, I don't recall which, the one with the 168 processor not the one with the Leonardo processor, however I guess that would probably work as well, just never tried it. Now I am playing around with a VS1053 shield on an Uno, I would like to be able to put a TFT screen atop the shield, I think it can be done but I am not all that confident in my programing ability, I used to be a wiz at BASIC but never really got into C. I do have a couple of Nano's that I have installed BASIC on, perhaps I will shove that into an UNO and give it a shot, na too much like work, but maybe.....
You can put a TFT on an Uno - follow my video #83 ruclips.net/video/Fj0yXP0tCLU/видео.html and it works very well, but does use most (if not all) the pins on the Arduino. But you could dedicate the (cheap) UNO to the cause and communicate with it using Tx/Rx.
hi Ralph, do you know what's the operating current for this DFRobot MP3 module ? ( so far from datasheet, it only mentioned "Standby Current 20mA" )
I'm afraid I don't know any more than that, Ricky. But I would not have thought it would increase much because it is not driving anything substantial really. The only way to _really_ find out is to measure it.
@@RalphBacon , noted thx again.
Thanks for taking the time to create the video! Just wondering which IDE you're using?
Brent
That's probably Eclipse Sloeber Edition, Brent: eclipse.baeyens.it/
@@RalphBacon Wow Thanks! There's a whole new world out there!!! Need more time in the day...
sir which ide are you using..... could you make a tutorial on the ide and the best practices... hopefully waiting.....
Well now, Abhin, you're probably referring to the Eclipse IDE that I use. However, I won't be doing a tutorial on that because it sits squarely in the "advanced" category. This means it's probably overkill for 99% of viewers to my channel, won't be of interest to them and is not the easiest of IDE's to configure. I recommend you look at the Sublime Text Editor that I describe in video #69 which is a nice balance of features vs ease-of-use. Have a look!
Brand new to Arduino's looking to add lights and sound to 3D printed prop picked one of these up cheap from china £1 and have a few Arduino nano's going to hopefully try and work out how I can have it so when I press the button once it turns on 1 set of leds and on two presses it turns on a second set of leds and starts playing a sound file in a loop.
As you are a beginner, Pilks, it would be easier to code if you had two buttons, one for the LEDs and one for the second set of LEDs with music. Then you can build both parts separately. Just sayin'.
Will the device allow you to seek to a specific spot in the music file? I play bass and I want to build a little practice device that allows me to repeat a segment of the mp3 over and over.
I couldn't tell you without reading the datasheet, John, an option I'll leave for you!
@@RalphBacon lol. It sounded like you were deep in the datasheet. I thought you might have seen something. I'll poke around.
might I suggest downloading Audacity (free version) for Windows. Marvellous editing program. you would be able to record tracks alongside to compare your work with the piece you want, it does loops as well.
Thanks for your posting. I want to add different buttons that allow me to listen to different musics,should i change this code so much? Also, i want to use a power source rather than a laptop what kind of DC adapter should i buy? In addition to DFplayer i will add a motor, a sensor that detect the sound and motor will work also leds. I am wondering that the power source.
Hello Huseyin! First of all, will you be using an Arduino to control the MP3 player or use it as a standalone module? That will have a bearing on your choice of power supply. Your requirement to add buttons is quite easy. Let me know how you intend to control the player and we can discuss further!
Thank you very much for your reply.
I am planning to use DFPlayer,speaker,resistor,wires,jumper wires, buttons in addition to Arduino and breadboard. With these, I can design a MP3 player with buttons moreover, as soon as the music begins I want to prompt to motor that should throw a little ball.What kind of motor should I buy and what kind of sensor is necessary in order to detect the sound and prompt the motor?
OK, then Huseyin, you'll need a power supply suitable for the Arduino as well as the player so a nice stabilised 9v 1A (or more) plug-in wall-wart will do nicely for both the Arduino and MP3 player.
Regarding your motor for ball throwing, well that's another question altogether. How do you envisage it to work? Like a tennis ball launcher or something a bit simpler with just one ball? You may have to Google that one.
The detector for sound could be a simple, direct electronic connection from the MP3 via a rectifier (diode, capacitor, resistor) that is connected to a one of the Arduino's analog pins - this way you have control on sensitivity and no need for any microphone. It basically turns the music AC voltage into a small DC voltage that you can measure. If you would rather avoid discreet electronics then a simple microphone-based "sound switch" (plenty on eBay) would work but would also pick up other sounds (voices) which may not be what you want.
Anyway, these are initial thoughts that will hopefully get you thinking and experimenting, I hope it helps.
Hi Ralph, I'm trying to get this DFrobot Mp3 player to change to another folder and play songs from there eg...."execute_CMD(0xF,05,001);" which it does and then stops playing instead of continuing to song "002.mp3". Any suggestions?
Is the CMD you are using just to play ONE file, not continuous playing? If so, you might be able to instruct the player, once the song has finished which you can detect, to [continue to] play [all songs] and it should play them from the current folder. A bit of trial and error, I'm afraid, not to mention avid reading of the spec sheet!
@@RalphBacon Got it! managed to get 20 folders with as many as 398 songs in 1 of those folders to work using Arduino 2560 Pro and 20 switches connected to 20 pins of the Arduino, I watched a video on UTube that said that you couldn't use the ADKey method for this, otherwise that would have made my set up so much easier i.e. 2 pins with 10 switches each. Any comment
@@RalphBacon Oh, the next problem I am trying to solve is figure out some indicator -LEDs (1 for each folder) or a 2-digit display to indicate which folder is active, any suggestions?
Ralph, again, great video. I'm looking for something that can play a sound file when a button is pushed and play another file when another button is pushed, while the first file is still playing. For example, push a button for a long "Wooooossshh" sound (6sec) and two sec later another button and a short "Ding" (0.5sec) whitout cutting the first woosh. And maybe while having a minute long background song too? I'm building a game you see, and this would be very usefull. I did receive the unit you use in this video 10 months ago but I haven't been able too experiment with it yet and I dont think it has these features. Any tip and advise is appreciated!:)
You're right, Mr FunctionalDesign (I'll call you Terry, as it's friendlier), this unit does not have those particular features. However, you could just use multiple devices (at £5 / $6 for THREE units, they're a cheap way to implement your requirements).
Your Arduino controls the units using SoftwareSerial so by creating 3 different instances of this and using 3 sets of 2 pins you could, I reckon, control 3 units just like that. I'm not sure about connecting them all up to the same speaker, I'd be tempted to take the L/R outputs of each, and feed them into a simple (passive) mixer to a separate amplifier module and speaker.
This really is straightforward to do and won't break the bank even with a mixer/amplifier and speaker. If you need a circuit diagram let me know.
However, if you are building a SINGLE game that requires limited FIXED sounds you could think of using a cheaper, non-SD card version of this module, that has a small, on-board memory that might fit your needs - but would be much less flexible in terms of what sounds you could play due to memory constraints. And although I have such modules I have not even opened them up yet to play with them so cannot advise on their suitability - just a FYI.
Is there a mode for this SD card reader to automatically stops after playing only one selected mp3 file?
You need to read the manual but I'm pretty sure you can tell it to play just one track adn then stop.
This is brilliant. It would have saved me days of work 18 months ago, when in the end I gave up. Would it be possible to get a copy of your ino file? - I've just bought another module to try again/
No problem, Andy, I've just uploaded it to DropBox so if you look in the video description notes you will see it as number 3. Can't believe no else has mentioned this!
Hi, I'm considering picking one of these modules up, could you tell me if you think it would be possible to control the playback speed or frequency of the audio via a potentiometer? Thank you.
I'm afraid that functionality is not specified in the manual (see the video description, there's a link to my GitHub where you can find the manual for this player). It lets you pause, play, increase/decrease the volume and so on, but nothing about slowing or speeding things up, I'm afraid.
Ralph S Bacon Thank you for replying and I shall look into the manual your github. I'm very new to Arduino and was ideally thinking of some sort of random sound player where you could adjust the playback speed of individual sounds/mp3s and also for how long it plays each file (so you could use a potentiometer to dictate the amount of time spent on a sound before moving to the next one).
Yes, that sounds fab but trying to find a module that allows that, at a hobbyist price, might be a challenge. If you DO find one let us all know!
Ralph S Bacon I certainly will do! To your knowledge, do you think it would be possible to use a potentiometer to 'pulse' between sounds i.e the pot would dictate the amount of time spent on sound1 before moving to sound2 and so on?
I'm not sure how you envisage this working. Are you switching between sounds sources, and how are you doing that? I'd need more info to comment, really.
Hi Ralph, I've been trying to wire a Microwave Movment sensor to the Player without the Audrino. but just can't get it to work. Can you help please ?
Does the microwave movement sensor issue the correct signal that the MP3 player is expecting (eg high, low, something else)?
@@RalphBacon I’ve tried all the pins lol. It works when you put a wire to IO1 or IO2 . I just can’t see if it’s possible without using a nano or uno .
If the sensor delivers a signal, you can use a transistor to switch the pin on the player, maybe. Like in the pre-microcontroller days!
@@RalphBacon Ok I'll Give that a try later. Yesterday I did notice that the wire i have conected to the pin 9 on the header pin if I touched the other end ofthe wire to the actual Pin 9 Pin on the Player it plays the sound on the sd card.
Hi I have this mp3 player on arduino uno setup with 3 buttons (pause,back and forward) but I want to control it with a 433mhz remote control just on and of would be ok, Also I want to add a white 5v led that fades in and out in rhythm with the sound. I have spent about two months on youtube researching with little success, so I would appreciate any advice or links would be great or maybe this is a project too far for a newbie to arduino and sketch code ? thanks. The project I want it for is a Dr Who Tardis 12x6 inches that I 3d printed
This is very do-able indeed. If you watch my videos #26 & #27 you will see how I control some lights using a 433Mhz remote control. The concept is exactly the same. Instead of dimming or brightening the lights you would issue the command to stop, start, skip the MP3 tracks. I'm assuming at this point that the Arduino you mention does actually control the MP3 player directly (eg from GPIO pins)? So how does it work? Well...
The (usually 4-button, ABCD or similar) 433Mhz transmitter sends a signal to the receiver which has 4 outputs, each of which corresponds to the buttons. There's an additional output that responds to _all_ the buttons (so you can flash an LED or something to show the signal has been received). Wire each of the receiver's outputs into a GPIO pin and "poll" to see whether any of them are currently receiving a signal. You do this by checking the state of each pin in the main loop( ) function. When one of the pins goes high (has received a signal) you just take the appropriate action.
My first recommendation is to watch both videos so you understand how I did it, follow the sketch etc. Then modify to suit. You might not need all 4 buttons, for example. If you have further queries post them under this post as a "reply" so we keep all the threads nice and clean. Good luck!
Thank you so much for you super fast reply and yes the player works great but the sketch and wiring etc I acquired from another youtube channel but I did try combining some other sketches with my existing mp3 sketch after watching a video on how to do this but with no success, so as you advised I will check out your other videos and do some more research. Thank you for your advice and time.
Hi there Ralph,it seems that the link to Yerke's work, at Banggood , no longer works .
This is a shame, indeed, Bruce. I checked and you are right, of course. I suspect that either Banggood has had a good clear out of their forum or the product has been discontinued and a new one stocked and they did not think to transfer the forum information. I will eventually change my links, so thanks for bringing that to my attention.
Hey, that was I quick reply, Ralph. Thanks enormously for taking the time to respond. I haven't had my Uno long so I'll read up a bit more on pin setting and, oh, I'm not brave! Last question, I promise. What does the 2k resistor achieve if the voltage divider is to reduce the voltage from the Arduino pin as would the voltage still not be 5v at the node with or without that resistor?
Interesting. At 06:17 in the video, I show the diagram of the resistors we're talking about. I'm wondering whether the 1k resistor connected to the Arduino's RX should not be _before_ the 2k resistor. That way, if the Arduino RX pin is at 5v we will only see 3v at the junction of the 1k and 2k resistors. Basically, wire it up exactly as per the Arduino's Tx resistors. I should have measured the voltage at the Arduino's Rx pin - that way we might figure out whether I had a reason for doing it this way or whether it is an error (after nearly 2 years!). Well...
Well, TheBLCbob, if you ever get one of these MP3 players to attach to your Arduino perhaps you can do the honours, and report your findings back here? In fact, just loading the sketch would be enough, no MP3 player required, just measure the voltage at the Arduino's Rx pin. Amazing that you are the first to spot this after all this time. Kudos to you. Thanks for posting (I think!)
Thanks for getting back, Ralph. I first watched your video a couple of months back when I was thinking about a project to detect an cat that frequently ventures into our garden after birds with an annoyingly prolific and unsavoury bowl movement. A Mission Impossible style laser beam detector wired to the Uno with a deterrent output was my thought. After some of my more extreme ideas were vetoed by the wife, I considered a barking dog effect first and maybe a high frequency sound emitter if that fails or annoys the neighbours. On watching your video I ordered the DFplayer which arrived a few days ago. That prompted me to revisit your video for instruction on the module. Your revised thoughts on positioning of the 1k resistor seems logical to my presently limited understanding and, for the sake of a couple of resisters which I might pick up in a pack before Maplins 'closes', I'll follow your experienced lead. I'll also take your challenge of measuring the pin output voltage initially with the code running and again when the DFplayer linked in and report back. Cheers, Bob
Right, Ralph, as promised. These are my voltage measurement. The conditions are:-(1) circuit as per your video but with the 1k resistor moved to between the Uno and the node of the voltage divider (VD) and 2k2 resistors used instead of 2k as that's what I had;
(2) Code loaded and running but took lines 33-46 out of the downloaded code as causing compiling issues;
(3) for identification purposes - white leads used for circuit between DFPlayer (DFP) TX and Uno pin 10 via a VD, and yellow leads used for circuit between DFP RX and Uno pin 11 via a VD;
(4) Uno powered vis USB connected to PC;
(5) DFP playing; (6) no commands being sent during tests;
(7) measurement taken across point specified and ground. My voltage readings were as follows:-Measurements (a) to (f) were taken with leads disconnected between DFP & voltage dividers
(a) DFP TX +3.34v (white)
(b) DFP RX +1.51v (yellow)
(c) Uno pin 10 +0.38v (white)
(d) at VD node on pin 10 circuit +0.26 (white)
(e) Uno pin 11 +4.88v (yellow)
(f) at VD node on pin 11 circuit +3.35 (yellow)
The following measurements were taken with voltage divider circuits fully connected
(g) at Uno pin 10 +2.84v (white)
(h) at VD node connected to DFP TX +2.79v (white)
(i) at Uno pin 11 +4.88v (yellow)
(j) at VD node connected to DFP RX +3.35v (yellow).Make what you will of that.
Bob(N.B. try as I might, I can't seem to get the formatting of above text right despite several edits!)
That is certainly a comprehensive list of measurements, Bob, well done!
So the one we're particularly interested in is the Arduino's RX pin (10) which you show as _almost_ zero. Ditto for the potential divider, but rises to 2.79 when connected to the DFP TX pin, which is just the 3.34v reduced down by the resistors.
The Arduino's TX pin (11) is 4.88v (so nominal 5v) but is nicely voltage divided down to 3.35v for the DFP. All safe.
So it would appear that the Arduino's RX _might_ be able to be connected directly to the DFP's TX pin as it is the DFP which has voltage, not the Arduino. On the other hand, if it works as is, I'd leave those resistors in situ, in case the Arduino does ever let that pin go high (perhaps when transmitting, who knows).
On the subject of compilation errors in those lines, if you're using the Arduino IDE you must put the line starting "template" on the same line as the next line in my sketch, starting "void debugPrint". Then it will all work in the Arduino IDE too.
So you're safe to continue, Bob, and you were right to query the setup in my diagram, but no harm is done either way. I guess if it hadn't worked others would have made their views known by now! It's a nice player, the biggest drawback in not being able to interrogate the player for the filename currently being played. this, of course, is not a problem when playing Muzak in shops!
Thanks for the information Bob, let us know how you get on with it generally in your project (and whether it has any success in deterring that rogue cat - I must not let Benny read this, he will be most upset!).
Thanks for the heads-up on the code, Ralph. I took those lines out after seeing that the code you used on the video (at 8:40) didn't have them and then it worked. However, following your explanation of what caused the errors I have put them back in. I shall be leaving the second VD in place as you suggest for belt and braces without disadvantage. It is a good little player. Thanks for the chat. Bob ;-{)
Amplifier is mono, dac_l and dac_r are aux stereo :)
Hey Kuk, thanks for confirming this, as I suspected. The quality of the amplifier (especially the L + R independent signals) is not bad considering it's intended purpose. Thanks for posting, others will be interested in your findings.
It's very good, I have used one in a gutted Jukebox(still had the amp). The Arduino runs the coin-mech input, the input 32 buttons( IC2 extend board (£1)) and relay to a solenoid to release the button, the lights(Programmable LEDs and RGB LEDs), a oled price sticker, the mechanical whirling sound effect(little internal pre-amp speaker) and of cause, the mp3 sound output(switch by a 2nd relay) . Looks Good and sounds good :) May add a few disc scratching sound effects to songs ....
That sounds amazing! And you're fortunate it still had the original amp (valve or transistor?). This should be an inspiration to all Arduinites that shows just what you can do with some fairly simple electronics. Brilliant! And yes, add a few scratchy, clicky, static sounds (just to the beginning of [some] songs, not all the way through)! Thanks for sharing that, it sounds great.
It's has powerful transistors, with large caps and high watt resistor. No circuit board, all components are hard wired to each other.
Will add the needle drop to the amp sound, with few clicks. :)
I noticed that also.
Have you figured out how to put the title playing out to say a lcd 16x2 screen or perhaps a Nokia?
Unfortunately not, Jerry. There seems to be a deficiency in the commands to this module inasmuch that we cannot retrieve the file title. There are (very) clunky workarounds, but nothing I'd want to do. Perhaps a different MP3 player would allow this (if you find one let me know!). Thanks for posting, nice to hear from you again.
I see where I messed up, I just put the 1k resistor and neglected to put the 2k in. Didn't seem to kill the player, but it didn't work either. I simply re-routed my push buttons to the player and bypassed the arduino completely. It works OK I guess but I think I will rebuild it since I did it all on a perf board and both units are soldered in solidly. I used a pro mini for the setup and I think there is room for the other 2 resistors, but not sure how exactly I will wire them to become voltage dividers as you have.
Breadboards are the answer, Jerry, until you have it working and _then_ transfer it to perf board or strip board to avoid the situation you're in now! Some of my constructions never get past the breadboard stage (I still have a 3 x 3 x 3 LED cube sitting on one, complete with Arduino!). Just suggestin'
Thanks, I have a lot of breadboards laying around, there are just days when I look at them and think, "I can do that easier with a soldering iron!" However that said, I think I will go back to the breadboard. I have a lot of old arduinos laying around and a few of the MP3 players, I usually order 3 or 4 of an item because I know how I get when I just KNOW I can do that quicker with an iron....
If you have several Arduinos and breadboards then you can build it on a breadboard, get it working "just so" and then use the other items you have to build a version on a PCB or stripboard, safe in the knowledge that you have your blueprint sitting right there in front of you (probably taunting you, as it continues to work but your stripboard version fails to do what you intended - been there, got the T-shirt!)
Is it possible to make it play spacific file when you press specific buttons? If yes do you have a code or do you know were I can get it?
It's possible to make the mp3 player play a specific file by number, eg the first four digits of your file name, which I believe I might have demonstrated but it's been a while. So, for example, you can say "play file 34" and it will find a file that starts with "0034" and play that. Unfortunately, I have not found a way to play a file by name, which is a pity, because then you could easily make this into a mini jukebox. But there might be other, similar modules out there that do allow that.
Ralph S Bacon
Thank you !!!!
Anyone have any guidance if I wanted to do this, but with the SD card connected to the arduino and not built into the one like Ralph has?
I'm pretty sure the SD card on the MP3 player is tied into that chip, so trying to use any other will not work. But if anyone knows any different...?
However, its a good video with nice info. Thanks for sharing.
Glad you liked it! Thanks for the positive feedback.
I don't have a need for such but I'll keep it in mind.
A bit like window shopping, Raad, it's always good to know what's out there so when you suddenly DO need it you know where to find it, am I right?
Ralph S Bacon absolutely.
Great Video! I subbed.
Hello Arduinite! I'm currently on vacation 5,000 miles away from home so I'll have to be brief with these comments until my return, mid-July.
That's great news on both fronts! Thanks for your support.
Ralph, can the DFRobot MP3 module plays multiple sounds simultaneously ?
I don't think that will work, Ricky, as the play command either plays the next track or the track you specify, not multiple tracks.
@@RalphBacon , yes it can't but I have tried two units of DFPlayer using ping 2-3, 4-5 as COMM, both works on single Nano. DFPlayer does not needs PWM pins, normal Digital pin will do. Thx.
Using amplifier is optional or Mandatory in some cases?!
You can use a single, small speaker on the two speaker connections. Otherwise an amplifier on L1/L2 is required.
How can I access the PDF file you viewed in the video?
It's all in my GitHub github.com/RalphBacon/MP3-Player-DFPlayer
@@RalphBacon Thank you, I am getting sizzling when using led RGB strip with DFplayer, so how can I avoid it?
I am looking for a version, where external power supply is used for DFmini, not the 5v from arduino
You could any phone-charger type power supply for this module. Just connect the grounds together (common ground).
@@RalphBacon couldnt disagree with that, but I have a scenario where arduino is not powered, and use Dfmini standalone. I see phantom powering arduino . That's my concern
Yes, you will get phantom powering and could easily burn out the diodes in the GPIOs. For output pins you can use a diode (anode to Arduino) and for input pins a diode might work although I'm using a standard BJT transistor so nothing leaks past. See here:
forum.arduino.cc/index.php?topic=540000.msg3680701#msg3680701
A bit of a pain but it must be done.
Hey can u help me to get the name of currently playing directory and all the directory names to display on serial port or any display ?
I'm not getting that function in any of library but it's mentioned in the data sheet.
Thanks.
The $64,000 question is Sarvjit: where is it mentioned in the data sheet? I ask, because this question has been asked by many and I still haven't found an answer. It would be hugely useful if you could read the MP3 file name but, as yet, no-one seems to have achieved this. If you do discover there's a hidden command to do this *please* let us all know! Now, if...
Now if there is simply no way to do this, there is a clunky workaround (or two). For example, when uploading the music to the SD card, make another SD card copy. Exactly the same. Then you can use the Arduino to read the backup copy (track name etc) using standard SD commands on a separate SD reader, whilst playing the primary SD card on the MP3 player. Clunky? Yes. Will it work? Yes. Sometimes pragmatism trumps purity, as those following the Zen rules of Python programming will know.
Ralph S Bacon
www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299
Ralph S Bacon
www.picaxe.com/docs/spe033.pdf
Ralph S Bacon the by8001 module is similar to df player and it's library has all these functions i mentioned.
Ralph S Bacon one guy made a mp3 player using by8001 module which looks similar but has different commands gor the same functions for df player. He also added alarm clock and used tft display to display contents. The file name total time elapsed time etc. So please check how we can make the same using df player mini(alarm clock is not needed😊)
Thanks for replying 👍
Speaker 1 plus ground speaker 2 plus ground = stereo speaker 1 + speaker 2 = mono! I have one setup up but it is eating batteries, when I hook to my PS and watch the amps, she is drawing 1.5 amps then cut's out, resets the PS and plays for a few seconds then the needle deflects to 2AMPS plus and cuts out again. PS is set at 5.2 volts
Found the problem I think, I followed your instructions and unplugged the speakers, plugged in headphones and suddenly all is well, all is swell and tunes are flowing with no interuption, I was using an old transistor radio speaker on one side, a tiny bass speaker on the other side, one must be drawing to many amps or something?
WOOPS Damn those earphones became VERY warm in my ears then the brand new set of earphones died! Damn they cost me over 7 bucks! I must have burned something up in that player, when I first wired it up, I got a bit dislypsic and wired it backwards from an 18650 battery. Guess I will get a different one.
I forget the details on this video (it is quite old) but I thought the speaker was mono but the line out was stereo (ok for headphones, just about, but not for speakers).
You can delete this comment and I won't be offended: During this video, you mention the directory ".MP3" (uppercase) might need to be changed to ".mp3"(lowercase), however drives, folders and file names should not be case sensitive even between all the compiled languages and FATs. This being said, I respect and can learn from your response since the Arduino and ESP8266 IDEs are new to me.
Hi John! Now where is that delete button...
Oh, never mind! Now you're suffering from Windows-itis where nothing is case sensitive; file or directory name 'abc' is the same is 'ABC'. Not so in (most?) other languages, such as Unix, Linux and even (in some areas of) Mac OS. I've no ideas what rules Arduino C++ adheres to (C++ filenames are not generally case sensitive but the operating system it runs on could be) hence my comment about that 'mp3' directory.
Having said all that I can't remember whether I needed to change the directory name to lowercase or not (and as the SD card is now buried inside my wireless rain detector you'll forgive me if I don't take it apart to check!) But I will bear this in mind and perhaps demonstrate in a future video if I use an SD card or MP3 player again. Good point, thanks for posting.
Oh, THERE's the delete key... drat, too late now...
Oh, I plugged mine into an esp8266 which is native 3 volts so no resistors needed there.
Yes, that would be fine.
You probably don't check this anymore, but... I've tried 3 different modules and none work. Wired just like you. I don't even get the power light to come on. Running 4.3vdc on pin 1, speaker on 6 & 8 and ground on 7. I get a flicker from the power light when I plug in power. Grrr... Even changed to a 8gb SD card to make sure.
Never mind! File naming was the issue! :{
Thanks goodness you found the issue! I want to use one of these again in a near future project!
Hi this is pretty awesome. Can you show how to get this working with the ESP8266?
To be honest, Kulvir, this should work almost 'as-is' with an ESP8266. It doesn't use any Arduino-specific methods so should be safe (but if you find otherwise do let us all know). Good luck with your experiments.
The amplifier is necessary?
Yes, the output from this device is only good for headphones or as the input to a further amplifier.
I'm trying to make a project were when a switch is closed the mp3 player will play a spacific announcemant for example when a door is open it will play the specific mp3 file which say "The door is open" my problem is that if the push button is pressed continiously the file will not play, the file play's when the push button is pressed instantly. How can I fix this problem ? Thank you !!!
That depends on what that button is connected to; directly to the MP3 player or an Arduino? If the latter then it can be fixed in code. If the former then you need to use some hardware, eg a transistor or two to create a monostable, to give the MP3 player a single "pulse" so that the switch is not seen as continuously pressed. Let me know what your set up is and we will take it from there, OK?
Ralph S Bacon
My set up is that when for example pin number 2 from the arduino becomes LOW or connected to the ground brifly the mp3 file starts to play.
So, let's see if I understand. The door opens, the switch contacts close and the MP3 player does not play.But if you just briefly close (and reopen) the switch contacts, the MP3 plays fine?
If this is what happens, then I suspect that your code is constantly seeing that the door is open (ie the door switch contacts are making a circuit) and your Arduino is sending a constant stream of commands to the MP3 player saying "play file x", "play file x" over and over again.
What you need is a flag in your code. A boolean is best for this. Here's some pseudo code for you:
bool doorIsOpen = false; // start with door shut state but it doesn't matter if the REAL door is open or not.
if (digitalRead(2) == LOW && !doorIsOpen) {
doorIsOpen = true;
Start your MP3 playing here
}
What this does is read digital pin 2, realises it is LOW but ONLY if you haven't already processed this state will the MP3
player get asked to play a file.
Now you need to reset this when the door gets shut, so you need something like:
if (digitalRead(2) == HIGH && doorIsOpen) {
doorIsOpen = false;
}
This then resets the boolean when the door is shut so the next time it opens (pin 2 goes low) the MP3 player gets a signal to start. Have a play with this and let me know how you get on, OK?
Thank you very much !!! I will try it and get back to you.
Is it possible to sent you my code some were for you to look at because I can not make it work?
You used a resistor, you could use a logic level shifter on the tx rx correct?
Yes, a logic level shifter would be the ultimate solution, although not strictly necessary, partly because there is no bidirectional communication, it's all serial. But your choice, do what you feel most comfortable with, ifell3!
Ralph S Bacon Thank you very much for your reply. I want to use two players on one Arduino, just to send play track commands after certain actions, similar to your weather project. Two RFID readers playing a MP3 after being triggered from two MP3 players but controlled from one Arduino. UART will have to be in a slave setup, so the players are just receiving?
I'm just thinking through what you're describing here, ifell3.
1. You have two RFID readers.
2. Each reader triggers a separate MP3 player (via the single Arduino).
So why do you need two MP3 players? The Arduino could send the command to play a different track to a single MP3 player. Unless you intend playing two tracks simultaneously?
If it turns out you really want to use two MP3 players you can still do that from the Arduino by using two further pins in Software Serial (you create another object with the two extra pins, SoftwareSerial mp3_2(8,9) for example). I'm not sure I understand the comment about "slave setup"?
Anyway, if you would like to elaborate on why you need two MP3 players I'd be happy to think a bit more about this!
Ralph S Bacon So I'm building a kitchen for my daughter, the saucepan will have RFID tag built in, two cookers, so two MP3 players. She could put on a frying pan and a saucepan and I would like to emulate the sounds.
Great I thought you could only have one serial Rx tx, I knew I could use other pins but didn't think I could have 2 sets of Rx tx so to speak.
I'm kinda guessing this is a _play_ kitchen, not a full sized one! Yes, you would only need one MP3 player, and just request different tracks to be played. But at least you now know about multiple serial ports using SoftwareSerial! Good luck with this, I'm sure your daughter will be pleased. So will you for the first dozen times the sound gets triggered. After that, the power may suddenly be switched off (a bit like giving a child a drum as a present, if you get my drift). :)
I play it without mp3 folder and numbers, just the name of the songs.
You did this? I just followed the data sheet but maybe this just works anyway. I didn't try it but it's something I've added to my to do list to try out. Cool, thanks for sharing.
Hi Ralph. If you use an ESP32, you don't have to change the logic levels with resistors. Pin 17 on the esp to RX on the mp3. Pin 16 to TX. 5v from ESP to VCC on the mp3. Here is your code, modified. pastebin.com/qH4hNGES
Excellent work, User Spice, and that applies to the ESP8266 as well, as they are both 3.3v chips. These days the ESP8266 (and sometimes the ESP32) are as cheap as an Arduino so it makes sense to get the move powerful chip. Thanks for posting, appreciated.
Can you do same deep tutorial for some FM chip?
Including RDS and stuff
Thanks
Interesting idea, jw200. Sometimes an idea like this turns into a video very quickly, other times it can take several months. But I think this is a good idea and a good way to learn about the Arduino too, so stay tuned, I will look into an I2C FM module.
@@RalphBacon Thanks.
Im interested in learning how to take the info from datasheet and make the protocol work on real chip with arduino.
Datasheet describes all these bits and bytes and packets that are needed to make chip come alive, init, boot etc etc. You get the idea.
I would like to learn how to create these packets of data and how to send them to chip. With correct timing and stuff.
Im not complete noob in electronics and coding. But i really want to learn about the data.
Then i can try to work with some other chips, just by looking datasheet and making it work.
Without looking other people code first.
Sry for my English
I find the best (easiest) way is to find someone who has done it before and has written a library (Arduino compatible). Otherwise, it would take ages just to get the protocol right.
@Ralph S Bacon I actually got it working. Reception is not that good as some guys have told. But depends probably on location and antenna, i just had 10 cm wire.
There are better chips..
And its not that hard but i have also one FM chip that uses SPI and that looks much complicated.
I have bought some other FM chips also, just to make tests and learn. One project is planned, will see how it goes.
It will be interesting to compare notes, once my module turns up. It might not be the same one, of course. Wait and see!
Hello, can you please make a video using the ethernet shield.
Hey, Jo, I've already covered using Ethernet shields in some detail. See videos #74 and #75. My next video uses pretty much the same NTP sketch but with an ESP8266-based board...
hey ralph, did yours get warm at all during use ?
I must be honest and say I never had reason to find out whether it was getting warm. But warm is fine, too hot to touch is not. Which is it in your case?
@@RalphBacon it got very hot. Spk1 spk2 lines died . So I used the head phone channels but that didnt last long. Now it's totally dead. And I've ordered another...
You put the resistor voltage divider into the circuit, right? For the RX/TX pins?
@@RalphBacon yes sir
@@RalphBacon I think it may of been faulty...
Adding a tiny library and the command could be entered as "next" and the arduino will translate into "1,0,0" etc ...
Adding this tiny stereo amplififier behind : www.banggood.com/TPA3116D2-Digital-Power-Amplifier-Board-2x50W-Dual-Channel-Stereo-p-1081499.html
Great idea, Jean! Certainly, a library to abstract all the fiddly bits would be a good idea. There's probably one out there but I haven't looked, TBH. Thanks for the suggestion.
Can anyone tell me how to read the state of a track playing with this thing?
It's doing my head in. It should be simple but it's not.
Thanks
The manual says you can query the current track by sending 0x4B as the command and then you will receive a response. For exactly what you get back, see section 3.4.1 for details (and may The Force Be With You on this one).
I do remember that I could not get the _name_ of the track being played, just its 4-digit number.
You can download the manual from here: www.dropbox.com/sh/8bq5waiyhu5zsqc/AACwnzkutZaQBl1CZCeVtjcVa?dl=0
I hope this helps.
@@RalphBacon Thanks but that's like Japanese to me. I'm using a dfplayer library with software serial. I found the command. Thanks
You can read the state of the BUSY pin with readstate().
Low = playing
High = not playing
@@NLGeebee Thanks. I suppose I could put maybe a 10k resistor between the busy pin and an INPUT pin on the Arduino?
I found code within the library I'm using: myDFPlayer.readState() but it's not a good thing to put in a loop since it causes the sound to stutter when called upon. It also seems to return weird numbers like -1 512 and 513 inconsistently.
ArcanePath360 I haven’t used that specific pin yet (newbee) , but the only resistor I have found in the wiki’s is the 1k on RX pin 2.
Do you use a boolean variable to read the state?
Third attempt to post this comment. Still unclear why the previous ones never appeared (from either my Chrome or Watefox browsers. Please advise if this page is still monitored please let me know and I'll reconstruct my enquiry. Great video BTW.
Hi Terry, I've discovered that if you try and include a link of any kind your comment disappears long before I can get to it. That's all I know.
So, "mywebsite dot com slash info question 43" might work but it's a faf!
You can still post links to RUclips videos though!
(CONTINUED) not about to publish one (!) can you perhaps recommend a page please? Video or otherwise. Emails to DfRobot have been unproductive and so was my post to their forum.
I'd assumed, as a non-programmer and relative newcomer to Arduino, that for my own project I would be able to adapt the single example play.ino published by DfRobot But I find it impossible to understand the logic of how its DR1201S library works!
P.S. Trust you're cosily installed in your new shed/workshop!
Terry, East Grinstead, UK@@RalphBacon
Oh dear. Darned if I'll give in yet. SIXTH attempt to reply to your reply. If this fails I'll try a reply to my own earlier post. Then a new post. Maybe it's a character limit - my post was rather long. I'll post in sections.
Last section. What a mess!
I'd assumed, as a non-programmer and relative newcomer to Arduino, that for my own project I would be able to adapt the single example play.ino published by DfRobot But I find it impossible to understand the logic of how its DR1201S library works!
P.S. Trust you're cosily installed in your new shed/workshop!
Terry, send me an email with your complete inquiry! You'll find my email address down the page here:
ruclips.net/user/ralphbaconabout
hi , i haven t got this dfpplayer, i have this : www.amazon.fr/gp/product/B06XHJTGGC/ref=oh_aui_detailpage_o06_s00?ie=UTF8&psc=1 , i dont know how were i can connect the speaker, do you know how ? thanks for your movie
That (French) link is for a simple SD card writer/reader, not an MP3 music player. Wrong link, perhaps?
@@RalphBacon sorry i'm french :/ it is say : UTILIZATION: You can for example use the module to install a control station with external memory card or to make your Arduino an MP3 player. I finaly find how resolve that. I use GND and digital pin but the sound is not good ... Thnks for your anser