Introduction: Interfacing TDB380 Mp3 Module With Arduino

Picture of Interfacing TDB380 Mp3 Module With Arduino


The TDB380 is a great little module with built in SD card holder and several different methods of control for intergrating with arduino projects. I am using two of these modules in serial mode for my open source pinball machine and they are so easy to use. In the following pages i shall show you how to wire up these units and do basic serial control.

Step 1: Wiring Up the Circuit

Picture of Wiring Up the Circuit

To wire up the TDB380 start by connection a GND from the arduino to both the GND pint of the TDB380 and the Jack output.
To power the TDB380 i simply used the 5V Out from the arduino as it will take anything from 5v-30v input, not just the 12v as shown on the diagram.
One the device is powered the HPL and HPR can be connected to the two connectors on the mini jack. If you only require a mono signal you can connect them both to a single pole on the mini jack but note this will give for ja quieter output.

For a serial connection between the two devices i used the built in serial ports to the arduino but a library such as newsoftserial could be used to free up the ports for usb>serial communication between a pc and arduino. Please note that the attatched image from the TDB380 Datasheet is slightly wrong and you should infact connect the RX arduino pin to the TX TDB380 and and the TX Arduino pin to the RX TDB380 pin as the data transmitted on the arduino TX needs to be recived on the TDB380 RX.

Finally i connected the BUSY pin on the TDB380 back into a digital pin of the arduino. This is used to detect if the TDB380 is already playing a file. When it is an LED is lit and this line is held LOW. I also connected a ressitor between the busy pin and ground as i was having problems with it not realising when the device was no longer busy

Step 2: The Code


Here is a really simple peice of code for the arduino. It first initializes a serial connection with the TDB380 at 4800 Baud, Sends a command to stop playing any files, thus resetting the board. Then each cycle it checks to see if the TDB380 is busy and if not is plays a random file. It is important to leave a short delay after commands as it takes a while for the TDB380 to react.

For a full list of commands available see the datasheet: http://www.thaieasyelec.net/archives/Manual/TDB380%20datasheet%20V2%5B1%5D.0%20.pdf



const int busyPin = 2; // the number of the Busy pin



void setup() {
// initialize the serial communication:
Serial.begin(4800); //Set to 4800 bps
Serial.print(0xEF, BYTE); // Reset board
delay(2000);
pinMode(busyPin, INPUT);
}

void loop(){
if (digitalRead(busyPin) ==LOW) {
//device busy
}
else {
Serial.print(0x00, BYTE); // Play Random file
delay(5000);
}
}

Step 3: App Note

The tdb830 is very particular about the file structure used.
See pages 10-12 of the follwing doccument for more information on this and other serial commands available on this device:

http://www.echelleinconnue.net/outils/mobio/composants/TDB380_datasheet_V2_%28Tenda_Electronics%29.pdf

Comments

redfuse (author)2012-11-01

Nice instructable!
I have one question: where did you get the TDB380? I can't find it anywhere on sale. Thanks!

edkitch (author)redfuse2012-11-03

Ebay

About This Instructable

10,963views

5favorites

License:

More by edkitch:Interfacing TDB380 Mp3 Module With Arduino
Add instructable to: