How to play Audio files using Flowcode V & Arduino

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
mikey89ryan
Posts: 8
Joined: Sun Oct 25, 2015 2:29 pm
Has thanked: 1 time

How to play Audio files using Flowcode V & Arduino

Post by mikey89ryan »

Hello
My name is Michael. I am in the 3rd year of college studying Automation and robotic systems as a mature student. I am building an Automated model drawbridge for my final year project.
I wish to have an audible alarm sound before my drawbridge operates so I purchased a DF player and a SD card to integrate with my Arduino. I am using Flowcode V to programme the whole thing.
I cannot find any info or an example as to how to play an audio file using flowcode V. I am wondering does anybody know anyplace I could find afew examples or tutorials or somebody that has been successful in doing the same using an Arduino and Flowcode V.
Any help would be Grrreat!!!
Thank you!

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

Re: How to play Audio files using Flowcode V & Arduino

Post by acestu »

Hi Michael,

Welcome to the Flowcode forums, can you post the data sheet for your DF player, and any info that you have, this will enable us to help you further.

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

mikey89ryan
Posts: 8
Joined: Sun Oct 25, 2015 2:29 pm
Has thanked: 1 time

Re: How to play Audio files using Flowcode V & Arduino

Post by mikey89ryan »

Hi Stuart.
This is all the info I could find.

•Supported sampling rates (kHz): 8/11.025/12/16/22.05/24/32/44.1/48
•24 -bit DAC output, support for dynamic range 90dB , SNR support 85dB
•Fully supports FAT16 , FAT32 file system, maximum support 32G of the TF card, support 32G of U disk, 64M bytes NORFLASH
•A variety of control modes, I/O control mode, serial mode, AD button control mode
•Advertising sound waiting function, the music can be suspended. when advertising is over in the music continue to play
•Audio data sorted by folder, supports up to 100 folders, every folder can hold up to 255 songs
•30 level adjustable volume, 6 -level EQ adjustable[attachment=0]PlayerMini_EN.png
Attachments
550px-Miniplayer_pin_map.png
(97.87 KiB) Downloaded 13154 times
PlayerMini_EN.png
(64.26 KiB) Downloaded 13154 times

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

Re: How to play Audio files using Flowcode V & Arduino

Post by acestu »

Hi Mikey,

These commands are on the same page as your diagram:

dfp2.png
(33.49 KiB) Downloaded 13130 times
dfp3.png
(27.53 KiB) Downloaded 13130 times

So if you know how to connect it, its just a case of sending it serial commands from your Flowcode chart.

cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

Re: How to play Audio files using Flowcode V & Arduino

Post by acestu »

Hi Mikey,

I have just found the datasheet by searching on google:
DFPLAYER_MINI.PDF
(1.14 MiB) Downloaded 959 times

cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

mikey89ryan
Posts: 8
Joined: Sun Oct 25, 2015 2:29 pm
Has thanked: 1 time

Re: How to play Audio files using Flowcode V & Arduino

Post by mikey89ryan »

Thanks all. I will have a look at this at a later time. The exams are nearly here so iv had to put away the project until the xmas.
I will update as soon as I can.
Thank you for your help!!!

mikey89ryan
Posts: 8
Joined: Sun Oct 25, 2015 2:29 pm
Has thanked: 1 time

Re: How to play Audio files using Flowcode V & Arduino

Post by mikey89ryan »

Hey Stuart.
When I am sending serial commands to the chip have I to call a component on the flowcode menu like the FAT or the MIDI. Or am I sending it as an output to the RX or TX pins. Then which one?.
Regards
Mike

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

Re: How to play Audio files using Flowcode V & Arduino

Post by acestu »

Hi Mikey,

Use the rs232 component in the comms menu to send and receive your serial commands.

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

mikey89ryan
Posts: 8
Joined: Sun Oct 25, 2015 2:29 pm
Has thanked: 1 time

Re: How to play Audio files using Flowcode V & Arduino

Post by mikey89ryan »

Hey Stuart
was having a play around with it today and no luck yet. it has to be my programming. :o . So I followed the manual and used the serial code it gives in the 2nd example as that's how I have the audio file saved on the SD card. Folder is called 01 and the file is named 001.mp3
DF player 1.PNG
(40.5 KiB) Downloaded 12172 times

I used exactly these serial commands and then did the following on flowcode. It doesn't include the last 4 serial commands in my picture as I couldn't fit them in but its as it is in the example
DF player 1.PNG
(40.5 KiB) Downloaded 12172 times
What do you think?
Also does it matter what kind of speaker I use. I was using a 32 watt that came from a 230v set?. I'm abit confused when it comes to speakers
Attachments
DF player 2.PNG
(18.12 KiB) Downloaded 12172 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: How to play Audio files using Flowcode V & Arduino

Post by kersing »

1) Looking at the snippets of the documentation in your message you are only specifying the file, should you not issue a play command as well?
2) The documentation lists FF between 7E and 06 and your code seems to be missing it.
3) What values are you sending in the last three bytes?
4) If your flowchart is too large to fit in the screen shot you can attach it to the message so we can see all of the code.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

mikey89ryan
Posts: 8
Joined: Sun Oct 25, 2015 2:29 pm
Has thanked: 1 time

Re: How to play Audio files using Flowcode V & Arduino

Post by mikey89ryan »

The last four serial commands
DF player 3.PNG
(18.52 KiB) Downloaded 12163 times
this might help also
DF player 4.PNG
(32.21 KiB) Downloaded 12163 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: How to play Audio files using Flowcode V & Arduino

Post by kersing »

Should the last byte not be 0xEF?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

mikey89ryan
Posts: 8
Joined: Sun Oct 25, 2015 2:29 pm
Has thanked: 1 time

Re: How to play Audio files using Flowcode V & Arduino

Post by mikey89ryan »

yes you are correct. I made a couple of errors in it I have fixed them but still nothing

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

Re: How to play Audio files using Flowcode V & Arduino

Post by acestu »

Hi Mikey,

Can you post the Flowcode file that you have and then someone can have a look at it for you.

cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

hiromiyureei
Posts: 1
Joined: Sat Dec 19, 2015 10:10 pm

Re: How to play Audio files using Flowcode V & Arduino

Post by hiromiyureei »

Hello to everybody I'm trying to program the same df player but without results is certainly a programming error you have found a solution thanks to all

User avatar
Bachman
Posts: 116
Joined: Sun Sep 07, 2014 11:37 am
Location: Hungary
Has thanked: 9 times
Been thanked: 53 times

Re: How to play Audio files using Flowcode V & Arduino

Post by Bachman »

What is the problem exactly? You have to send 9 bytes to control the player. Here is some example:

Play: 7e,ff,06,0d,00,00,00,fe,ee,ef
Pause: 7e,ff,06,0e,00,00,00,fe,ed,ef
Stop: 7e,ff,06,11,00,00,00,fe,ea,ef
Next: 7e,ff,06,01,00,00,00,fe,fa,ef
Previous: 7e,ff,06,02,00,00,00,fe,f9,ef

Play first file: 7e,ff,06,03,00,00,01,fe,f7,ef

Volume 1/30: 7e,ff,06,06,00,00,01,fe,f4,ef
Volume 5/30: 7e,ff,06,06,00,00,05,fe,f0,ef
Volume 10/30: 7e,ff,06,06,00,00,0a,fe,eb,ef

// 7E FF 06 0F 00 01 01 xx xx EF
// 0 -> 7E is start code
// 1 -> FF is version
// 2 -> 06 is length
// 3 -> 0F is command
// 4 -> 00 is no receive
// 5~6 -> 01 01 is argument
// 7~8 -> checksum = 0 - ( FF+06+0F+00+01+01 )
// 9 -> EF is end code

Post Reply