Shop OBEX P1 Docs P2 Docs Learn Events
Emic 2 help. — Parallax Forums

Emic 2 help.

babo18babo18 Posts: 5
edited 2014-04-14 17:55 in BASIC Stamp
Hello, I am new to electronics and I am trying to learn on my own. I do fairly well with th basic stamp basics but need some help with Emic 2 board troubleshooting. I cannot get any output from the Emic2 board. I hooked it up as per the instructions (gnd, 5V, sin, sout, and 2 speaker leads) but get no output. The orange led lights during start up and then the green led stays lit. I am using the sample code from the Parallax Emic2 page for the basic stamp. The program executes but I never see the red led light, so I assume there is no communication between the stamp and Emic2. Below is the program I am using.

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


EmicBaud VAR Word
EMIC_TX PIN 0
EMIC_RX PIN 1
Init:
DEBUG CLS, "Emic 2 Text-to-Speech Module Demonstration", CR, CR
EmicBaud = 16468
SEROUT EMIC_TX, EmicBaud, [CR]
SERIN EMIC_RX, EmicBaud, 5000, No_Response, [WAIT(":")]: DEBUG "Ready!", CR '

Main:
DEBUG "Speaking some text..."
SEROUT EMIC_TX, EmicBaud, ["S", "Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song.", CR]
SERIN EMIC_RX, EmicBaud, [WAIT(":")]
PAUSE 500
SEROUT EMIC_TX, EmicBaud, ["D1", CR]
SERIN EMIC_RX, EmicBaud, [WAIT(":")]
DEBUG CR, "Demonstration complete!"
END
'
[ Subroutines ]
No_Response:
DEBUG "Ending demonstration!"
END

I run the program and I get the message:" Emic 2 Text-to-Speech Module Demonstration", followed by a pause(5000), then the message "Ending demonstration!"
I am using p0 and p1 on the basic stamp. I have reversed these just in case I had them in the wrong place, but the result is still the same. I am not sure what I am doing wrong?
Any help would be greatly appriciated.
Thank You.

Comments

  • ercoerco Posts: 20,257
    edited 2014-02-08 20:33
    Welcome to the forums, babo18. Emic2 is a great board. Which Stamp & board (BoE or Homework) are you using? Can you post a photo of your setup?
  • babo18babo18 Posts: 5
    edited 2014-02-08 20:39
    I am using the BS-2 Stamp and the Board of Education.
    IMG_8142.jpg
    1024 x 768 - 102K
  • ercoerco Posts: 20,257
    edited 2014-02-08 20:45
    Thanks for your fast reply! :)

    Just curious, are you sure your Emic board works? Have you ever heard it speak?
  • babo18babo18 Posts: 5
    edited 2014-02-08 20:47
    No, I bought it, took it out of the package and plugged it into the breadboard.
  • ercoerco Posts: 20,257
    edited 2014-02-08 21:47
    I just hooked mine up with the attached code and it worked fine with a BS2 on a BoE. Try this code, just in case you have a typo in your code. It took a lot of cut & paste editing from the Parallax code listing, which opens as a sad jumble of text. NOTE TO PARALLAX ! :)

    Red & green LEDs are both on initially for 2 seconds, then red only while speaking, then green only after speech ends.
    ' ========================================================================= ' ' File....... Emic2_Demo.bs2 ' Purpose.... Demonstration of the Emic 2 Text-to-Speech Module ' Author..... Joe Grand, Grand Idea Studio, Inc. [www.grandideastudio.com] ' E-mail..... support@parallax.com ' Updated.... 14 FEB 2012 '
       ' {$STAMP BS2}
       ' {$PBASIC 2.5} '
       ' =========================================================================
       ' -----[ Program Description ]--------------------------------------------- '
       ' This program provides a simple demonstration of the Emic 2 Text-to-Speech ' Module. Please refer to the product manual for full details of system ' functionality and capabilities. '
       ' -----[ Revision History ]------------------------------------------------ '
       ' 1.0: Initial release '
       ' -----[ I/O Definitions ]-------------------------------------------------
       EMIC_TX PIN 13'  Serial output (connects to Emic 2 SIN)
       EMIC_RX PIN 14 ' Serial input (connects to Emic 2 SOUT)
       ' -----[ Constants ]-------------------------------------------------------
       #SELECT $STAMP
       #CASE BS2, BS2E, BS2PE
       T9600 CON 84
       #CASE BS2SX, BS2P
       T9600 CON 240
       #ENDSELECT
       EmicBaud CON T9600
       ' -----[ Initialization ]--------------------------------------------------
       Init: DEBUG CLS, "Emic 2 Text-to-Speech Module Demonstration", CR, CR ' when the Emic 2 powers on, it takes about 3 seconds for it to successfully ' intialize. it then sends a ":" character to indicate it's ready to accept ' commands. if the Emic 2 is already initialized, a CR will also cause it ' to send a ":" DEBUG "Waiting for Emic 2..."
       SEROUT EMIC_TX, EmicBaud, [CR]
       SERIN EMIC_RX, EmicBaud, 5000, No_Response, [WAIT(":")]
       DEBUG "Ready!", CR ' -----[ Program Code ]----------------------------------------------------
       Main: DEBUG "Speaking some text..."
       SEROUT EMIC_TX, EmicBaud, ["S", "Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song.", CR] ' Send the desired string to convert to speech
       SERIN EMIC_RX, EmicBaud, [WAIT(":")] ' Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
       DEBUG "Done!", CR
       PAUSE 500 ' Short delay DEBUG "Singing a song..."
       SEROUT EMIC_TX, EmicBaud, ["D1", CR] ' Play the built-in demonstration song. See the product manual for exact settings used to create this song.
       SERIN EMIC_RX, EmicBaud, [WAIT(":")] ' Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
       DEBUG "Done!", CR
       DEBUG CR, "Demonstration complete!"
       END
       ' -----[ Subroutines ]-----------------------------------------------------
       No_Response: ' if we get here, it means we did not receive a ":" from the Emic 2
       DEBUG "No response!", CR, CR, "Ending demonstration!"
       END
       ' -----[ End of File ]----------------------------------------------------
    
  • ercoerco Posts: 20,257
    edited 2014-02-08 22:08
    BTW, I tested your code. It works after one modification. I change your line:

    EmicBaud = 16468

    The correct value is 84.
  • babo18babo18 Posts: 5
    edited 2014-02-09 05:19
    Thanks Erco,
    Sorry it took so long to reply, I had to give it up for the night. I used your code and it works great. I agree that the parallax sample code was confusing to decode as printed in the sample. I came up with the number 16468 by an online formula: (1000000/9600)-20, covert to binary, add 1 or 0 to the 13th, 14th,and 15th places, then convert back to a number. I found this formula in multiple places so I assumed it was correct. I really really appriciate your help on this because it was getting very frustrating.
    Thanks Again,
    Babo18 :smile::smile:
  • ercoerco Posts: 20,257
    edited 2014-02-09 08:53
    Happy to help, babo18. Now that your BoeBot can speak, it can sing too. I want a little competition! I used a Robovoice chip here.

    https://www.youtube.com/watch?v=inM04mo9D8Q and
  • babo18babo18 Posts: 5
    edited 2014-02-09 09:33
    Thanks, but I am no where near that level yet.
  • ercoerco Posts: 20,257
    edited 2014-02-09 17:58
    The EMIC2 has better (more intelligible) speech than the RoboVoice chip, and probably better text to speech capability, justifying its higher price.

    Both chips are a lot of fun to play with. As soon as you get speech down, all sorts of new project ideas will pop into your head. Here's one of my faves:
  • KronicKoldKronicKold Posts: 3
    edited 2014-04-14 17:55
    As an update I was able to get ERCO's code to work after I changed line 6 and line 7 to match the pins I used for serial in and out. Just a heads up to anyone following this double check this and it should work.
Sign In or Register to comment.