Go Down

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

the-rebel-agent

I meant that you have to provide the uSD card. So 6 dollars + uSD card. That's the cost.

xl97

ahh.. got it!  :)


(plus Arduino cost).. 


I think its awesome either way....  $6.00 is great!

I'll need some help tearing apart the WaveHC lib and the demo/examples on Adafruit soon..  to see about a seamless loop possibility..

as well as an 'auto fire' type playing.. if the button is pressed, and held..etc..etc..


(not so good at C code yet..LOL)



the-rebel-agent


ced_french

#78
Jul 19, 2012, 09:36 pm Last Edit: Jul 19, 2012, 09:50 pm by ced_french Reason: 1
hello everybody.

I'm french and I'm sorry because my english is very bad.

I need your help: i have the same module. I want to connect to +5V.

My project: use the basicstamp to control this module with the Two-line serial control mode.

i want try this module. In the first time, just with button connect to P2,P3,P4,P5 and P6 is the pin busy.

What is the schematic? What is the audio format with this schematic?

I have a sd cart 8go  but i format this: FAT16 and 990Mo. Is not a problem?

Thank you.

the-rebel-agent

#79
Jul 19, 2012, 09:48 pm Last Edit: Jul 19, 2012, 09:52 pm by the-rebel-agent Reason: 1
This is the connection diagram:



I really encourage you to put a LED, cause It will be very useful to know If the module is working on not. About the micro SD card, the only one I got working was a Sandisk 1gb. Don't know about other brands. Since there are no lights to indicate that the module is reading the card, you will have to check that using the Busy LED. If after reset the module, the LED blinks and turn off, sd card was OK. IF you see the busy LED turned on for a while, your SD card was not that lucky and means you will have to replace it. Hope this helps. About 5v Vcc, you can put two diodes 4007 in serial or change the soldered pin from 3.3 to 5.


ced_french


This is the connection diagram:


If after reset the module, the LED blinks and turn off, sd card was OK. IF you see the busy LED turned on for a while, your SD card was not that lucky and means you will have to replace it. Hope this helps. About 5v Vcc, you can put two diodes 4007 in serial or change the soldered pin from 3.3 to 5.


thank you.

ok it's mean I have to replace sd card beause the led stay turn on during 13seconds.

I can use this module just with button? withing arduino module?

thank you and sorry for my english.

the-rebel-agent

Yup, not reading the SD card. There is a seller on eBay from Germany selling Sandisk 1gb micro cards that could possible work If they are original. If you bought the module from the link we did, only serial mode will be enable. Did not try mp3 mode yet, but I assume won't work. Don't worry about your English, I am from Argentina and still after 10 years or more speaking and writing in English, still sucks. ;)

the-rebel-agent

Have been working in the code for this board. Want to create a library. Since I am not at home right now, I can't test this with my Arduino. Could someone test this for me?

Code: [Select]
/*
  WTV020-SD-16P Test
Control a WTV020-SD-16P module to play sounds from an Arduino board.

Created July 2012.
By Diego J. Arevalo.
*/

const int resetPin = 2;  // The pin number of the reset pin.
const int clockPin = 3;  // The pin number of the clock pin.
const int dataPin = 4;  // The pin number of the data pin.
const int busyPin = 5;  // The pin number of the busy pin.

int busyPinState = HIGH;

void setup() {
  pinMode(resetPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(busyPin, INPUT);
  resetModule();
}

void loop() {
  playSong(0);
  delay(5);
}

void playSong(int trackNumber){
  sendCommand(trackNumber);
  busyPinState=digitalRead(busyPin);
  while(busyPinState==HIGH){
    busyPinState=digitalRead(busyPin);
  }
}

void resetModule(){
  //Reset pulse.
  digitalWrite(resetPin, HIGH); 
  digitalWrite(resetPin, LOW);
  delay(5);
  digitalWrite(resetPin, HIGH);
  //Reset idle to start bit.
  digitalWrite(clockPin,HIGH);
  delay(300);
}

void sendCommand(unsigned int command) {
  //Start bit Low level pulse.
  digitalWrite(clockPin, LOW);
  delay(2);
  for (unsigned int mask = 0x8000; mask > 0; mask >>= 1) {
    //Write data setup.
    if (command & mask) {
      digitalWrite(dataPin, HIGH);
    }
    else {
      digitalWrite(dataPin, LOW);
    }
    //Write data hold.
    delayMicroseconds(50);
    //Clock high level pulse.
    digitalWrite(clockPin, HIGH);
    if (mask > 0x0001){
      delayMicroseconds(100);
      //Clock low level pulse.
      digitalWrite(clockPin, LOW);
      delayMicroseconds(100);
    }
    else{
      //Stop bit high level pulse.
      delay(2);
      digitalWrite(clockPin, LOW);
    }
  }
  //Busy active high from last data bit latch.
  delay(20);
}



Basically plays voice 0000.x every 5 seconds and only reset the device once. Busy pin must be connected cause this is sync play mode.

the-rebel-agent

#83
Jul 21, 2012, 07:06 pm Last Edit: Jul 21, 2012, 07:10 pm by the-rebel-agent Reason: 1
Fixed code:

Code: [Select]
/*
  WTV020-SD-16P Test
Control a WTV020-SD-16P module to play sounds from an Arduino board.

Created July 21 2012.
By Diego J. Arevalo.
*/

const int resetPin = 2;  // The pin number of the reset pin.
const int clockPin = 3;  // The pin number of the clock pin.
const int dataPin = 4;  // The pin number of the data pin.
const int busyPin = 5;  // The pin number of the busy pin.

int busyPinState = HIGH;

void setup() {
  pinMode(resetPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(busyPin, INPUT);
  resetModule();
}

void loop() {
  playAsyncSong(1);
  delay(5000);
  playSong(1);
}

void playSong(int voiceNumber){ 
  sendCommand(voiceNumber);
  busyPinState=digitalRead(busyPin);
  while(busyPinState==HIGH){
    busyPinState=digitalRead(busyPin);
  }
}

void playAsyncSong(int voiceNumber){
  sendCommand(voiceNumber);
}

void resetModule(){
  digitalWrite(clockPin, LOW);
  digitalWrite(resetPin, HIGH);
  //Reset pulse.}
  digitalWrite(resetPin, LOW);
  delay(5);
  digitalWrite(resetPin, HIGH);
  //Reset idle to start bit.
  digitalWrite(clockPin, HIGH);
  delay(300);
}

void sendCommand(unsigned int command) {
  //Start bit Low level pulse.
  digitalWrite(clockPin, LOW);
  delay(2);
  for (unsigned int mask = 0x8000; mask > 0; mask >>= 1) {
    //Clock low level pulse.
    digitalWrite(clockPin, LOW);
    delayMicroseconds(50);
    //Write data setup.
    if (command & mask) {
      digitalWrite(dataPin, HIGH);
    }
    else {
      digitalWrite(dataPin, LOW);
    }
    //Write data hold.
    delayMicroseconds(50);
    //Clock high level pulse.
    digitalWrite(clockPin, HIGH);
    delayMicroseconds(100);
    if (mask>0x0001){
      //Stop bit high level pulse.
      delay(2);     
    }
  }
  //Busy active high from last data bit latch.
  delay(20);
}


Attached sample file. This module is very pesky about microsd cards and ad4 files. This one works really good. I converted some other files that only plays 5 seconds and die.

the-rebel-agent

Optimized source code that plays with the volume and play/pause command:

Code: [Select]
/*
  WTV020-SD-16P Test
Control a WTV020-SD-16P module to play sounds from an Arduino board.

Created July 22 2012.
By Diego J. Arevalo.
*/

const int resetPin = 2;  // The pin number of the reset pin.
const int clockPin = 3;  // The pin number of the clock pin.
const int dataPin = 4;  // The pin number of the data pin.
const int busyPin = 5;  // The pin number of the busy pin.

int busyPinState = HIGH;

void setup() {
  pinMode(resetPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(busyPin, INPUT);
  resetModule();
}

void loop() {
  sendCommand(0xfff0);
  playAsyncSong(0);
  delay(1000);
  sendCommand(0xfff1);
  playAsyncSong(0);
  delay(1000);
  sendCommand(0xfff2);
  playAsyncSong(0);
  delay(1000);
  sendCommand(0xfff3);
  playAsyncSong(0);
  delay(1000);
  sendCommand(0xfff4);
  playAsyncSong(0);
  delay(1000);
  sendCommand(0xfff5);
  playAsyncSong(0);
  delay(1000);
  sendCommand(0xfff6);
  playAsyncSong(0);
  delay(1000);
  sendCommand(0xfff7);
  playAsyncSong(0);
  delay(1000);
  playAsyncSong(0);
  delay(5000);
  sendCommand(0xfffe);
  delay(2000);
  sendCommand(0xfffe);
  delay(5000); 
  sendCommand(0xffff);
  sendCommand(0xfff0);
}

void resetModule(){
  digitalWrite(clockPin, LOW);
  digitalWrite(resetPin, HIGH);
  //Reset pulse.}
  digitalWrite(resetPin, LOW);
  delay(5);
  digitalWrite(resetPin, HIGH);
  //Reset idle to start bit.
  digitalWrite(clockPin, HIGH);
  delay(300);
}

void playSong(int voiceNumber){ 
  sendCommand(voiceNumber);
  busyPinState=digitalRead(busyPin);
  while(busyPinState==HIGH){
    busyPinState=digitalRead(busyPin);
  }
}

void playAsyncSong(int voiceNumber){
  sendCommand(voiceNumber);
}

void sendCommand(unsigned int command) {
  //Start bit Low level pulse.
  digitalWrite(clockPin, LOW);
  delay(2);
  for (unsigned int mask = 0x8000; mask > 0; mask >>= 1) {
    //Clock low level pulse.
    digitalWrite(clockPin, LOW);
    delayMicroseconds(50);
    //Write data setup.
    if (command & mask) {
      digitalWrite(dataPin, HIGH);
    }
    else {
      digitalWrite(dataPin, LOW);
    }
    //Write data hold.
    delayMicroseconds(50);
    //Clock high level pulse.
    digitalWrite(clockPin, HIGH);
    delayMicroseconds(100);
    if (mask>0x0001){
      //Stop bit high level pulse.
      delay(2);     
    }
  }
}


Will be write a library to do even more easy to code this. It will be seamless. playAsyncSong don't need busy pin connected.

bobafett1

Hi Boys,I am a little late getting to the party here.  I have been trying to get my sound module to work using the serial write.
    mySerial.write(0x7E);
    mySerial.write(0x07);
    mySerial.write(0xB0);
    mySerial.write(0x30);
    mySerial.write(0x31);
    mySerial.write(0x30);
    mySerial.write(0x30);
    mySerial.write(0x32);
    mySerial.write(0x7E);

So far I have not had any luck.
I know you guys discussed moving the solder jumper to 5V. Did you ever determine if it was ok to leave it at 3.3v?

I think I will try your method. 1 Question though. What pins on the sound module are you connecting to the below Arduino pins.
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

the-rebel-agent

This is my pin setup:

resetPin = 2;  // The pin number of the reset pin.
clockPin = 3;  // The pin number of the clock pin.
dataPin = 4;  // The pin number of the data pin.

Optional in asynchronous playing:
busyPin = 5;  // The pin number of the busy pin.

About the soldered pin, we decided to move to 5V cause we were using Arduino Vcc, that's all. And about that myserial.write, I am pretty sure won't work, since I tried somo-14d source code for this baby and did not work. Hope this helps.

bobafett1

Do you put your wav file in any special folder of are the just sitting on the SD card in not additional folder.

The reason I ask is because with the serial write I was trying, it says to follow the below structure

If you want to control the mp3 player with serial port commands with arduino, first you must put the cof.mp3 file with number 1 inside the advert1 folder.

The busy pin does not tell you when the player stop, is for connecting a blinking led.

This is sample code for playing folder advert01, song 002.mp3 in arduino?

mySerial.print(0x7E,BYTE);
mySerial.print(0x07,BYTE );
mySerial.print(0xB0,BYTE);
mySerial.print(0x30,BYTE);
mySerial.print(0x31,BYTE);
mySerial.print(0x30,BYTE);
mySerial.print(0x30,BYTE);
mySerial.print(0x32,BYTE);
mySerial.print(0x7E,BYTE);

the-rebel-agent

For our sound module, as for somo-14d and compatibles, music/voice files should be stored in the root folder. I read that document you read, but I am pretty sure those instructions are for another sound module. Also, you must be sure about control mode. We bought serial control mode. Did you buy the same control mode?

bobafett1

To be honest with you have have no idea what version I got. I just bought one off of ebay. It looks identical to the one that you guys got, but that does not mean its serial mode

Go Up