Go Down

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

the-rebel-agent

Will test all this night, but I am pretty sure this module will only play certain ad4 and Wav files encoded in the right rate. As read in other websites, this one and somo-14d shares the same IC so connection diagram should be fine, even the sketch program should be correct. Your problem was the Vcc and mine the connection. Keep you posted. We are in the same boat. And If anybody have this working, we will really appreciate any help.

onesky

from the link above i downloaded also this test program, next time i will try this

Code: [Select]

/*
  Control Arduino Wave
*/
int RST = A3;
int CLK = A4;
int DAT = A5;
   
   
void setup() {   
   
   
    pinMode(RST, OUTPUT);
    pinMode(CLK, OUTPUT);
    pinMode(DAT, OUTPUT);
   
   
    digitalWrite(RST, HIGH);
    digitalWrite(CLK, HIGH);
    digitalWrite(DAT, HIGH);
   
    digitalWrite(RST, LOW);
    delay(5);
    digitalWrite(RST, HIGH);
    delay(300);
}

void loop() {

  send(0x0000);
  delay(60000);
  send(0x0001);
  delay(60000);
  send(0x0002);
  delay(60000);
  while(1);
}
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


Will test all this night, but I am pretty sure this module will only play certain ad4 and Wav files encoded in the right rate. As read in other websites, this one and somo-14d shares the same IC so connection diagram should be fine, even the sketch program should be correct. Your problem was the Vcc and mine the connection. Keep you posted. We are in the same boat. And If anybody have this working, we will really appreciate any help.

i used the somo tool to create the ad4 file
http://www.4dsystems.com.au/prod.php?id=74

the-rebel-agent

Checking the diagram I noticed that A0, AX, etc are only inputs for arduino. How will this woork that way? I do believe that theconnection diagram is wrong and you should use other pins as outputs.

the-rebel-agent

Did all the test using almost every code available and got a few conclusions. A pins are only analog inputs, so you should use any other digital output ( example: 2,3,4 for reset,clock,data). When I turn on the WTV020-SD-mini-16P, the busy light blinks quickly and after a second of so keeps on. I connected the reset, clock and data and reset the board at the setup portion of the code. You should put the rst pin for 5ms down and later wait 300ms before send any command. I noticed that this guy, was able to do something with the  WTV020-SD-20s board:

http://www.vduenasg.blogspot.com.ar/2012/03/wtv020-sd.html

He modified the clock timing, from 200us to 50us to make it work. So, basically I am pretty sure that now is a software problem with the data and clock pins, since I believe the rst function is working. A out the 3.3v problem, the manual states that you can connect two N4007 diodes in serial from a 5v output power. Did not test it yet. Will be playing with this modified code:

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 = 2;  // the pin number of the clock pin
const int dataPin = 3;  // the pin number of the data pin
const int resetPin = 4;  // 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(5);
  digitalWrite(resetPin, HIGH);
  delay(300);

  sendCommand(VOLUME_7);
}

void loop() {
  // play "0000.ad4"
  sendCommand(0x0000);
  delay(1000);

  // play "0001.ad4"
  sendCommand(0x0001);
  delay(1000);

  // stop playing
  sendCommand(STOP);
  delay(1000);
}

void sendCommand(unsigned int command) {
  // start bit
  digitalWrite(clockPin, LOW);
  delay(2);

  // bit15, bit14, ... bit0
  for (unsigned int mask = 0x8000; mask > 0; mask >>= 1) {
    if (command & mask) {
      digitalWrite(dataPin, HIGH);
    }
    else {
      digitalWrite(dataPin, LOW);
    }
    // clock low
    digitalWrite(clockPin, LOW);
    delayMicroseconds(50);

    // clock high
    digitalWrite(clockPin, HIGH);
    delayMicroseconds(50);
  }

  // stop bit
  delay(2);
}

Go Up