interfacing with mp3 player

Dear List,

I'm trying to control this mp3 board with my arduino: http://www.tendaelectronics.com/?action=wareshow|tenda|128|en|257,427|427#

I want to control this one by serial remote. This module work in 4 modes, one is serial mode. This is the datasheet : http://www.google.fr/url?sa=t&source=web&cd=1&ved=0CBUQFjAA&url=http%3A%2F%2Fwww.thaieasyelec.net%2Farchives%2FManual%2FTDB380%2520datasheet%2520V2%255B1%255D.0%2520.pdf&ei=tz5RTLf4BMaS4Ab1hryVAw&usg=AFQjCNFkU7VGp34T_LqxVLSgQSxjtfjwSA

But it doesn't work, doing only glitch sound. I use some Serial.write in my program with the command number to select/play/stop a mp3 but only noise...like starting again and again the track...

Do you know: -How to connect correctly this board (busy is to do what ?) -Sending serial.write message is the right solution ?

this is my minimalist code:

int count;

void setup(){
  count=0;
  Serial.begin(4800);
}

void loop(){
  Serial.write(239);//stop playing
  if(count==0){
    Serial.write(001);//play track number 1
    count++;
  }
}

Thanks a lot for your help !

T.

up

Please don't "up" or "bump" unless you have something new to add. This discussion forum is used by people in nearly every time-zone around the planet. You need to be more patient. You also need to complete the profile so we know where you are, etc.

Yes i know, sorry, my personal definition is impatience :) but the time left so fast!

But that is exactly what your code tells it to do. So it looks like the board is working perfectly.

mmmm...i believe that my count passed from 0 to 1 and that's all... so the 001 track would play once time and stop. When i try to do only :

if(count==0){
    Serial.write(001);//play track number 1
    count++;
  }

in the loop, it's happen the same thing...

Busy is there so your code can see if the board is busy playing an MP3 or not. If you don't test that pin and wait for it, then you will play only the first tiny part of an MP3.

mmm...great thanks a lot for that tips ! This pin give me something like this:

1

1

ï0

ï0

ï1


0

ï0

ï0

ï1

.... when i read from a digital input. I need to play my track when busy is on 0...?

Yes. But you are incrementing count, but only sending "001" over and over.

I changed my code to :

//So in terms of output Serial.print(val,BYTE) and Serial.write(val) are functionally identical. 

int count = 0;
int busy = 4;
int val = 0;

void setup(){

  Serial.begin(4800);
  pinMode(busy, INPUT);
}

void loop(){
  val = digitalRead(busy);
  Serial.println(val);
  delay(1000);
  
  if(val==1){
    delay(1000);
    if(count==0){
      Serial.write(001);//play track number 1
      count++;
    }
  }
  else{
    Serial.write(239);//stop playing
  }
  Serial.print("count = ");
  Serial.println(count);
  delay(1000);
}

At the moment it doesn't working...

Thanks answer me Richard,

I’m using a classic duemilanove Arduino with atmega 328.
Ok, i think i’m using the same TX and RX for the mp3 player than for the USB port (pin number 0 and 1 on the Arduino).
So, i need to declare another serial port to talk to the mp3 device…?

May i need to use a library like NewSoftSerial to do that ?
something like this ? :

#include <NewSoftSerial.h>
#define RXPIN 3 
#define TXPIN 2
#define MP3BAUD 4800

NewSoftSerial MP3(RXPIN, TXPIN);

MP3.begin(MP3BAUD);

Many Thanks !

I’m trying to use le NewSoftSerial library in this way to control my mp3 player board :

#include <NewSoftSerial.h>
#define RXPIN 2 
#define TXPIN 3
NewSoftSerial mp3(RXPIN, TXPIN);

void setup()  
{
  Serial.begin(4800);
  mp3.begin(4800);
}

void loop(){
  while(mp3.available()){
    Serial.println("ok");
    mp3.print(233, BYTE);//augmente le volume
    delay(1000);
    mp3.print(241, BYTE);//to folder
    delay(1000);
    mp3.print(001, BYTE);//play 1
    delay(1000);
    mp3.print(002, BYTE);//play 2
    delay(1000);
    mp3.print(239, BYTE);//stop
    delay(1000); 
  }
}

But my tiny mp3 board doesn’t want to make any noise…
Where is the bug…?
The TX from the TDB380 (MP3 board) is connected to the pin 2 on the Arduino, and the RX from the TDB380 is coonnected to the pin 3 on the Arduino.
My TDB380 is running, the power led is brighting but not the busy led…mmm, where is the bug?

Thanks in advance !

Hello

First off I would not issue the stop command as it looks like the device will execute all those commands right away so even if it started to Play it would Stop before you heard it.

also swap the TX and RX pins to make sure the terminology isn't getting you. It is really not clear from what perspective the terms RX and TX are defined. Swapping, even if wrong should not damage anything

I have used a VMUSIC2 module with the arduino which is somewhat similar, but was thinking of trying one of these as they are less expensive.