Go Down

Topic: cheap sound module: what version is this? (Read 37 times) previous topic - next topic

the-rebel-agent

#45
Jul 14, 2012, 06:27 pm Last Edit: Jul 14, 2012, 06:56 pm by the-rebel-agent Reason: 1
Only have more bad news. Changed the soldered pin from 3.3v to 5v. Reconnected everything, plus added the busy pin. Used the very same sketch you used and nothing. Later I modified the code to sense the busy pin, cause wanted to know what was going on there. To my surprise, after I reset the module, busy pin keeps HIGH for few seconds ( a bit too much). Later when I read LOW, I start to play the song #0001. I put a loop to play the song until BUSY is LOW and all over again. This is the code:

Code: [Select]
const int resetPin = 2;  // the pin number of the reset pin
const int clockPin = 4;  // the pin number of the clock pin
const int dataPin = 7;  // the pin number of the dataPin pin
const int busyPin = 8;  // the pin number of the busyPin pin

int busyPinState=LOW;

void setup() {
  Serial.begin(9600);
  pinMode(resetPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(busyPin, INPUT);

  digitalWrite(clockPin, HIGH);
  digitalWrite(dataPin, LOW);

  Serial.println("Initializing module.");
  digitalWrite(resetPin, HIGH);
  delay(100);
  digitalWrite(resetPin, LOW);
  delay(5);
  digitalWrite(resetPin, HIGH);
  delay(100);
}

void loop()
{
  Serial.println("Reading busy pin state.");
  busyPinState=digitalRead(busyPin);
  if (busyPinState == LOW) {
    Serial.println("Start playing 0001.wav");
    sendCommand(0x0001);
    while(busyPinState==HIGH){
      busyPinState=digitalRead(busyPin);
      Serial.println(busyPinState);     
    }
    Serial.println("Stop playing 0001.wav");
  }
  else{   
    Serial.println("Module is busy.");
    delay(1000);
  }
}

void sendCommand(int addr) {
  digitalWrite(clockPin, LOW);
  delay(2);
  for (int i=15; i>=0; i--)
  {
    delayMicroseconds(50);
    if((addr>>i)&0x0001 >0)
    {
      digitalWrite(dataPin, HIGH);
    }
    else
    {
      digitalWrite(dataPin, LOW);
    }
    delayMicroseconds(50);
    digitalWrite(clockPin, HIGH);
    delayMicroseconds(50);
    if(i>0)
    {
      digitalWrite(dataPin, LOW);
    }
    else
    {
      digitalWrite(dataPin, HIGH);
      delayMicroseconds(50);
    }
    if(i>0)
    {
      digitalWrite(clockPin, LOW);
    }
    else
    {
      digitalWrite(clockPin, HIGH);
    }
  }

  delay(20);
}


This is the video I took from this little experiment:

http://www.youtube.com/watch?v=PaYt-kdAwJU

In this video you can see the weird behavior of this board. I don't know If the microSD card is not being read, or the module spk output is dead, or nothing. Don't have a clue of what is going on.

onesky

i don't understand the thing about the busy pin. Just solder a led on the board as showed on the scheme or in my video, and you get your busy led, no need to add anything on the code.



p.s.
cant see your video, it's private

the-rebel-agent

Try again here:
http://www.youtube.com/watch?v=PaYt-kdAwJU

and about the busy pin, the manual says that when the module is playing the voice/song the busy pin is in HIGH or 1. Was trying to know IF this little one was working or not.

onesky

#48
Jul 14, 2012, 07:08 pm Last Edit: Jul 14, 2012, 07:15 pm by onesky Reason: 1
i see your video, from what i can perceive from the quality of the video, connections seem ok
are you sure about the bredboard connections? i still didnt use that before so i can't say anything about it.
what wav files are you testing? did you test my code without your busy pin adds?

these are my connections:



these are my files

the-rebel-agent

I really appreciate your help. Yes, tried your code first, without the busy pin as input, and later added for debugging purposes. Downloaded your wav files and will test them right away. Using same pin out as you actually and the breadboard is brand new so I think that's ok. Keep you posted. And about your analog pins problems, will be very helpful to connect an oscilloscope to check the signals. ;)

Go Up