Total Pageviews

Tuesday, December 21, 2010

Project 3 an epilogue...

There is not much to say about project three. It was just a continuation of project 2. I and my fellow EE attempted many times to construct an amplification circuit, it however never worked. We, in the end, resorted to buying a prefabricated amplifier and patching it into our project. To finalize what we had for our second revision, I salvaged a piece of wood from our first bird house and used it as a substrate to witch to mount all of the electrical components including: the arduino; the amplifier; and 2 battery packs , one for the arduino and one for the amplifier. The artists then took over and housed this in a new more organic looking casing.

The new product was received well by the class, however, problems still persist. The sound still isn't quite right and the interaction detection is as yet unrefined. We, as a group, plan to work on refining the unit further, increasing its functionality and aesthetic attraction for use as a public art piece in schools and parks.

Monday, November 22, 2010

11/15

We presented our project today and we recieved an overwhelmingly warm and supportive amount of feed back. Our project was a great success and our group is considering continuing forward with the idea to make it a public art piece.

 As we do this we will be taking all of the feed back of comments criticism and expanding ideas to make our project better.

Friday, November 12, 2010

Success - My Arduino can Sing

This past Thursday Pat Cody assembled the wave shield, he soldered and assembled diligently, I made him tea.

Today, I uploaded the stock wave file player given to us by Lady Ada and Mr. Fat16. Without their amazing work this project probably could have accounted for atleast one Engineers Senior design project regarding the level of information technology and implementation. To them I am great full for making this  project as simple as formating a wave file then copying it to a memory card followed by a simple code cut and paste which will under go slight augmentation to be triggered by a ping sensor, motion sensor, or momentary switch.

The first angelic and harmonious sounds heard from this gifted Arduino you might ask?
-No Quarter by Led Zeppelin which can be heard here .

 ************************************************
\ \                                                                                             / /
/ /  http://www.ladyada.net/make/waveshield/libraryhc.html        \ \
\ \                                                                                             / /
 ************************************************

/*
* This example plays every .WAV file it finds on the SD card in a loop
*/
#include "WaveHC.h"
#include "WaveUtil.h"

SdReader card; // This object holds the information for the card
FatVolume vol; // This holds the information for the partition on the card
FatReader root; // This holds the information for the volumes root directory
WaveHC wave; // This is the only wave (audio) object, since we will only play one at a time

uint8_t dirLevel; // indent level for file/dir names (for prettyprinting)
dir_t dirBuf; // buffer for directory reads


/*
* Define macro to put error messages in flash memory
*/
#define error(msg) error_P(PSTR(msg))

// Function definitions (we define them here, but the code is below)
void play(FatReader &dir);

//////////////////////////////////// SETUP
void setup()
{
Serial.begin(9600); // set up Serial library at 9600 bps for debugging

putstring_nl("\nWave test!"); // say we woke up!

putstring("Free RAM: "); // This can help with debugging, running out of RAM is bad
Serial.println(FreeRam());

// if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you
if (!card.init()) { //play with 8 MHz spi (default faster!)
error("Card init. failed!"); // Something went wrong, lets print out why
}

// enable optimize read - some cards may timeout. Disable if you're having problems
card.partialBlockRead(true);

// Now we will look for a FAT partition!
uint8_t part;
for (part = 0; part < 5; part++) { // we have up to 5 slots to look in
if (vol.init(card, part))
break; // we found one, lets bail
}
if (part == 5) { // if we ended up not finding one :(
error("No valid FAT partition!"); // Something went wrong, lets print out why
}

// Lets tell the user about what we found
putstring("Using partition ");
Serial.print(part, DEC);
putstring(", type is FAT");
Serial.println(vol.fatType(),DEC); // FAT16 or FAT32?

// Try to open the root directory
if (!root.openRoot(vol)) {
error("Can't open root dir!"); // Something went wrong,
}

// Whew! We got past the tough parts.
putstring_nl("Files found (* = fragmented):");

// Print out all of the files in all the directories.
root.ls(LS_R | LS_FLAG_FRAGMENTED);
}

//////////////////////////////////// LOOP
void loop()
{
root.rewind();
play(root);
}

/////////////////////////////////// HELPERS
/*
* print error message and halt
*/
void error_P(const char *str)
{
PgmPrint("Error: ");
SerialPrint_P(str);
sdErrorCheck();
while(1);
}
/*
* print error message and halt if SD I/O error, great for debugging!
*/
void sdErrorCheck(void)
{
if (!card.errorCode()) return;
PgmPrint("\r\nSD I/O error: ");
Serial.print(card.errorCode(), HEX);
PgmPrint(", ");
Serial.println(card.errorData(), HEX);
while(1);
}
/*
* play recursively - possible stack overflow if subdirectories too nested
*/
void play(FatReader &dir)
{
FatReader file;
while (dir.readDir(dirBuf) > 0) { // Read every file in the directory one at a time

// Skip it if not a subdirectory and not a .WAV file
if (!DIR_IS_SUBDIR(dirBuf)
&& strncmp_P((char *)&dirBuf.name[8], PSTR("WAV"), 3)) {
continue;
}

Serial.println(); // clear out a new line

for (uint8_t i = 0; i < dirLevel; i++) {
Serial.print(' '); // this is for prettyprinting, put spaces in front
}
if (!file.open(vol, dirBuf)) { // open the file in the directory
error("file.open failed"); // something went wrong
}

if (file.isDir()) { // check if we opened a new directory
putstring("Subdir: ");
printEntryName(dirBuf);
dirLevel += 2; // add more spaces
// play files in subdirectory
play(file); // recursive!
dirLevel -= 2;
}
else {
// Aha! we found a file that isnt a directory
putstring("Playing ");
printEntryName(dirBuf); // print it out
if (!wave.create(file)) { // Figure out, is it a WAV proper?
putstring(" Not a valid WAV"); // ok skip it
} else {
Serial.println(); // Hooray it IS a WAV proper!
wave.play(); // make some noise!

uint8_t n = 0;
while (wave.isplaying) {// playing occurs in interrupts, so we print dots in realtime
putstring(".");
if (!(++n % 32))Serial.println();
delay(100);
}
sdErrorCheck(); // everything OK?
// if (wave.errors)Serial.println(wave.errors); // wave decoding errors
}
}
}
}

Thursday, November 4, 2010

11/4

Today I continued researching how to play an wav file with the arduino microcontroller. I have decided that due to time constraints I will be attempting to use the kit sold at this address

http://www.ladyada.net/make/waveshield/

It holds an SD card and is set up for specifically playing low quality audio, which is all in which we are really interested.


Furthermore it comes with an Arduino code library which will make playing sound relatively simple. (hopefully...)

This is especially good given the 2 week time constraints and the lack of abundant free time needed for this project from the ground up.

11/1

Today I proceeded with researching how to realize this project. A list of links helping me in my research will follow.

 http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/


http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBMQFjAA&url=http%3A%2F%2Fwww.cs.ucr.edu%2F~amitra%2Fsdcard%2FAdditional%2Fsdcard_appnote_foust.pdf&rct=j&q=sd%20card%20pin%20assignment&ei=wvjOTN2uO4X6lwfX6PnjCA&usg=AFQjCNEDUwVWu-8njXMNVXMa66KbdKKgFA&sig2=k1aqmJSCxxfyo2XRYtiwAg&cad=rja

http://www.arduino.cc/playground/Code/Spi

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1206874649/135

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1206874649/8

http://cgi.ebay.com/SD-SDHC-MEMORY-CARD-READER-USB-1GB-2GB-4GB-8GB-16GB-/190445265354?pt=PCC_Drives_Storage_Internal&hash=item2c576c21ca

http://en.wikipedia.org/wiki/Linear_pulse_code_modulation

What I am trying to do with arduino is to attach an sd card and then read from it. what will be contained within the SD card will be a wav file holding the audio track for our talking tree.

10/28

Today we reviewed our previous thoughts about making a jacket and found that it was not an option. we are returning to the original idea of making a talking tree.

Thursday, October 28, 2010

10/25

to day was uneventfull. pat and I connected a lily pad to experiment with its coding and waited to talk with the instructors about verifying our project..