Orange mePod

Firstly, why would I make a music player when one can be purchased for so little and Apple iPods are so great?  Well, I’ll tell you.  After several cheap MP3 clones have died due to their Lipo batteries and my cracked, inoperable screen on my current iPod touch; I’ve had it with locked down devices that I can’t fix and or change.  Also Adafruit’s Wave Shield is by far my favorite Arduino shield and I just can’t get enough of finding fun ways of using it.
Orange mePod
This is real simple build with few parts and totally ripped code.  But it’ll be something I end up using everyday.   Be a sweetheart and vote for me in the Pocket-sized contest.  It’s at the top of the screen.  One Button click, that’s all I ask.

Step 1: How Many mp3 players have you owned?

In my short lifetime I’ve purchased have a dozen MP3 players, bout the same amount of CD players and almost got suckered into a Minidisc player(Phew, glad I missed that one).  These are my most recent broken Locked-Down music players.   This consumer is done, I’ll take a bulky Arduino player over some 8thgen iPod Pico anyday now.

Step 2: Gather the Parts

Major Components in Project

The Parts:

Adafruit Wave Shield   $22
Arduino Uno                 $25
4AA battery holder       $3
Orange Duct Tape       $5
Re-purposed Card stock  $FREE
4AA Batteries              $2
This is cheaper than some junky MP3 players.

Step 3: The Code

The code

#include <AF_Wave.h>
#include <avr/pgmspace.h>
#include "util.h"
#include "wave.h"

AF_Wave card;
File f;
Wavefile wave;      // only one!

#define redled 9

uint16_t samplerate;

void setup() {
Serial.begin(9600);           // set up Serial library at 9600 bps
Serial.println("Wave test!");

pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(redled, OUTPUT);

if (!card.init_card()) {
putstring_nl("Card init. failed!"); return;
}
if (!card.open_partition()) {
putstring_nl("No partition!"); return;
}
if (!card.open_filesys()) {
putstring_nl("Couldn't open filesys"); return;
}

if (!card.open_rootdir()) {
putstring_nl("Couldn't open dir"); return;
}

putstring_nl("Files found:");
ls();
}

void ls() {
char name[13];
int ret;

card.reset_dir();
putstring_nl("Files found:");
while (1) {
ret = card.get_next_name_in_dir(name);
if (!ret) {
card.reset_dir();
return;
}
Serial.println(name);
}
}

uint8_t tracknum = 0;

void loop() {
uint8_t i, r;
char c, name[15];

card.reset_dir();
// scroll through the files in the directory
for (i=0; i<tracknum+1; i++) {
r = card.get_next_name_in_dir(name);
if (!r) {
// ran out of tracks! start over
tracknum = 0;
return;
}
}
putstring("\n\rPlaying "); Serial.print(name);
// reset the directory so we can find the file
card.reset_dir();
playcomplete(name);
tracknum++;
}

void playcomplete(char *name) {
uint16_t potval;
uint32_t newsamplerate;

playfile(name);
samplerate = wave.dwSamplesPerSec;
while (wave.isplaying) {
// you can do stuff here!
delay(500);
}
card.close_file(f);
}

void playfile(char *name) {
f = card.open_file(name);
if (!f) {
putstring_nl(" Couldn't open file"); return;
}
if (!wave.create(f)) {
putstring_nl(" Not a valid WAV"); return;
}
// ok time to play!
wave.play();
}

Step 4: Making the Case

Pretty simple.  Mark out component holes is some card stock.  Cut it out.  Tape over it,  Cut through the tape now covering the holes for the components.  Embelish with extras and Stickers!  Viola a case is made.

 

For more detail: Orange mePod

 

 


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top