cheap sound module: what version is this?

i wouldn't give up rebel-agent, the module works, just check again all connections, pins, code used and i would change the soldered pin to 5volts

i am not using any resistor

what i understood of this board:

  1. seems it doesnt play the 0000 named file (starts playing 0001)
    2. if i connect to analog pins of arduino it plays some sounds fine while other doesn't play correctly
  2. if i connect to digital pins of arduino it plays sounds fine
  3. it needs around 1 second of delay at startup.
  4. needs to add the exact lenght time of each track using "delay" command

video test here: WTV020-SD-16P audio/sound module for arduino - test #1 - YouTube

code used on the video test:

/*
  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 = 6;  // the pin number of the clock pin
const int dataPin = 9;  // the pin number of the dataPin pin
const int resetPin = 3;  // 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);

  sendCommand(VOLUME_7);
}

void loop() {


  delay(1000);

  // play "0001.wav"
  sendCommand(0x0001);
  delay(4000);
  
    // play "0002.wav"
  sendCommand(0x0002);
  delay(4000);
  
  
    // play "0003.wav"
  sendCommand(0x0003);
  delay(6000);
  
    // play "0004.wav"
  sendCommand(0x0004);
  delay(6000);
  

  // stop playing
  sendCommand(STOP);
  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);
        //Serial.print(1);
      }
    else
       {
         digitalWrite(dataPin, LOW);
        // Serial.print(0);
       }
    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); 
}

now, since on my project all the digital pins are busy, i must find out why on analog pins doesn't perform well

any idea?

as stated on arduino site they can be used as digital output as well

While the main function of the analog pins for most Arduino users is to read analog sensors, the analog pins also have all the functionality of general purpose input/output (GPIO) pins (the same as digital pins 0 - 13).
Consequently, if a user needs more general purpose input output pins, and all the analog pins are not in use, the analog pins may be used for GPIO.

onesky:
as stated on arduino site they can be used as digital output as well

While the main function of the analog pins for most Arduino users is to read analog sensors, the analog pins also have all the functionality of general purpose input/output (GPIO) pins (the same as digital pins 0 - 13).
Consequently, if a user needs more general purpose input output pins, and all the analog pins are not in use, the analog pins may be used for GPIO.

http://arduino.cc/en/Tutorial/AnalogInputPins

One odd quirk you may come across is that on the SMD versions of the ATmega processor where you get A6 and A7 pins, those two CAN'T be used as digital pins.

johnwasser:

onesky:
as stated on arduino site they can be used as digital output as well

While the main function of the analog pins for most Arduino users is to read analog sensors, the analog pins also have all the functionality of general purpose input/output (GPIO) pins (the same as digital pins 0 - 13).
Consequently, if a user needs more general purpose input output pins, and all the analog pins are not in use, the analog pins may be used for GPIO.

http://arduino.cc/en/Tutorial/AnalogInputPins

One odd quirk you may come across is that on the SMD versions of the ATmega processor where you get A6 and A7 pins, those two CAN'T be used as digital pins.

yep, i knew that
i use these anaolog pins:

int RST = A3;
int CLK = A4;
int DAT = A5;

i dont' understand why with digital pins the sounds are played correctly, while with these analog pins some sound files are truncated after 1 second or doesn't play at all and stop the board to work.

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:

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:

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.

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

Try again here:

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.

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

0001.WAV (21.6 KB)

0003.WAV (21.6 KB)

0004.WAV (21.6 KB)

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. :wink:

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?

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

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

read also comments and links here:

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

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

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

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?

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); 
}

for rebel-agent: did u read this forum? maybe your kingston is not compatible?

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

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:

the-rebel-agent:
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

/*
  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.

my 2° video test and conclusion:

code used in this test

/*
  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.

I really love you work, but I think the bug is in the source code, which I love to fix IF my sound module were working for me. Reading the manuals carefully, I read that after reset the board, you should wait a certain time to let the module to read the sd card. About 300ms. But I am not sure, If this time is always the same or depends of the quantity of voices stored in the card. This is why you should include the reading of the busy pin to know when the module is available to play the next voice. After that, every time you send a command, you should wait until is available for the next track. If not, you will be stopping the current voice. Have to test and debug a good library once I get my new memory card. Keep you posted but I must say u r doing an amazing job with that blaster.

thanks rebel-agent
i am sure the transmission code can be improved, but as you see it's only me and you here.. nobody help ..
and it's strange because this card is very cheap and mount a very popular IC (WTV020-SD) wich is the same we find in more expensive audio modules that do the same things (such as SOMO14)

anyway the transmission protocol is the I2C wich needs its specific code in the program.

The other sound module i tested in my Project use Standard RS232 serial communication, decoded by arduino ATmega8U2 USB-to-TTL Serial chip.

That means only the corresponding RX pin is used on Arduino and no additionl code is needed. The only down side of that module is the Mp3 format: that compression needs always a very small pause at beginning of each track.