I want to use SparkFun MP3 Player Shield (DEV-12660) with VS1053B on Arduino Uno R3 connected to other Arduino R3 or Mega 2560 or with Raspberry through SPI and Modbus to make system.
The problem is that other Audio boards I have tried to use till now, make Arduino main loop stop when playing from sd card or through SPI strem. How this module works? Is it possible to send audio data while whole loop works and can I only send information to play choosen file from sd card or play file when it comes completely through SPI? Code running on Arduino is quite big and can’t be additionally delayed and definitely errors in Audio module can’t stop whole system.
No, I want to use only one audio board with one arduino and play only one file. I want to connect other arduinos to expand funcionality, to have more I/O ports and much more. For now it doesn’t matter, I have on mind that this one audio board connected to one arduino can’t hang all Arduino code or SPI/I2C line - which all the time send informations to other Arudinos. This is why I ask about loop - in very big code in arduino I will make some “if” terms which will play choosen files. The main thing is to don’t stop the rest of arduino code for next minutes but still playing this choosen audio file. Audio file will be stopped after defined time with another “if” term. I have tried other audio board and it’s not fit for me because it stops arduino and SPI/I2C during audio playing. How it looks in your audio module?
Arduino boards can only do one thing at a time, you can’t have code playing a mp3 and doing something else simultaneously.
You could use a second arduino to do another task while the first is playing audio though. OR you could use a audio only board like a [wav trigger to handle audio while your arduino runs other code.](https://www.sparkfun.com/products/13660)
Actually, it is possible to make Arduino do many things the same time - maybe not the same time, but many thing during one loop. I it possible because Arduino GPIOs can handle state, for example to work with relay. If we confirm every main loop that relay under port number X is in 1 state, relay independly is in 1 state until we define state for 0. We dont have to make any additional while, for, while and other inside main loop which blocking whole code (main loop), loops go ahead and can run other functions. Audio module I ask can work similary like multi port relay but controlled through SPI or I2C? Can it works in such way, that every loop we just send short state info to module that now should be played song number X like relay without blocking code? So every main loop audio module receive number of played file with defined volume in defined interval by external function in Arudino?
Yes, the DEV-12660 allows you to play non-blocking, a track from the SD card, while the Mega or Uno are doing other things asynchronously in the loop(). This is the normal method for the library SFEMP3Shield, which you can find in the Arduino IDE. However, if your Arduino wants to do heavy IO with the SD card, that can interfere with the stream to the VS1053, and cause the audio to drop. This said, I don’t have a problem reading or writing 1 KB size blocks to SD when music is playing. For larger SDIO, I pause the play, and then resume it.
I have been successfully running Sparkfun MP3 Player Shields on various Arduino and clone UNO R3 boards using the ‘SFEMP3Shield’ include files. You can easily run other code while the MP3 player is playing from SD card by creating a loop: if (MP3player.isPlaying()) {… My problem is I have recently purchased an Arduino UNO R4 minima board, and my sketch won’t successfully compile throwing up may issues within the ‘SFEMP3Shield’ shields. I have looked at the Github website, but the shields have not been modified for 7 years. Is there a solution to my problem?