Best Way to Play Audio on Arduino! DFPlayer mini / MP3-TF-16p Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ม.ค. 2025

ความคิดเห็น • 103

  • @sortedmess2581
    @sortedmess2581 6 หลายเดือนก่อน +3

    You have made the best video regarding this topic. It helped me a lot. Thanks ❤️.

  • @TheBustyOnion
    @TheBustyOnion 10 หลายเดือนก่อน +2

    Great video plus code is super helpful, appreciate!

  • @AvrahamSosa
    @AvrahamSosa 10 หลายเดือนก่อน +8

    Hi, What capacitor do you add to the circuit? Do you have the electric diagram file? Thank you!

    • @d.g.m.04
      @d.g.m.04 6 หลายเดือนก่อน +1

      The capacitor is probably something like 100uF to 1000uF and it's there to smoothen the voltage if it varies on sudden changes

  • @robgreen7702
    @robgreen7702 7 วันที่ผ่านมา

    Nice tutorial. The reason the Arduino couldn't supply enough current to the DFPlayer was that you connected it to the Arduino's 5v output which is supplied by the Arduino's onboard power regulator. The regulator's output is limited so it's not surprising that it struggled. If you had instead connected the DFPlayer to the Arduino's Vin output it would have been fed directly by the USB connector and been fine.
    Of course you must remember that the Vin output is connected directly to whatever power supply the Arduino is using so this should only be done if the Arduino is using USB power or an external 5v power supply. Anything higher will damage the DFPlayer.

  • @RobbertDIYprojects
    @RobbertDIYprojects 11 หลายเดือนก่อน +1

    awesome this video helped me out in a recent project :D

    • @JustBaselmansYT
      @JustBaselmansYT  11 หลายเดือนก่อน

      That's so nice to hear! Good luck with your project ;)

  • @bsyl4392
    @bsyl4392 6 วันที่ผ่านมา

    Bonjour, super tuto, par contre j'ai une question pour le bouton, je n'arrive pas à trouvé le moyen de selection une autre musique en réapuyant sur le bouton. Comment puis-je faire ?

  • @ZF0317
    @ZF0317 10 หลายเดือนก่อน +2

    Anyone have the error where arduino is stuck building a sketch and unreadable symbols are printed in the serial monitor?
    Figured out it was the Baud rate. Also, the TX and RX are reversed in the code. Where it says the value for RX is actually TX and TX is really RX.

    • @plantor0728
      @plantor0728 9 หลายเดือนก่อน

      ya I have that same error how do I fix it

    • @ZF0317
      @ZF0317 9 หลายเดือนก่อน

      @plantor0728 make sure the number in Serial.begin() matches your serial monitor. Default in serial.begin is 115200. While your arduino is plugged in, go to serial monitor and look to the right side of the screen. You'll see a drop down that says some number, probably 9600, and baud. Adjust that to match 115200.

    • @plantor0728
      @plantor0728 9 หลายเดือนก่อน

      @@ZF0317 thanks man, it’s not spitting out mystery symbols now

    • @ZF0317
      @ZF0317 9 หลายเดือนก่อน

      No problem @plantor0728! Let me know if other questions come up.

  • @masterofchallenge6438
    @masterofchallenge6438 4 หลายเดือนก่อน

    amazing video!
    so helpful

  • @peppernickelly
    @peppernickelly 5 หลายเดือนก่อน

    Surprised no one said anything about the Trailer Park Boys Intro song. Thanks for the low down Mr Basildude!

  • @andrewbrucesc3013
    @andrewbrucesc3013 หลายเดือนก่อน

    Great video. Many thanks. Two applications which would help me. Playing the sound file on a continuous loop and also an external on and off button

  • @animeforever694
    @animeforever694 9 หลายเดือนก่อน +3

    what capacitor did you use for the circuit?

    • @livetohash6152
      @livetohash6152 8 หลายเดือนก่อน +2

      Exactly! And why? 🤔🤔

    • @dukdog
      @dukdog 8 หลายเดือนก่อน

      @@livetohash6152 th-cam.com/video/u40kX1DYKdA/w-d-xo.html

  • @johnmendeleevb1740
    @johnmendeleevb1740 11 หลายเดือนก่อน

    ive seen the other video and this is module is good

  • @cristi6257
    @cristi6257 6 หลายเดือนก่อน +1

    what speaker do you use?

  • @tubenutt
    @tubenutt 4 หลายเดือนก่อน

    Thank you for the tutorial and thank you for talking. I hate when people make tutorials and will not talk to ecplain what and why they are doing something.

    • @sapitron
      @sapitron 4 หลายเดือนก่อน

      Sometimes they do talk but I can't understand anything. Thank God for subtitles

  • @1q2w3e4rtyuiop
    @1q2w3e4rtyuiop 8 หลายเดือนก่อน +1

    Absolute legende ben je!

  • @rhandynastor4866
    @rhandynastor4866 หลายเดือนก่อน

    thanks it works....how about using 2 speakers?

  • @whoopzKERRY
    @whoopzKERRY 8 หลายเดือนก่อน +1

    I already installed that apps, but it says, "Cannot format write protected card". How to solve this problem?

    • @lamboking8able
      @lamboking8able 7 หลายเดือนก่อน

      Format it in the sd card settings from windows by right clicking the card in your files.

  • @totalrandomtechnolog
    @totalrandomtechnolog 6 หลายเดือนก่อน

    For some reason your code works better than the one from DFrobot which fails to play a song halfway or don't work at all depending on the version..Thank you

  • @kerrtoribio3615
    @kerrtoribio3615 2 หลายเดือนก่อน

    Is it possible to play a track that doesn't interrupt the first track like they will blend

  • @JohnSmith-eq8tt
    @JohnSmith-eq8tt หลายเดือนก่อน

    when I upload the sketch my serial monitor just outputs “DFRob” continuously. any thoughts on what my issue is?

  • @dishankshah1189
    @dishankshah1189 5 หลายเดือนก่อน

    Can you share a product link of the power supply module that you are using to power the DF Player?

    • @JustBaselmansYT
      @JustBaselmansYT  5 หลายเดือนก่อน

      I use a old regular pc powesupply any model will do they al have multiple 5V pins, in addition I use a board from AliExpress that makes it easier to interface with, I am likely going to make a video about this in the future.

  • @herschelvijae7201
    @herschelvijae7201 4 หลายเดือนก่อน

    THANK YOU

  • @DatFunnyPerson
    @DatFunnyPerson 6 หลายเดือนก่อน

    i need a "plays as long as button is held" code. any idea?

    • @lamboking8able
      @lamboking8able 6 หลายเดือนก่อน +1

      @DatFunnyPerson control with uart and create a while function for the button being held and "else if" maybe. And have it play the sound and read if the player is playing or not. From there I would either pause or stop when released on the "else" function

    • @DatFunnyPerson
      @DatFunnyPerson 6 หลายเดือนก่อน

      @@lamboking8able that's cool but it's like I'm reading Chinese. I'm a real noob and can't code at all haha. I was hoping someone had a code ready or something

    • @lamboking8able
      @lamboking8able 6 หลายเดือนก่อน

      @DatFunnyPerson 😂😂 believe it or not I'm a noob as well. But I'm starting to understand it little by little. More so reading code rather than write ot. I recommend (if you think it will help) using copilot or chatgpt. Ask it a thousand questions. It'll help you understand it. But the dfplayer has a "playing" pin. I would say use a (read) function on that pin to any pin on the esp32. And say something like
      if(playButton == high)
      {If(dfActive == high){
      Play(sound1);
      }
      }
      Now again. I'm a noob. I haven't tested this. I'm sure there's a few syntax errors but this is something you might can install into the sample code. I would also recommend asking chatgpt and or copilot to explain it to you. The sample code. It has helped me be able to read it a little better until I can do it on my own.

  • @phillipdarrenmperez9364
    @phillipdarrenmperez9364 5 หลายเดือนก่อน

    Can you make a video about using arduino as alarm that uses a speaker with customizable audio and time

  • @Трудоголикнаселе
    @Трудоголикнаселе 4 หลายเดือนก่อน

    Добрый день, наконец увидел что-то нужное. Вопрос про мини МП3 плеер, как сделать так чтобы при нажатие один раз на кнопку «НАПРИМЕР ВПЕРЁД» воспроизвёлся только первый файл, при нажатии на эту же кнопку один раз воспроизвёлся второй файл и так далее, до ста. Естественно при нажатие один раз на зад кнопку трек проигрался предыдущий. Я хочу сделать говорящий счётчик, например при каждом одиночным нажатием в перёд плеер воспроизводил файл 1, и так по очереди при каждом новом одиночным нажатие в перёд 2 файл, и также в обратном порядке при нажатие кнопки назад. Что для этого нужно, у меня только мини мп3 плеер

  • @rkjayakrishnan3997
    @rkjayakrishnan3997 11 หลายเดือนก่อน

    I need to play the RAW sound by the Arduino mic and play with it's speaker?

  • @marinien18
    @marinien18 หลายเดือนก่อน

    Hey ive got a question my mp3 tf 16 module works so does my nano but i am trying to get code for my rc truck sound module for my truck project but it doesnt doe what i want i am using chatgpt for code i just want to use my esc steering servo and light functions together with de sound but things dont seem possible

  • @NvdGoorbergh
    @NvdGoorbergh 4 หลายเดือนก่อน

    Hey Just, I found your video while investigating a way to add audio to my 3d printed ghostbusters proton pack :D. All the arduino solutions have one thing in common and that is that they can't play two or three songs at the same time. I am investigating if that is possible without busting the bank and buying a wav trigger for example. I saw people saying to use 3 or 4 different dfplayers but I can't find examples if that would work. How would you solve this issue? In your video you could play the song and when pressing a button play f2s1 for example :D. Do you have any ideas?

  • @UndoGG
    @UndoGG 20 วันที่ผ่านมา

    Is 1 kOm resistor neccessary?

    • @JustBaselmansYT
      @JustBaselmansYT  20 วันที่ผ่านมา

      Depends a bit on if you are using the official board or a cheaper copy, either way, try it out and let me know what works better for you. good luck! ;)

    • @UndoGG
      @UndoGG 20 วันที่ผ่านมา

      @JustBaselmansYT For WeMos d1 mini it worked without it

  • @6rilBemane
    @6rilBemane 5 หลายเดือนก่อน

    Hi,
    Can you help me with my project with my DFplayer?

  • @0nkar
    @0nkar 11 หลายเดือนก่อน +1

    Hey i want to make a pokemon ball vibrate and make the pokemon captured sound. Which power speaker shoild i buy? Which microcontroller as it needs to be small and which type and how many batteries would i need?

    • @JustBaselmansYT
      @JustBaselmansYT  11 หลายเดือนก่อน

      I happen to be working on a few videos about a 3D-printed realistic PokeBall. I will also be working on electronics for sound and the signature shake so more on this topic soon😄

    • @0nkar
      @0nkar 11 หลายเดือนก่อน

      @JustBaselmansYT so you're my competition 😏 I actually have all the components and I tried your code for the pokemon ball but the code you gave didn't work for the dfplayer to play the pokemone sound

    • @dumbledorrito
      @dumbledorrito 7 หลายเดือนก่อน +1

      depends on how loud (dB) you want it, then you'll be able to sort your requirements of the speaker (passive or active) and the rattling, you could probably do a quick fbd, and design a weight attached to an arm on a non-continuous positional servo to keep the COM low, but able to shift it to mimic the rattling just make sure you check the torque specs to stop slipping. That way you can control the rattling better and sync it with the audio. When selecting your power supply, just make sure you meet the voltage requirements for your components and set an arbitrary time you want this device to last. (Longer, the more bulky the battery generally). Optionally for the motor, you could do a motor attached a wheel with a lob-sided weight and derive a sine function for the movement to control its speed and etc. :)

  • @cadillacescalade5428
    @cadillacescalade5428 9 หลายเดือนก่อน +1

    Hi, I am wanting to use DF mini player with a sketch I have already how would I incorporate the DF-Mini into my sketch ?
    Also I have a IR sensor as well that activates my sketch I'm wanting sound and for it to stop playing when ir sensor is uncovered.

    • @JustBaselmansYT
      @JustBaselmansYT  9 หลายเดือนก่อน +1

      circuitdigest.com/microcontroller-projects/interfacing-ir-sensor-module-with-arduino
      You can use this code but instead of turning an LED on and off you can use mp3_stop() and mp3_play()

    • @cadillacescalade5428
      @cadillacescalade5428 9 หลายเดือนก่อน

      @JustBaselmansYT ok Kool thank You

    • @lamboking8able
      @lamboking8able 6 หลายเดือนก่อน +1

      @cadillacescalade5428 if it didn't work, I'm also using ir sensors, and I used uart1 which I had to move to a new location on the board

  • @vijakarina
    @vijakarina 11 หลายเดือนก่อน +1

    Hi! I set my arduino up exactly the same way you did (with the exception of using an Arduino R4 WiFi) and the readout in my serial output is the following over and over:
    Not initialized:
    1. Check the DFPlayer Mini connections
    2. Insert an SD card
    I tried swapping out my R4 for my R3 and I got the same result. I've also isolated all of my components and have tried three different DFPlayer Minis. I'm using a 3-watt, 8-ohm speaker, and I'm using a Mac. Any ideas? I'm at a complete loss at this point.

    • @JustBaselmansYT
      @JustBaselmansYT  11 หลายเดือนก่อน

      Hi Vijakarina can you try uploading the "GetStarted" sketch that comes with the DFRobotDFPlayerMini library? Please let me know if it does work with that sketch, good luck!

    • @vijakarina
      @vijakarina 11 หลายเดือนก่อน +1

      @@JustBaselmansYT This is what I'm getting when I run their GetStarted sketch:
      DFRobot DFPlayer Mini Demo
      Initializing DFPlayer ... (May take 3~5 seconds)
      Unable to begin:
      1.Please recheck the connection!
      2.Please insert the SD card!

    • @JustBaselmansYT
      @JustBaselmansYT  11 หลายเดือนก่อน

      ​@@vijakarina and you are using an external 5V power supply? Because if this is the case and you did check all your connections and check if there are indeed songs on the SD card (which is smaller or equal to 32GB) than in my experience pushing the reset button a few times should be enough to get it working.

    • @vijakarina
      @vijakarina 11 หลายเดือนก่อน

      @@JustBaselmansYT yeah, unfortunately I've done all of that. I've also gone through and removed the hidden files from the SD card that the macOS loads onto it. I've tried different 32GB microSD cards, I've reformatted them all to FAT32. And I've pressed the reset button a bunch of times, all with the same result. Thanks for your quick responses!

    • @JustBaselmansYT
      @JustBaselmansYT  11 หลายเดือนก่อน

      @vijakarina I am sorry that it does not work for you :/ but I also do not know what to try expect for a different tutorial with s different circuit and different library

  • @markvv596
    @markvv596 11 หลายเดือนก่อน

    Is there any way to output the signal to a 3.5mm jack? so you can control a external speaker?

    • @JustBaselmansYT
      @JustBaselmansYT  11 หลายเดือนก่อน +3

      The DAC_R and DAC_L on the DFPlayer can be used for this purpose!

  • @ggbaby5845
    @ggbaby5845 7 หลายเดือนก่อน

    what tipe of speaker is that? in need it for a project and i can't find something similar anywhere 😢

    • @JustBaselmansYT
      @JustBaselmansYT  7 หลายเดือนก่อน

      If you look for 4ohm 3watt speaker on Aliexpress you should be able to find them. Good luck!

  • @feenixb1o7
    @feenixb1o7 3 หลายเดือนก่อน

    I don't know if this account is still active, if so. Is this device capable of playing one audio track on start-up, and then a different audio track when a button is held down and then back to the first audio track when the button is released? Thank you for your time.

    • @JustBaselmansYT
      @JustBaselmansYT  3 หลายเดือนก่อน

      Yes definitely possible! You can probably ask ChatGPT to help you write the code for it ;) Good luck with your project!!!

  • @wallie61-
    @wallie61- 11 หลายเดือนก่อน

    Great video! I’m trying to do led effects and sounds effects working together. I’ve got it working. But the df player is so slow. I press the button and my led strip fades color instantly and is almost done before the df player plays my file… is this normal behavior for the player?

    • @lamboking8able
      @lamboking8able 6 หลายเดือนก่อน

      @wallie61- not in my experience but I'm using a dfplayer pro

  • @BINBONIUM
    @BINBONIUM 10 หลายเดือนก่อน

    this may sound dumb buuut what is that green thing.

    • @totallyistimmy
      @totallyistimmy 9 หลายเดือนก่อน +1

      capacitor, it’s not necessary it’s just there to maintain a smooth signal

    • @BINBONIUM
      @BINBONIUM 9 หลายเดือนก่อน

      @@totallyistimmy thanks!

  • @lamboking8able
    @lamboking8able 7 หลายเดือนก่อน

    what would you say is the latency between pressing the button and the sound starting. Currently I'm using an esp32 with an I2S and my latency is between 0.2 to 0.3 seconds with human error between that. I need it to be less than 0.15 seconds as I'm synching a gunshot sound with a trigger pull.

    • @DalaFilmprod
      @DalaFilmprod 6 หลายเดือนก่อน

      Did you ever get an answer for this, here or anywhere else. I'm wondering the same thing, also have a time critical projekt.

    • @lamboking8able
      @lamboking8able 6 หลายเดือนก่อน

      @DalaFilmprod YES! I find online about a 0.03 communication time from esp32 to dfplayer. I switched to the dfplayer pro, but I would say in experience that's about as fast as it starts. Near instant so definitely go for it.

    • @lamboking8able
      @lamboking8able 6 หลายเดือนก่อน

      Fyi I'm using uart1 (which I moved around to use) to communicate with it.

    • @DalaFilmprod
      @DalaFilmprod 5 หลายเดือนก่อน

      I've finally got time to test mine. My normal supplier where out of stock so I hade to purchade from Amazon so maybe the quality is not the same and may explain my problems. I have about a second latency from initiating command to playback start. Regardless if I use serial or just the IO. I've not tested different formats and bitrates yet, but that is way to long for me.

  • @underyoshi
    @underyoshi 6 หลายเดือนก่อน

    Does anyone know if the capacitor on the 5V and ground necessary?

    • @JustBaselmansYT
      @JustBaselmansYT  6 หลายเดือนก่อน +1

      Absolutely necessary? Definitely not. Can it help if the audio quality sucks? Yes. Also it depends a bit on what kind of 5V source you are using. I would suggest just try it out. Good luck!

  • @monkeytree1648
    @monkeytree1648 7 หลายเดือนก่อน

    I 'am new to coding sooo can someone help me make buttons for all the serial monitor command's pleases

  • @yakacm
    @yakacm 9 หลายเดือนก่อน +6

    You realise you can format the thing from Windows? Like you don't need an app. TBH I'm not even too sure why those formatting apps even exist?

    • @jtrockhound6016
      @jtrockhound6016 7 หลายเดือนก่อน

      if your sd card is more than 32 gigabytes (yeah i know that’s overkill for most projects) an application is needed to format 64gig and beyond to fat32

  • @DatFunnyPerson
    @DatFunnyPerson 10 หลายเดือนก่อน

    i need a shuffle song code

    • @JustBaselmansYT
      @JustBaselmansYT  10 หลายเดือนก่อน +1

      www.reddit.com/r/arduino/comments/5uweoz/how_can_i_generate_random_numbers_without/

    • @DatFunnyPerson
      @DatFunnyPerson 10 หลายเดือนก่อน

      that doesnt help me because i cant code anything. im a noob. all i can do is copy and paste@@JustBaselmansYT

  • @psatire512
    @psatire512 10 หลายเดือนก่อน +1

    What happens if i dont use a resistor?

    • @lamboking8able
      @lamboking8able 7 หลายเดือนก่อน

      I think you will fry the board because it's based off of 3.3v rather than 5. If using esp32 you don't need it I HEARD. Please look more into it.

  • @jaykay6290
    @jaykay6290 11 หลายเดือนก่อน +1

    it is a pity that you skipped over the last part of button installation so quickly. i had to playback several times to try and see what you were typing to add the button command. code now gives error 'pinmode' was not declared in this scope.

    • @JustBaselmansYT
      @JustBaselmansYT  11 หลายเดือนก่อน

      Put the following 4 lines of code at the top of you void loop, good luck!:
      if (digitalRead(2) == LOW) {
      Serial.println("now playing track 1");
      myDFPlayer.play(1);
      }

    • @jaykay6290
      @jaykay6290 10 หลายเดือนก่อน

      Okay thank you, your video & instruction is very helpful. I was struggling a lot to get buttons to play tracks. I am making a customer queue manager with 6 pay points, each with a button to press and play sound 'next customer to till 1,2,3..." etc. I have added this to your code and the 6 buttons ( d2 - d7 on arduino uno) are all executing perfectly. void loop() {
      //instruction for button on Digital input 2
      if (digitalRead(2) == LOW) { //reading of digital 2
      Serial.println("now playing track 1"); // serial monitor line display
      myDFPlayer.play(1); // track number/name to play
      delay(1000); //debounce delay
      }
      if (digitalRead(3) == LOW) {
      Serial.println("now playing track 2");
      myDFPlayer.play(2);
      delay(1000);
      }
      if (digitalRead(4) == LOW) {
      Serial.println("now playing track 3");
      myDFPlayer.play(3);
      delay(1000);
      }
      if (digitalRead(5) == LOW) {
      Serial.println("now playing track 4");
      myDFPlayer.play(4);
      delay(1000);
      }
      if (digitalRead(6) == LOW) {
      Serial.println("now playing track 5");
      myDFPlayer.play(5);
      delay(1000);
      }
      if (digitalRead(7) == LOW) {
      Serial.println("now playing track 6");
      myDFPlayer.play(6);
      delay(1000);
      } I would however like to tweak the code more to have the button presses form a digital queue so that if for example: Till 1 presses button 1 and track 1 plays. If then button 2 is pressed while track 1 is still playing it must not interrupt or stop track 1 from playing. Track 2 must queue and play as soon as track 1 is finished and so on. Do you have any advice please? Thank you

    • @zk_6312
      @zk_6312 8 หลายเดือนก่อน

      Pinmode error usually means you did not declare the pin as input or output in the setup section.