Go Down

Topic: cheap sound module: what version is this? (Read 39917 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. ;)

the-rebel-agent

Tried your very same code, modifying the pins #s, and your WAV files and nothing. Same erratic behavior. At this point I believe the module is not working or the sd card is not being read. Were you able to try my code?

onesky

#51
Jul 14, 2012, 07:53 pm Last Edit: Jul 14, 2012, 08:37 pm by onesky Reason: 1
no i didnt try. Did u format the card in FAT ? did you try the same arduino pins of my code? they are pwm.

i can suggest you to test the connections between the breadboard pins and the arduino with a tester

the-rebel-agent

Actually formatted them twice. With Windows and Linux in FAT16. Will try all over again and tell you.

onesky

read also comments and links here:
http://www.sparkfun.com/products/9534

i will try to add resistors on analog pins, even if are equipped with pullup resistors

Quote

Pullup resistors

The analog pins also have pullup resistors, which work identically to pullup resistors on the digital pins. They are enabled by issuing a command such as

digitalWrite(A0, HIGH);  // set pullup on analog pin 0


the-rebel-agent

No luck here, even using same pins as you did. :~

onesky

#55
Jul 14, 2012, 09:17 pm Last Edit: Jul 15, 2012, 12:48 am by onesky Reason: 1
i tested with resistors 30ohm, 180ohm, 1khom
didn't work at all
so no resistors are needed on pins

did you try to change the speaker?
since now i used a 4 watt 16ohm minispeaker
if i connect to the pc microphone i cant listen anything
if i connect to a 3 watt 8ohm speaker the sound stop at beginning
if i connect to headphones i listen the same of 4 watt speaker


Edit:
i converted the wav files into ad4 and now it's working fine also with analog pins!

wav files have a lot of problem with this sound board, better to use AD4 format!

what i converted: wav files sampled at 36khz and saved in wav (pcm unsigned mono 8bit) with Goldwave free software
what program i used for AD4 conversion: Usb Recover free software from SOMO website; used orignal sample rate (36khz)

then i disconnected the speaker and connected the mini-amplifier to AUDIO-L of sound module and to the ground of arduino: very loud volume now!

now the problem:
how to manage these files with Arduino because they play correctly but doesn't respect the order or they skip the first track sometime. Something is wrong with the code!

is this code correct for that wave form?
Code: [Select]
void send(int addr)
{
  digitalWrite(CLK, LOW);
  delay(2);
  for (int i=15; i>=0; i--)
  {
    delayMicroseconds(50);
    if((addr>>i)&0x0001 >0)
      {
        digitalWrite(DAT, HIGH);
        //Serial.print(1);
      }
    else
       {
         digitalWrite(DAT, LOW);
        // Serial.print(0);
       }
    delayMicroseconds(50);
    digitalWrite(CLK, HIGH);
    delayMicroseconds(50);
   
    if(i>0)
    digitalWrite(DAT, LOW);
    else
    digitalWrite(DAT, HIGH);
    delayMicroseconds(50);
   
    if(i>0)
    digitalWrite(CLK, LOW);
    else
    digitalWrite(CLK, HIGH);
  }
 
  delay(20);
}



onesky

#56
Jul 15, 2012, 12:25 am Last Edit: Jul 15, 2012, 12:27 am by onesky Reason: 1
for rebel-agent: did u read this forum? maybe your kingston is not compatible?

http://www.picaxeforum.co.uk/showthread.php?13971-Getting-started-with-the-4D-Systems-SOMO-14D-audio-module/page2


i am using a 1gb Sandisk i bought from ebay (maybe a fake)

the-rebel-agent

#57
Jul 15, 2012, 07:23 am Last Edit: Jul 15, 2012, 07:49 am by the-rebel-agent Reason: 1
About the ad4 format, now that is working fine for you: were you able to try SOMO default ad4 files from their website?

About the speaker: A friend of mine loaned me one of those that usually are installed inside a light saber hilt, which I assume are 8 ohms 250 mw, but I am going to check that.

About the memory: 1 GB cards are almost at the border of the extinction, so they are not easy to get nowadays. Will track another brand to test.

About the sendCommand source code, I am not sure that code is perfect. Since my board is not working, I am not able to test it. Will be refining it once my board is working. And obviously will be sharing it here.

PS: Some asserts:
1-My speaker is 8 ohm 1w.
2-About the signal, this documents xplains very clear how should work:
http://www.embeddedadventures.com/datasheets/MOD-1007_hw_v4.pdf

onesky

#58
Jul 15, 2012, 03:03 pm Last Edit: Jul 15, 2012, 03:06 pm by onesky Reason: 1

About the ad4 format, now that is working fine for you: were you able to try SOMO default ad4 files from their website?

just tested, they all work fine
i also found the problem with track order list; i fixed adding the STOP command after each track

i fixed the volume command, adding a delay of 600 at startup. It needs time to elaborate..

this is my edited program

Code: [Select]
/*
 SOMO-14D Test
 Control a SOMO-14D module to play sounds

 Reference
 http://www.4dsystems.com.au/prod.php?id=73

 Created 20 October 2009
 By Shigeru Kobayashi
*/

const int clockPin = A4;  // the pin number of the clock pin
const int dataPin = A5;  // the pin number of the dataPina pin
const int resetPin = A3;  // the pin number of the reset pin

const unsigned int VOLUME_0 = 0xFFF0;
const unsigned int VOLUME_1 = 0xFFF1;
const unsigned int VOLUME_2 = 0xFFF2;
const unsigned int VOLUME_3 = 0xFFF3;
const unsigned int VOLUME_4 = 0xFFF4;
const unsigned int VOLUME_5 = 0xFFF5;
const unsigned int VOLUME_6 = 0xFFF6;
const unsigned int VOLUME_7 = 0xFFF7;

const unsigned int PLAY_PAUSE = 0xFFFE;
const unsigned int STOP = 0xFFFF;

void setup() {
 pinMode(clockPin, OUTPUT);
 pinMode(dataPin, OUTPUT);
 pinMode(resetPin, OUTPUT);

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

 // reset the module
 digitalWrite(resetPin, HIGH);
 delay(100);
 digitalWrite(resetPin, LOW);
 delay(10);
 digitalWrite(resetPin, HIGH);
 delay(100);
 delay(500);

}

void loop() {
 sendCommand(0xFFF6);
 // play "0000.ad4"
 sendCommand(0x0001);
 delay(5000);
     sendCommand(STOP);

 // play "0001.ad4"
 sendCommand(0x0002);
 delay(5000);
     sendCommand(STOP);

 // play "0001.ad4"
 sendCommand(0x0003);
 delay(6000);
   sendCommand(STOP);
 
   // play "0001.ad4"
 sendCommand(0x0004);
 delay(5000);
     sendCommand(STOP);
 
   // play "0001.ad4"
 sendCommand(0x0005);
 delay(9000);
   sendCommand(STOP);
     sendCommand(0x0003);
 delay(1000);
   sendCommand(STOP);
     sendCommand(0x0003);
 delay(1000);
   sendCommand(STOP);
 delay(1000);
}

void sendCommand(int addr)
{
 digitalWrite(clockPin, LOW);
 delay(2);
 for (int i=15; i>=0; i--)
 {
   delayMicroseconds(200);
   if((addr>>i)&0x0001 >0)
     {
       digitalWrite(dataPin, HIGH);
       //Serial.print(1);
     }
   else
      {
        digitalWrite(dataPin, LOW);
       // Serial.print(0);
      }
   delayMicroseconds(200);
   digitalWrite(clockPin, HIGH);
   delayMicroseconds(200);
   
   if(i>0)
   digitalWrite(dataPin, LOW);
   else
   digitalWrite(dataPin, HIGH);
   delayMicroseconds(200);
   
   if(i>0)
   digitalWrite(clockPin, LOW);
   else
   digitalWrite(clockPin, HIGH);
 }
 
 delay(30);
}


now next step is the button command to simulate the gun fire sound.
If it will pass the test i will replace the more expensive mp3 WTM-SD module whit this one in my Open Blaster Project.

onesky

#59
Jul 15, 2012, 04:45 pm Last Edit: Jul 15, 2012, 04:46 pm by onesky Reason: 1
my 2° video test and conclusion:

http://www.youtube.com/watch?v=v71YSc0XF3g
code used in this test
Code: [Select]
/*
  SOMO-14D Test
  Control a SOMO-14D module to play sounds

  Reference
  http://www.4dsystems.com.au/prod.php?id=73

  Created 20 October 2009
  By Shigeru Kobayashi
*/

const int clockPin = A4;  // the pin number of the clock pin
const int dataPin = A5;  // the pin number of the dataPina pin
const int resetPin = A3;  // the pin number of the reset pin

const int buttonPinFire = 8;   // FIRE
const int ledPin = 11;      // LED FIRE (RED)

const unsigned int VOLUME_0 = 0xFFF0;
const unsigned int VOLUME_1 = 0xFFF1;
const unsigned int VOLUME_2 = 0xFFF2;
const unsigned int VOLUME_3 = 0xFFF3;
const unsigned int VOLUME_4 = 0xFFF4;
const unsigned int VOLUME_5 = 0xFFF5;
const unsigned int VOLUME_6 = 0xFFF6;
const unsigned int VOLUME_7 = 0xFFF7;

const unsigned int PLAY_PAUSE = 0xFFFE;
const unsigned int STOP = 0xFFFF;

int buttonState = 0;         // current state of the button

void setup() {
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(resetPin, OUTPUT);
 
  pinMode(buttonPinFire, INPUT);
  pinMode(ledPin, OUTPUT);
 
  digitalWrite(ledPin, LOW);

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

  // reset the module
  digitalWrite(resetPin, HIGH);
  delay(100);
  digitalWrite(resetPin, LOW);
  delay(10);
  digitalWrite(resetPin, HIGH);
  delay(100);
  delay(500);
sendCommand(0xFFF6);
}

void loop() {
  buttonState = digitalRead(buttonPinFire);
  if (buttonState == HIGH) {

   
  // play "0000.ad4"
  sendCommand(0x000);
   digitalWrite(ledPin, HIGH);
     delay(50);
    digitalWrite(ledPin, LOW);
    delay(150);


}
}
void sendCommand(int addr)
{
  digitalWrite(clockPin, LOW);
  delay(2);
  for (int i=15; i>=0; i--)
  {
    delayMicroseconds(200);
    if((addr>>i)&0x0001 >0)
      {
        digitalWrite(dataPin, HIGH);
        //Serial.print(1);
      }
    else
       {
         digitalWrite(dataPin, LOW);
        // Serial.print(0);
       }
    delayMicroseconds(200);
    digitalWrite(clockPin, HIGH);
    delayMicroseconds(200);
   
    if(i>0)
    digitalWrite(dataPin, LOW);
    else
    digitalWrite(dataPin, HIGH);
    delayMicroseconds(200);
   
    if(i>0)
    digitalWrite(clockPin, LOW);
    else
    digitalWrite(clockPin, HIGH);
  }
 
  delay(30);
}


1. the sound board connected to the mini amplifier generates a lot of background noises, needs attenuator!
2. there is some lag between the button  pressed and emitted sound
3. if button is pressed more than once, the board soon stop to work correctly

conclusion:
i will not include this board on my Blaster project, i will keep the more expensive (and bigger sic) WTM-SD mp3 sound module.

Go Up