Introduction: Arduino + Pringle-Speaker = Simple MP3 Player

As I said in the video, welcome to this DIY MP3 player.

Needed for this project:

If you want to do what I did with the power:

Tools:

  • Soldering iron
  • Soldering tin
  • Stripping pliers
  • Pliers

Step 1: (re)Soldering

Picture of (re)Soldering

For the soldering part of this project there isn't much to do.

All you need to do for the pringle-speaker is soldering of the GND and VVC of the battery pack and potentially solder on some jumper cables.

This is if you are using a pringle-speaker.

For the battery connector you don't need to do anything but i made a switch for easy power on and off.

This is if you want this too.

Step 2: Plugging Everything In

Picture of Plugging Everything In

Speaker --> Arduino

  • VVC --> 5v
  • GND --> GND

Battery --> Arduino

  • "+" --> VIN
  • "-" --> GND

(this works too instead of the plug)

And as NOT shown in the picture, plug the SD card into its slot and plug the shield into the arduino.

Step 3: SD Card Files

Picture of SD Card Files

As you can see in the picture I numbered all the files in the folder "SD kaart" (it's dutch. it translates to SD card).

This is because the arduino reads the first file it reads as the first file that will be played. (did the make sense?)

Just to stop your confusion:

I started with the number 002 and then jumped to 005 this is just because I had some more sounds but I deleted those.

I organized all the sounds:

  • 002-002 = boot sound: this sound will play only once.
  • 005-013 = happy sounds
  • 014-022 = angry/annoyed
  • 023-036 = BB8 just talking a little bit.

If you do it like I did you will be able to adjust the program so that when you give the arduino a signal It will play a random sound in these categories which can be useful (in my case it is).

Step 4: Programming

I am not responsible for the program

This guy is: awesome guy I got the code from

He wrote the program for the most part.

But because his links weren't working I thought I'd make this instructables anyways.

And because of my BB-8 project of course.

Because I'm lazy I downloaded his program and tested it and it was 100% perfect (props to him).

The only thing I did is I added an int named boot and in the void loop I put an If statement making sure the code in it only runs once by changing the int. (might not be the best solution but it works)

Also I set the default volume to 17 see "SetVolume(17);" this is perfect for my BB8. This can be adjusted and the overall volume can be influenced by the speaker you are using.

So this is the code with my tiny code added:

!!! NOTE DO NOT UPLOAD THE PROGRAM WHILST THE SHIELD IS ON THE ARDUINO

IT MAY GET DAMAGED.

//simple Tx on pin D12
//Written By : Mohannad Rawashdeh

//Slightly Edited By : Maarten Bökkerink // 3:00pm , 13/6/2013 //http://www.genotronex.com/ //.................................. #include #include

SoftwareSerial Geno(7,8); // Rx ,

unsigned char Data[10]; unsigned char i; int boot = 1;

void setup(){ vw_set_ptt_inverted(true); // Required for DR3100 vw_set_rx_pin(12); vw_setup(4000); // Bits per sec pinMode(13, OUTPUT);

vw_rx_start(); // Start the receiver PLL running

delay(1000); Geno.begin(9600); delay(1000); SetVolume(17); }

void playTrack(int num){

delay(1000); Data[0] = 0x7E; Data[1] = 0x04; Data[2] = 0xA0; Data[3] = 0x00; Data[4] = 0x00 + num; Data[5] = 0x7E; Command(Data,5);

play_pause(); delay(3000); }

void SetVolume( int vol){ Data[0] = 0x7E; // START Data[1] = 0x03; // Length Not 0x02 Data[2] = 0xA7; // Command Data[3] = vol; // new volume Data[4] = 0x7E; // END Command(Data,5); }

void play_pause(){ Data[0] = 0x7E; // START Data[1] = 0x02; // Length Data[2] = 0xA3; // Command Data[3] = 0x7E; //Mode parameter Command(Data,4); }

void Command(unsigned char *Data, int length){ for(int i=0; i

if(boot==1){ delay (2000); playTrack(1); boot = 2; }else{ }

uint8_t buf[VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // Non-blocking { if(buf[0]=='1'){ playTrack(1); digitalWrite(13,1); } if(buf[0]=='0'){ digitalWrite(13,0); delay (2000); }

} }

The original is in the link make sure to check it out!!!

Step 5: Testing It.

Congratulations!

You did it!

You made your very own MP3 player!

If you turn it on it will play the first file you uploaded it automatically.

If you hit play after the sound is done it will play the same sound again.

If you hit previous it wil jump to the last sound on the SD card and next is next.

If you want to change the volume go ahead and press the buttons or change the default in the program

Hitting play in the middle of a sound will make it pause.

And that's it.

If you have any questions ask me and I'll help.

Thanks for reading this Instructable and even more thanks if you learned anything here.

Regards Maarten.

Comments

terenceNgoy (author)2016-09-29

ce bien et interessant

About This Instructable

1,106views

14favorites

License:

More by Maarten2900:Arduino + Pringle-Speaker = Simple MP3 PlayerMake you own own (Harry Potter) wand.
Add instructable to: