Play mp3 music immediately when it turns on

Hi!

I'm new to arduino, but I need to get a project done quickly
The task: as soon as the arduino receives power, it starts playing an mp3 file and keeps repeating this one piece of music.
I don't think it's too complicated, but I don't know where to start.
Can someone help me?
Maybe someone already knows a solution to my problem?

Welcome.

What MP3 player do you have? Do you have a library to interface that MP3 player to your Arduino? What Arduino?

Please take the time to read the forum guidelines. That will help you to get the most from the forum.

1 Like

I don't have the tool yet, I was hoping to get help here, what should be bought for this project, and possibly code help.
Also, what can be done to start the music as soon as it receives power.

The Arduino boards that I am familiar with like the Uno, Nano or equivalent have a 1 second, or so, delay at power up to wait for the bootloader to check for code upload. After that it will start to execute code. It would take a small amount of time to set things up to be ready to load a sound file from and SD card to the MP3 player and begin to play the sound. I cannot exactly quantify how long, but I believe it would be much less than 1 second. So I would estimate that the sound would begin to play within about a second and a half of applying power. That can be shortened by uploading code with a programmer and so not writing a bootloader. That would eliminate the second wait for upload to begin.

The MP3 player that I have used is the DFPlayer Mini. I got mine from Amazon with small speakers included.

The DFRobotDFPlayerMini library is the library that I have used.

Maybe I'm not putting it completely right, it doesn't have to be immediately, a 1-second delay fits, that's no problem, but I can already see that starting the music immediately is a basic thing, if there are no buttons, so this problem seems to be solved.
I don't know how to solve the endless repetition of that one song, but I think it could be a one-line code, but I can't find it.

What do you have? What code?

With the MP3 player and library that I mention, you can loop one song, play a sequence of songs or play one song and stop plus more. What is it that you want to do?

It would be the case that there is only one mp3 file on the sd card that starts, and when it ends, the same song starts again, so I have to play that one music file repeat forever.

You can play the one file, then issue a pause command. The play will stop until the Arduino is restarted or the start command is issued.

Using Arduino sounds like overkill

I don't have to stop it play, play it again, keep repeating.
If there is a better, faster, simpler solution, I would welcome it.

DFPlayer can auto play DFPlayer mini standalone autoplay - YouTube

1 Like

Looks like you just need to connect ADKEY_1 to ground and it will begin playing immediately. As @killzone_kid's link shows, it repeats the track.
68747470733a2f2f63646e2e73686f706966792e636f6d2f732f66696c65732f312f313530392f313633382f66696c65732f4d50335f706c617965725f6d6f64756c655f70696e6f75745f6469616772616d2e706e67

1 Like

Hi.
I'm jumping in here as it sounds like the sort of thing I need too.

I am creating a multimedia art piece for my degree which I want to have sound constantly playing through headphones.
The piece will be in an exhibition for a week so it needs to be a simple case of someone flicking a switch on a usb power supply each morning.

Is Arduino the way to go??

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.