1Sheeld Music Player Vs. SparkFun MP3 Player Shield

Today I will make a detailed comparison between our Music Player Shield in 1Sheeld, and SparkFun Mp3 Player Shield.
isheeld-vs-sparkfun-mp3-player

I will cover the getting started points for each one, till you can play and pause music using both of them, and I’ve summarized the points of comparison between both shields in the table below:

P.O.C 

SparkFun Mp3 Player shield 1Sheeld Music Player shield
Length of code   233 lines 124 lines
Code memory size
16KB 7KB
No. of  libraries                  4 1
Max no. of tracks 9 As many as your smartphone can handle
File names      DOS 8.3 format (track001~track009) Any file name
Files must be in root       Yes     No
Call a certain track Yes No
Complexity  

 

Many functions built to make certain operation

obj.isPlaying()
obj.stopTrack()
obj.playTrack()

the object is taken from the library after initializing it.
If you want to make more actions you have to build it’s own function

1 Line of code


MusicPlayer.play()
MusicPlayer.pause()
MusicPlayer.stop()
MusicPlayer.next()
MusicPlayer.previous()
MusicPlayer.seekForwared(byte)
MusicPlayer.seekBackward(byte)
MusicPlayer.setVolume(byte)

Tracks bitrates   Certain bitrate (192 kbps is recommended) Any bitrate
Reserved pins
10 pins
2 pins
Soldered pin headers
No  Yes
SD card required Yes No
Price
$25 $55

 

1- SparkFun MP3 Player Shield

The first one is SparkFun Mp3 Player Shield, it depends on the VS1053B MP3 audio decoder which is an IC to decode audio files.

You can buy the shield from here but it comes without pin headers, so I recommend to get the needed ones from here.

After getting them, now we are ready to start the tutorial.

Mp3 Player shield

Step 1: Adjust the shield

As the shield does not come with the pin headers, I assume to give the ability for makers to put it in PCBs, we have to get male-female pin headers and solder them to the shield using a soldering iron and solder.

Mp3 Player shield soldered

Voila! That’s how it looks after soldering it.

Step 2: Mount the Mp3 Player shield on your Arduino board

In my case I am using an Arduino UNO board.

Mp3 Player shield over Arduino UNO

Step 3: Get an SD card

Get a micro SD card of any size and format it into FAT16 or FAT32. The default state of an SD card is to be formatted to one of them, but I recommend formatting it just in case.

micro-sd-card-lg
format

Step 4: Add mp3 files

Now it’s time to add some mp3 files to the SD card, but you have to consider the following:

1- The added files must be added to the root of the SD card not in any sub folder.

2- Only 9 tracks can be  added and with a dedicated names in the DOS format of 8.3; 8 for the characters and 3 for the extension. So you have to rename your tracks from track001.mp3 to track009.mp3. Although this is an extra step, it allows you to play a certain file with its name.

9-tracks
3- The mp3 files must be compressed into a certain bitrate which describes your audio file resolution.
Check the datasheet (beginning in section 8 on page 26), to make sure your audio files are supported.

You can compress your audio file online here.
compress-audio

Step 5: Install libraries

There are 4 libraries used to operate the Mp3 Player shield: 

1- SPI : This library is already found in your IDE and used for the communication between SDcard and the Arduino.

2- SdFat : This library used to be able to deal with files in Fat format in the SD card.

3- SdFatUtil : This is an extra library added to the SdFat library.

4- SFEMP3Shield : This library  simplifies the task of interfacing with the VS1053 and using the MP3 Player Shield.
lib-git

Download SFEMP3Shield Arduino library, it is written by Bill Porter and it’s an amazing library for that shield and combined with the SdFat library which also included in the Github folder.

SdFat library is the library responsible for dealing with fat files in the SD card.
lib-fold
After downloading the library, unzip the whole folder then you will find two folders having both the libraries, SFEMP3Shield and SdFat. Copy both folders into your Arduino libraries directory then close the Arduino IDE and reopen it again.

Step 6: Write the code

Write the code then upload it to your board, but you have to check the library first if you are not using the Arduino UNO board to check if the library is compatible with your board and if yes, you have to change some parameters in it and you can find all of that in the library documentation here.

If you faced any trouble with the code, you can visit Bill’s webpage which offers a lot of troubleshooting hints.

Code: –

You have to initialize two functions one to initialize the SD card and the other to initialize the Music player
and then call them in your void setup after taking an object from both SdFat and SFEMP3Shield libraries
Then you have to check the order of the pressed switch and for every order play the corresponding track to it after stopping the whole music player and if you pressed the last ordered switch it will stop the music player.

And as you see in the code which is written by Jim Lindblom, we are using 10 pins as 10 Push buttons (0,1,5,10, A0~A4) for playing the nine tracks in the SD card and the push button on A5 to stop the music player.

Since these are the only available pins for programming in the Arduino Uno, as the shield has reserved all the rest of the 10 pins, whether in the communication with the SD card or with the speaker, or even with the Arduino as you see in below picture.

Mp3 player shield pin out

 

Step 7: Setup the hardware

Connect the circuit as shown in the picture below. I’m not using any resistors as I am using the internal pull-up resistance in the code, so the push buttons are connected directly to the ground.

Mp3 player shield schematic fritzing

2- 1Sheeld Music Player Shield

Now, moving on to our super Arduino shield: 1Sheeld, accessing the music player shield.


music-player-shield

For anyone who does not know about 1Sheeld, it is a board that connects your smartphones sensors and peripherals to the Arduino, allowing your smartphone to control Arduino and Arduino to control anything on your phone.

The most important thing in 1Sheeld, is that you can make a lot of amazing things with only 1 line of code!
So, here we are going to control the music player shield in your smartphone and we will show you how you can play music with only 1 command and how to stop it with another one.

You can get your 1Sheeld on Amazon.

You will find two versions of it the 1Sheeld for Android phones and the 1Sheeld+  for iOS and Android phones from 4.3 and above.

Now let’s get started with the 1Sheeld

Step 1: Adjust 1Sheeld

1

Warning! If you have an Arduino that works on 3.3V then you must make your 1Shield
to work on the 3.3V mode since it may damage your board.

Step 2: mount the 1Sheeld over the Arduino UNO board

2
You can check how to mount 1Sheeld to different Arduino board from this tutorial.

Step 3: Install Arduino library

Download the 1Sheeld library from here and after unzipping it, copy the folder to your libraries directory.
git-lib

 

Step 4: Get the mobile app

Download the 1Sheeld mobile app from the website or you can visit Apple play store or Google play store  to get the app.
1sheeld-app

 

Step 5: write and upload your sketch

The code here is using 3 push buttons one to play and the second to play the next track and the third one to stop the music player and to get more experienced with the music player shield you can check the shield documentation here.

code:-

You only need to initialize the communication in the void setup then you can play a track or the next one or stop it
with only 1 line of code for each operation.

 

After writing the code, make sure to set 1Sheeld UART switch to the upload mode before you upload your code on Arduino.
3

After uploading the code, the 1Sheeld is not ready to work until you switch it back to the operating-mode.

Operating mode is turned on when the UART switch is pushed towards 1Sheeld logo.

4

Step 6: Use the 1Sheeld application

Open 1Sheeld application on your Android phone or iOS device.
The application will first scan over bluetooth for your 1Sheeld, it will take a few seconds and the phone will find it.
Once it appears on your screen as 1Sheeld #xxxx, you will be required to enter the pairing code (the default pairing code is 1234) and connect to 1Sheeld via bluetooth.
music-payer-choos

Step 7: Access the shields

Select the shields you would like to use in your Arduino sketch (project) and press on the multiple shields icon at the top right of the app.

In this case, use Music Player shield.

music-player-operate

Step 8: Add music to the application

Add as many mp3 files as you want!

add-music
Step 9: Setup the hardware

As we are using the internal pull-up in the code so we are connecting the push buttons to the ground.

1sheeld-3pushbuttons_bb

 

Check out my other comparisons:




Related Blogs

Log noise level on cloud using Arduino & 1Sheeld

Nowadays people started integrating stuff with the internet for their daily uses, and fortunately, it’s not hard to do so..! as there are a lot of hardware/software tools that ease the development of such applications. One of these tools is the 1Sheeld’s Internet shield, which allows your arduino board to connect to a mobile application …

Display traffic status on an IKEA clock with Arduino and 1Sheeld

Whenever it’s time to get off the office, I always check the traffic status to choose the best time to go home. But I couldn’t find a way to do that autonomously. So then …. I was up to make a system that shows me the current traffic status with the help of a simple tool that is used …

Top 5 Data logger Modules for Arduino

Top 5 Data Logger Modules for Arduino

Want to store your Arduino project’s data, measurement’s or sensor readings for future analysis?  Then you are in the right place, cause today I’m gonna list here the best 5 Arduino Data logger Modules. Data logger gives you the ability to track your system statistically and check how it worked over certain intervals . You can also …

Top 5 Arduino Voice Control Modules

Ever wanted to talk to your Arduino project? Recently I watched this video of a Harry Potter magic wand that you can command to turn on lights and order food! Disclaimer: I’m not a Harry Potter fan, not a fan of Star Trek or Star Wars either! Total Game of Thrones nerd though, check out …

Arduino’s SoftwareSerial vs AltSoftSerial: Which library to use with 1Sheeld+ ?

The newer version of 1Sheeld (1Sheeld+) built to support both iOS and Android devices,but not just that …! There’s another secret feature supported to solve the problem of using extra shield/board over 1Sheeld+, and this shield/board have the same way of communication used by 1Sheeld+ (The hardware UART serial pins pin0&pin1) with your Arduino. Exactly …

GPS shield

1Sheeld GPS Shield Vs. SparkFun GPS Shield

Making a tracking system is something that most of us wanted to have in our projects, and with all that modern technology offering us, it can be made very simply with our beloved board “Arduino” and a GPS shield. Today I will make a detailed comparison between our 1Sheeld GPS shield and the SparkFun GPS …