Introduction: 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.
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.
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
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.
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
#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();
}
#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.
Step 5: The Case Strap/ Battery Compartment
So these batteries are going to last for a long time, But not forever. I'll need a way to easy change them. I decided on making a simple latch with the duct tape. Folding it onto its-self provided the strap. Tape the strap down. Make some loops for it to go into and around. BOOM! add some awesome stickers and your done.
As a bonus, these can be used as belt loops. Arduino Fanny Pack anyone?
As a bonus, these can be used as belt loops. Arduino Fanny Pack anyone?
Step 6: Go Get Jiggy Wit It
Go around town and see how many security guards you can freak out and how many people will stare toward your midsection. People are darn curious bout my WavPlaya. Keep it Cool!