FN605-M01 MP3 module serial help

Hi all, new to the forum. I am pretty handy with a soldering iron but ever so slowly trying to learn how to code, so please bear with me (my “I’m not a TOTAL idiot” caveat out of the way… :smiley: )

I have hooked up the FN605-M01 which is an MP3 player module. I have it working on a breadboard as in this video:

edit: And here is the datasheet for the module, PDF warning:
http://flyrontech.com/uploadfile/download/2015231028171315.pdf

Now I would like to add an arduino to control the module, and once I have that done, figure out how to get my LCD working to make a little jukebox. I have a Funduino Uno clone. Thus far though, I have not gotten a single serial command to work with the module to control it. I am sure it’s because I am a thorough noob at coding, so here is my example that I WISH would just cycle through the 3 songs I have on the module every 3 seconds to demonstrate that my serial commands are working.

#include <SoftwareSerial.h>
void setup() {
  Serial.begin(9600);
}
void loop() {
 delay(3000);
    Serial.write (0x0002);
    delay(3000);
    Serial.write (0x0003);
    delay(3000);
    Serial.write (0x0001);

 
}

I have a wire from TX on the arduino to DATA pin 8 on the module. Question, do I need to loop the arduino’s grounds to the modules? (I have tried that but it does not work either). Any help will be greatly appreciated, I wasted about 3 hours trying to get a single command to work before making this thread, so I’m not a lazy learner. :slight_smile:

Hello and welcome,

This is not a Serial device as you may think: you can’t use Serial.write. You have to connect the DATA pin to an Arduino digital pin (that you set as output), and then send command to the device, as written in the datasheet ( 3.2.3.Timing Sequence Control ).

On same page there is demo code for sending a command, you have to adapt it to Arduino of course, that shouldn’t be too hard.

Try something like that:

const uint8_t mp3_DataPin = 8; // connect the mp3's data pin to this Arduino pin

void setup()
{
    pinMode( mp3_DataPin, OUTPUT );

    sendMp3Command( 0x0001 ); // play 0001.mp3
}

void loop()
{
}

void sendMp3Command( uint16_t cmd )
{
    digitalWrite( mp3_DataPin, LOW );
    delay( 5 );

    for ( uint8_t i = 0; i < 16; i++ )
    {
        digitalWrite( mp3_DataPin, HIGH );

        if ( cmd & 0x8000 )
        {
            delayMicroseconds( 600 );
            digitalWrite( mp3_DataPin, LOW );
            delayMicroseconds( 200 );
        }
        else
        {
            delayMicroseconds( 200 );
            digitalWrite( mp3_DataPin, LOW );
            delayMicroseconds( 600 );
        }
        cmd <<= 1;
    }

    digitalWrite( mp3_DataPin, HIGH );
}

edit: Nevermind, somehow copy pasted wrong.

OMG that worked, thank you so much! I will try to use your code to figure out the rest, but you have been incredibly helpful, I spent hours on my own trying to figure it out and came nowhere near close. I highly appreciate it! Now I can go to bed at 1:19am. :slight_smile:

The error was because I forgot to put 'void loop() {}' (since it wasn't used in that example). I fixed the code, copy/paste again ;)

There are many different serial protocols, for example SPI, I2C... This one seem to be custom and have no name :P. It's called serial because it send data bits one at a time, on a single data line.

NP, glad it worked ;)

Another question, how come the compiler won't just let me add

  sendMp3Command2( 0x0002 ); // play 0002.mp3

Underneath your first command?

Because the function name is sendMp3Command :P

sendMp3Command( 0x0001 );
delay( 10000 ); // wait 10 seconds
sendMp3Command( 0x0002 );

It's just a test. In your program, avoid using long delays: look the Blink Without Delay example, in the Arduino IDE.

I have created an Arduino Library for the FN605-M01 sound module. You can find it at:

https://github.com/kstephens99/FN605

I hope it helps and please report any bugs as it is a brand new library.