Shop OBEX P1 Docs P2 Docs Learn Events
MP3 PLAYER using basic stamp 2 - Page 2 — Parallax Forums

MP3 PLAYER using basic stamp 2

24

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    Ron snagged my answer. I have already created an MP3 player with a VMusic2 Module, which I later gave away in TFOTTJB on my old website. I was toying with the idea of making a more robust one with the VMusic3 and a Propeller chip, but the BS2 could be used.
  • PublisonPublison Posts: 12,366
    edited 2016-06-20 16:19
    The CY-T16 command set looks harder to use than the VMUSIC2/3. But being in the Philippines, they may not have access to VMUSIC items. But it still could be done. I have not seen any BS2 code available for the CYT16.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    A quick look and I don't see any reason why the BASIC Stamp 2 couldn't be an MP3 player using that CY-T16 module.
  • A quick look and I don't see any reason why the BASIC Stamp 2 couldn't be an MP3 player using that CY-T16 module.

    Sir Chris do you think can u help us doing it with basic stamp 2? just an initial codes for me and cydelcamat to start our project..? TIA
  • Hi guys thanks again for the reply. Our problem now is we don't know on how to start the initial process of the program using basic stamp 2. We know on how the system will work and its process because we created the visual basic program in able for the user to access the system. Our old microcontroller is written in assembly language to control the CY-T16 module. Its hard for us to rewrite again the whole process using basic stamp 2. We just need to know on how the bs2 to control the CY-T16 module.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    Sir Chris do you think can u help us doing it with basic stamp 2? just an initial codes for me and cydelcamat to start our project..? TIA

    I'm sorry, but I do not have the available resources to assist you in development of this project. To be honest re-reading some of the posts (seems there was more than one thread), I am unclear if you're using an MP3 decoder IC or a module such as: http://cashway.en.alibaba.com/product/1566099870-803056631/32GB_SD_Card_CY_T16_MP3_Player_Module_RS232_Control.html

    My comment was based on a module with a serial interface. As has been done with the VMusic 2 most serial MP3 modules can be controlled by the BASIC Stamp MCU. However if you're using a decoder IC by itself then the BS2 just doesn't have the resources to realize something like this.

    I see someone linked a post by Scary Terry using the VMusic 2 with a BS2. If you're using a serial interface module that would be the best example on how one might go about this on a BS2. I would link my application, but I do not yet have all content back up on my website at this time.
  • PublisonPublison Posts: 12,366
    edited 2016-06-21 17:57
    See next
  • PublisonPublison Posts: 12,366
    edited 2016-06-21 18:10
    Based on the attached file, all you have to do is issue serial commands to play, (SEROUT)etc.

    Such as Playback "7E FF 06 0D 00 00 00 FE EE EF "

    The default baud is 9600. The BS2 can send at 9600, but may have problems receiving at the rat. The module is supposed to be able to select baud rates, but I could not find and instructing to allow you to drop down to 4800.

    The module is nor supported very well as a whole on the internet. It may have been cheap, but there are more supported modules out there like the VMUSIC 2/3 that have code for the BS2.
    .
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2016-06-21 18:24
    Publison,

    There seems to be this stigma with the BS2 and serial data reception at 9600 bps. In every application where I am communicating with the BS2 serially an the device supports it, I use 9600 baud and it has always worked flawlessly. The BS2 has no issues sending or receiving data at 9600 baud.

    The issues happen when you start using certain formatters on the data which takes more time to process or if the data is coming in at a constant rate with no breaks. Neither of these situations are typical, yet everyone has just defaulted to warning that the BS2 can't receive well at 9600 bps. We should not propagate that stigma. :cool:
  • PublisonPublison Posts: 12,366
    edited 2016-06-21 19:50
    I was just echoing Mike Green's comment:
    Be careful to keep the SERIN statements simple since the Basic Stamp is slow and the SERIN statement is marginal at 9600 Baud (it can miss characters).

    Working send/receive at 9600 would work for the OP>
  • The issues happen when you start using certain formatters on the data which takes more time to process or if the data is coming in at a constant rate with no breaks.
    The SERIN formatters really impressed me when I first read the PBASIC manual and I was disappointed when I learned that you have to be very careful using them because of data overrun problems. This is where a Propeller-based Stamp could really help.

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    David,

    The BS2p really excels here because not only is it faster, but you have the option to grab up to 126 bytes of data directly into SPRAM and deal with it from there. The BASIC Stamps can handle a lot more than people give them credit for, but formatting the incoming data stream can hinder performance. That and there's not a lot of variable space on a BS2 to deal with large chunks of incoming serial data.

    Still, Parallax has made devices using the AppMod connector that ran at 19.2K and responded at that rate as well, just fine. Of course, you're dealing with relatively small packets of data. :nerd:
  • David Betz wrote: »
    The SERIN formatters really impressed me when I first read the PBASIC manual and I was disappointed when I learned that you have to be very careful using them because of data overrun problems. This is where a Propeller-based Stamp could really help.

    The good news is that some formatters (HEXn and DECn) work just fine at 9600. WAIT and WAITSTR don't.

  • David,

    The BS2p really excels here because not only is it faster, but you have the option to grab up to 126 bytes of data directly into SPRAM and deal with it from there. The BASIC Stamps can handle a lot more than people give them credit for, but formatting the incoming data stream can hinder performance. That and there's not a lot of variable space on a BS2 to deal with large chunks of incoming serial data.

    Still, Parallax has made devices using the AppMod connector that ran at 19.2K and responded at that rate as well, just fine. Of course, you're dealing with relatively small packets of data. :nerd:
    The fact that there is not a lot of variable space on the BS2 is why I thought that the SERIN formatters were so clever. They allow you to handle fairly complex strings without having to buffer all of the characters.

  • cydelcamat wrote: »
    Hi guys thanks again for the reply. Our problem now is we don't know on how to start the initial process of the program using basic stamp 2. We know on how the system will work and its process because we created the visual basic program in able for the user to access the system. Our old microcontroller is written in assembly language to control the CY-T16 module. Its hard for us to rewrite again the whole process using basic stamp 2. We just need to know on how the bs2 to control the CY-T16 module.

    Could you post the PIC code so we could take a look at it? That could be a start.



  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    cydelcamat wrote: »
    Hi guys thanks again for the reply. Our problem now is we don't know on how to start the initial process of the program using basic stamp 2. We know on how the system will work and its process because we created the visual basic program in able for the user to access the system. Our old microcontroller is written in assembly language to control the CY-T16 module. Its hard for us to rewrite again the whole process using basic stamp 2. We just need to know on how the bs2 to control the CY-T16 module.

    You refer to it as a module...do you have a link to the exact product you purchased? That would also help.

    :cool:
  • cydelcamat wrote: »
    Hi guys thanks again for the reply. Our problem now is we don't know on how to start the initial process of the program using basic stamp 2. We know on how the system will work and its process because we created the visual basic program in able for the user to access the system. Our old microcontroller is written in assembly language to control the CY-T16 module. Its hard for us to rewrite again the whole process using basic stamp 2. We just need to know on how the bs2 to control the CY-T16 module.

    You refer to it as a module...do you have a link to the exact product you purchased? That would also help.

    :cool:

    http://www.cashwaytechnology.com/eproducts/72.html here's the link for the module Mr. Chris Savage.
  • Publison wrote: »
    cydelcamat wrote: »
    Hi guys thanks again for the reply. Our problem now is we don't know on how to start the initial process of the program using basic stamp 2. We know on how the system will work and its process because we created the visual basic program in able for the user to access the system. Our old microcontroller is written in assembly language to control the CY-T16 module. Its hard for us to rewrite again the whole process using basic stamp 2. We just need to know on how the bs2 to control the CY-T16 module.

    Could you post the PIC code so we could take a look at it? That could be a start.




    Is there any other way to start? because the source codes for pic is saved in dos computer and we dont have a floppy disk drive as of now.
  • kwinnkwinn Posts: 8,697
    cydelcamat wrote: »
    Publison wrote: »
    cydelcamat wrote: »
    Hi guys thanks again for the reply. Our problem now is we don't know on how to start the initial process of the program using basic stamp 2. We know on how the system will work and its process because we created the visual basic program in able for the user to access the system. Our old microcontroller is written in assembly language to control the CY-T16 module. Its hard for us to rewrite again the whole process using basic stamp 2. We just need to know on how the bs2 to control the CY-T16 module.

    Could you post the PIC code so we could take a look at it? That could be a start.




    Is there any other way to start? because the source codes for pic is saved in dos computer and we dont have a floppy disk drive as of now.

    Of course there is another way, and based on the data sheet information this chip should work just fine for playing back MP3 files from an SD card. No doubt that the BS2 can send serial commands to control the CY-T16 V1.0 either. To get some idea of how to proceed we need to figure out if the BS2 has enough memory for the program and schedules, and if a Real Time Clock chip is needed for the scheduling.

    So, how many events need to be stored, and do you need a clock chip?
  • Publison wrote: »
    Based on the attached file, all you have to do is issue serial commands to play, (SEROUT)etc.

    Such as Playback "7E FF 06 0D 00 00 00 FE EE EF "

    The default baud is 9600. The BS2 can send at 9600, but may have problems receiving at the rat. The module is supposed to be able to select baud rates, but I could not find and instructing to allow you to drop down to 4800.

    The module is nor supported very well as a whole on the internet. It may have been cheap, but there are more supported modules out there like the VMUSIC 2/3 that have code for the BS2.
    .

    Mr.Publison, my question is bs2 can send that hexadecimal command? and how we can send that hexadecimals from bs2 to CY-T16 v1.1?? can u give us a sample for that? TIA
  • yes we do have gps module for the real time clock. I've already knew the process on how the basic stamp 2 receive data from gps. We need to export and save songs to the mp3 and sync the schedule so the device will compare its schedule to gps data time. that is all the process we need for the mp3 module.
  • PublisonPublison Posts: 12,366
    edited 2016-06-22 14:24
    Publison wrote: »
    Based on the attached file, all you have to do is issue serial commands to play, (SEROUT)etc.

    Such as Playback "7E FF 06 0D 00 00 00 FE EE EF "

    The default baud is 9600. The BS2 can send at 9600, but may have problems receiving at the rat. The module is supposed to be able to select baud rates, but I could not find and instructing to allow you to drop down to 4800.

    The module is nor supported very well as a whole on the internet. It may have been cheap, but there are more supported modules out there like the VMUSIC 2/3 that have code for the BS2.
    .

    Mr.Publison, my question is bs2 can send that hexadecimal command? and how we can send that hexadecimals from bs2 to CY-T16 v1.1?? can u give us a sample for that? TIA

    Have you downloaded the Basic Stamp Toolkit?

    https://www.parallax.com/downloads/basic-stamp-editor-software-windows

    It includes the Basic Stamp Manual in the help menu. Look under SEROUT. It shows it has a HEX qualifier for output.

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    I like how the web page description refers to it as RS-232 serial, when clearly it is a logic level serial interface.
  • I like how the web page description refers to it as RS-232 serial, when clearly it is a logic level serial interface.

    As far as I can tell, it is not a module that is supported very well.


  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    Yeah, all the more reason to switch to one that is supported and has example code for it already. :cool:
  • ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    A VAR Byte
    B VAR Byte
    C VAR Byte
    D VAR Byte
    E VAR Byte
    F VAR Byte
    G VAR Byte
    H VAR Byte
    I VAR Byte
    J VAR Byte

    A = $7E
    B = $FF
    C = $06
    D = $0F
    E = $00
    F = $01
    G = $01
    H = $FF
    I = $E6
    J = $EF

    SEROUT 16,84,[A,B,C,D,E,F,G,H,I,J]


    Is this possible that our CY T16 MP3 module will accept this codes from basic stamp 2? Attached file is the list of the serial commands examples for our MP3 module. Please see attachment.

    1480 x 658 - 55K
  • You can include the constants directly in the SEROUT statement like:

    SEROUT 18,84,[$7E,$FF,$06,$0F,$00,$01,$01,$FF,$E6,$EF]

    You can also mix constants and variables. You can also send 16 bit words as two bytes (LSB,MSB). The Stamp Manual has examples of all the various options.
  • Best way to find out how well a Stamp will work for you would be to connect a BS2 and your MP3 module and experiment. Try sending some straightforward commands to the module, enough to select one track and play it ... then see what happens. Maybe you can try one of your existing PIC controllers and compare the signal to the module using the PIC to play one track vs the BS2.
  • Yes sir we'll try first to send this commands to our mp3 module. We will update as soon as possible. Thanks you guys!
  • cydelcamatcydelcamat Posts: 53
    edited 2016-06-28 05:52
    Hi guys im back again, can you check this codes guys?

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    '----Variables
    receive VAR Byte
    song100 VAR Byte
    song010 VAR Byte
    song001 VAR Byte
    command VAR Byte

    '----Constant
    play CON $7E
    puse CON $A1
    playPuse CON $A2
    stp CON $A3
    volAdj CON $A4
    f10 CON $30
    f01 CON $31
    start CON $7E
    datLen CON $07
    baud CON 9213



    '
    I/O Definitions----

    send PIN 0

    '
    Main Program
    DO
    'DEBUG "enter song hundred example song name 100.mp3 enter 1",CR
    'DEBUGIN DEC1 receive
    song100 = "0"
    'DEBUG "enter song tens example song name 010.mp3 enter 1",CR
    'DEBUGIN DEC1 receive
    song010 = "0"
    'DEBUG "enter song ones example song name 001.mp3 enter 1",CR
    'DEBUGIN DEC1 receive
    song001 = 3
    DEBUG "enter 5 to play song",CR
    DEBUGIN DEC1 receive
    DEBUG ? song100,CR
    DEBUG ? song010,CR
    DEBUG ? song001,CR

    IF receive = 5 THEN
    GOSUB Play1
    ENDIF
    LOOP

    Play1:
    SEROUT 0,84,[$7E,$FF,$06,$0F,$00,$01,$01,$FF,$E6,$EF]
    DEBUG HEX2 start,HEX2 datLEn,HEX2 play,HEX2 f10,HEX2 f01,HEX2 song100,HEX2 song010,HEX2 song001,HEX2 start,CR,CR
    RETURN
Sign In or Register to comment.