Makezine RFIDbear Waveshield help for noob

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
jpryor0379
 
Posts: 12
Joined: Mon Nov 28, 2011 7:42 pm

Makezine RFIDbear Waveshield help for noob

Post by jpryor0379 »

Hey all I am new to posting so please bear with me. I am working on the Makezine RFIDbear:

http://makeprojects.com/Project/Charlie ... ear/1411/1

for my daughters Christmas present but I cannot get the Waveshield to play sounds. The RFIDreader sketch:
// RFID reader

const int startByte = 10;
const int endByte = 13;
const int tagLength = 10;
const int totalLength = tagLength + 2;

char tag[tagLength + 1];

int bytesread=0;

void setup()
{
  Serial.begin(2400);
  pinMode(7,OUTPUT);
  digitalWrite(7, LOW);
}
void loop()
{
  if(Serial.available() >= totalLength)
  {
    if(Serial.read() == startByte)
    {
      bytesread = 0;
      while(bytesread < tagLength)
      {
        int val = Serial.read();
        if((val == startByte)||(val == endByte))
          break;
        tag[bytesread]=val;
        bytesread++;
      }
      if( Serial.read() == endByte)
      {
         tag[bytesread]=0;
         Serial.print("RFID tag is: ");
         Serial.println(tag);
      }
    }
  }
}
reads the RFID tags with no problem but when it comes to playing music nothing works for the CharlieBear sketch, nothing happens not even errors:
// An interactive bear for Charlie -- RFID triggered sound responses

#include <FatReader.h>
#include <SdReader.h>
#include "WaveHC.h"
#include "WaveUtil.h"

SdReader memcard;
FatVolume vol;
FatReader root;
FatReader file;
WaveHC wave;

#define ENABLE 7      // Set the pin number for enabling the RFID reader. The Audio Shield uses pins 2-5.
#define NUMTAGS 22

int val = 0;
char code[10];
int bytesread = 0;

char knowntags[NUMTAGS][11] = {"12000A439E", "0100E27C4D"};
char soundfiles[NUMTAGS][9] = {"1000.WAV", "1001.WAV", "1002.WAV", "1003.WAV", "1004.WAV", "1005.WAV", "1006.WAV", "1007.WAV", "1008.WAV", "1009.WAV", "1010.WAV", "1011.WAV", "1012.WAV", "1013.WAV", "1014.WAV", "1015.WAV", "1016.WAV", "1017.WAV", "1018.WAV", "1019.WAV", "1020.WAV", "1021.WAV"};
char filename[1][13];

void setup() {
  //////// Set up RFID reader to collect tag information /////////////////////
  Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps
  pinMode(ENABLE,OUTPUT); // Set digital pin 7 as OUTPUT to connect it to the RFID /ENABLE pin
  digitalWrite(ENABLE, LOW); // Activate the RFID reader
  
  //////// Set the pins to output for driving the Audio Shield
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  
  ////////// Set up the Audio Shield by initializing the memory card for reading ////////
  if (!memcard.init()) {
    // If something went wrong sdErrorCheck prints out the error check
    putstring_nl("Card init. failed!");
    cardErrorCheck();
    return;
  }
  
  //This will optimize the reading of the memory card -- remove it if it times out
  memcard.partialBlockRead(true);
  
  // Find a FAT formatted partition by looking in teh first five slots. Remember your memory card should be FAT16 or FAT32 formatted
  uint8_t partition;
  for (partition = 0; partition < 5; partition++) {
    if (vol.init(memcard, partition))
      break;
  }
  if (partition == 5)
  {
    putstring_nl("No valid FAT partition");
    cardErrorCheck();
    while(1); // This is a point of no return. Format your memory card properly and try again.
  }

  // Open the root directory for reading the files
  if (!root.openRoot(vol))
  {
    putstring_nl("Can't open root directory");
    while(1); // Something went wrong here so investigate the file system on your memory card.
  }
  
  // If you got this far then the card is ready to read
  putstring_nl("Ready to go");
}

// If we find an error, check what the error is and show it on the serial terminal
void cardErrorCheck(void)
{
  if(!memcard.errorCode()) return;
  putstring("\n\rSD I/O error:");
  Serial.print(memcard.errorCode());
  putstring(", ");
  Serial.print(memcard.errorData());
  while(1); // Stick here if there is an error
}

void loop() {

  if(Serial.available() > 0) { // if data available from reader
    if((val = Serial.read()) == 10) { // check for header
      bytesread = 0; 
      while(bytesread<10) { // read 10 digit code
        if( Serial.available() > 0) {
          val = Serial.read();
          if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading
            break; // stop reading
          } 
          code[bytesread] = val;         // add the digit
          bytesread++;                   // ready to read next digit
        } 
      } 
      if(bytesread == 10) { // if 10 digit read is complete
        playsound(code);
        Serial.print("TAG code is: "); // possibly a good TAG
        Serial.println(code); // print the TAG code
        Serial.flush(); // Flush the serial buffer before trying to read a new code
      } 
      bytesread = 0; 
    }
  }



void playsound(char codetoplay[]) {
  for(int i = 0; i<8; i++) { // Make a filename from the first 8 characters of the RFID tag number
    filename[0]=codetoplay;
  }
  filename[0][8]='.';
  filename[0][9]='w';
  filename[0][10]='a';
  filename[0][11]='v';
  silence(); //shut down anything that is currently playing and close that file
  playfile(filename[0]);
  
}

void playfile(char *name) {
  if (!file.open(root, name)) {
      putstring_nl("Couldn't open file");
      return;
   }
   if (!wave.create(file)) {
     putstring_nl("Not a valid WAV");
     return;
   }
  wave.play();
}

void silence() {
  if(wave.isplaying) {
    wave.stop();
  }
}



I have tried to run the DAPHC sketch and that does not work either all the serial monitor displays is:

Wave test!
Free RAM:

I have checked everything I can think of and nothing works.
I am using a 2GB SD card formatted to FAT
I have purchased another waveshield just in case the board is defective but I want to wait until i know what is wrong.

Can anyone please help me?

Thank you in advanced.

jpryor0379
 
Posts: 12
Joined: Mon Nov 28, 2011 7:42 pm

Re: Makezine RFIDbear Waveshield help for noob

Post by jpryor0379 »

I have checked the solder joints and I see no issues. Now the RFID reader sketch does not work. Does anyone have any insight?

Thanks in advance

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Makezine RFIDbear Waveshield help for noob

Post by adafruit_support_bill »

How did you format the SD card? http://forums.adafruit.com/viewtopic.ph ... 1&p=109173
Are the WAV files in the right format? http://www.ladyada.net/make/waveshield/convert.html

jpryor0379
 
Posts: 12
Joined: Mon Nov 28, 2011 7:42 pm

Re: Makezine RFIDbear Waveshield help for noob

Post by jpryor0379 »

I have formatted the SD card to the FAT format according to the guide and I have used the pi speak WAV. files and the properly formatted files according to the instructions for an itunes format and sounds are played. I have also tried multiple SD cards to ensure the SD card is not the source of the problem. Is a 2gb SD card supported, In your instruction 512k up to 1GB is mentioned?

Thank you for your help in advance.

jpryor0379
 
Posts: 12
Joined: Mon Nov 28, 2011 7:42 pm

Re: Makezine RFIDbear Waveshield help for noob

Post by jpryor0379 »

I formatted the SD card using the SDcard.org formatter with the same results. I ran the SD read/write sketch and got the following resukts:

Code: Select all

type any character to start

init time: 19

Card type: SD2

Manufacturer ID: 73
OEM ID: BG
Product: NCard
Version: 1.0
Serial number: 1211834417
Manufacturing date: 11/2011

card size: 3850240 (512 byte blocks)
partion,boot,type,start,length
1,0,6,137,3846391
2,0,0,0,0
3,0,0,0,0
4,0,0,0,0
Read test starting. Please Wait.

Read 20000 blocks
mills: 18816

Done

type any character to start
I am not a coder so I did not try to use your sketch for fear of making things worse.

Thanks

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Makezine RFIDbear Waveshield help for noob

Post by adafruit_support_bill »

Looks like your SD card and the card-reading circuitry is working fine.
You might try adding some Serial.println diagnostic statements in the CharlieBear sketch to better see what it is (and is not) doing.
Also, if you can post some clear photos of the front & back of the shield, we can take a look for any assembly issues.

jpryor0379
 
Posts: 12
Joined: Mon Nov 28, 2011 7:42 pm

Re: Makezine RFIDbear Waveshield help for noob

Post by jpryor0379 »

Serial.println diagnostic statement????

Is there a tutorial describing that somewhere?

Here are the pictures of the waveshield

Image

Image

Image

Image

Image

I am no soldering expert so please feel free to point out any and all mistakes and any places which need improvement.

Thank you for your help
Last edited by jpryor0379 on Mon Dec 05, 2011 10:40 pm, edited 1 time in total.

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Makezine RFIDbear Waveshield help for noob

Post by adafruit_support_bill »

Serial.println diagnostic statement????

Is there a tutorial describing that somewhere?
Just add Serial.println() statements to indicate what section of code just executed. As in this example from the RFID sketch you posted.
if( Serial.read() == endByte)
{
tag[bytesread]=0;
Serial.print("RFID tag is: ");
Serial.println(tag);
}
Your images did not show up. Use the "Upload Attachment" tab below the edit window.

jpryor0379
 
Posts: 12
Joined: Mon Nov 28, 2011 7:42 pm

Re: Makezine RFIDbear Waveshield help for noob

Post by jpryor0379 »

OK I will try that. Edited the post to include the pictures

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Makezine RFIDbear Waveshield help for noob

Post by adafruit_support_bill »

Looks like everything is in the right place, but larger/closer photos would be better for checking the solder joints.

Also, what kind of Arduino are you using for this project?

jpryor0379
 
Posts: 12
Joined: Mon Nov 28, 2011 7:42 pm

Re: Makezine RFIDbear Waveshield help for noob

Post by jpryor0379 »

I am using the Arduino Uno

Here are some pictures of the solder joints:

Image

Image

Image

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Makezine RFIDbear Waveshield help for noob

Post by adafruit_support_bill »

Much better. Bottom-side solder looks OK. A top-side shot would be good too.

What are the red, white and green wires (not the green jumpers) connected to?

jpryor0379
 
Posts: 12
Joined: Mon Nov 28, 2011 7:42 pm

Re: Makezine RFIDbear Waveshield help for noob

Post by jpryor0379 »

OK. I will post some tonight.

Just to kill some time I went ahead and soldered up the second Waveshield that I bought and the Waveshield will still not play the basic DAPHC sketch or the pispeakHC sketch with the sound files downloaded directly form the ladyada website. It seems that the only constant is my 2GB PNY SDcard, my windows XP machine, and twaveshield version 1.1, and me. When I run the DAPHC sketch on the new waveshield all i get it is the same:

Wave Test!
Free RAM:

The other wires you were asking about in the pictures are the wires which go the to the Parrallax RFID reader which is used for the CharlieBear sketch. The RFIDread sketch , which puts out a serial monitor print out of the RFID serial number, works with no problems.

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Makezine RFIDbear Waveshield help for noob

Post by adafruit_support_bill »

What kind of Arduino are you using for this project?

jpryor0379
 
Posts: 12
Joined: Mon Nov 28, 2011 7:42 pm

Re: Makezine RFIDbear Waveshield help for noob

Post by jpryor0379 »

I am using the Arduino Uno:

I have attached links to the pictures of the top of the waveshield (they are pretty big):

https://lh4.googleusercontent.com/-MHKh ... .JPG?gl=US

https://lh3.googleusercontent.com/-Qhr4 ... .JPG?gl=US

https://lh5.googleusercontent.com/-Ij3k ... .JPG?gl=US

Could my 2GB SD card be the problem? Should I use a 1GB or smaller SD card?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”