Shop OBEX P1 Docs P2 Docs Learn Events
Do I have a defective EMIC Text to Speech Module? — Parallax Forums

Do I have a defective EMIC Text to Speech Module?

latigerlillylatigerlilly Posts: 114
edited 2007-03-30 15:24 in BASIC Stamp
Hi guys,

I finally got my EMIC text to speech module to work. However, it works sporadically. Sometimes, I type in the phrase and it says nothing. It may take two tries for it to successfully say a phrase. Sometimes, I type in the phrase, but instead of saying this phrase, it re-states the last phrase that I typed instead of the current phrase that I just typed. Is this a defective EMIC text to speech module, or am I doing something wrong? If I am doing something wrong, please tell me what. The following is a schematic and programming code of what I did.

Thanks a million,
Lilly.

Schematic:
pinktts.gif

Code is from PINK manual pg 12-14. The only change that I've made is increase the initialization PAUSE from 200 ms to 4000 ms to allow enough time for PINK to get on the network:

' PINK_07.bsp
' {$STAMP BS2p}
' {$PBASIC 2.5}
' Parallax Inc. Tech Support: support@parallax.com

' Ethernet -> Web -> Speech interface for Netburner Module
' This code is for interfacing a Basic Stamp 2p microcontroller
' with a PINK module (#30013) and an EMIC text-to-speech module (#30006)
' In addition to this code, HTML for the web interface is required.
' Users can then browse to a web page, type in ASCII text, and have the text
' spoken by the EMIC module.
'

'
'VARIABLES
'
UPREG VAR Byte
NBSTATUS VAR Byte 'Will hold the status of the PINK module
NewPost VAR NBSTATUS.BIT1 'Bit that indicates if the PINK has been updated
'via a POST (the PostSTATUS variable holds the actual
'variable location, NewPost only indicates if a POST
'update has been made or not.

Tx PIN 3 'Connect BS2P pin3 to TX on EMIC
Rx PIN 4 'Connect BS2P pin4 to RX on EMIC
Busy PIN 5 'Connect BS2P pin5 to BUSY on EMIC
Rst PIN 6 'Connect BS2P pin6 to /RESET on EMIC

EOM CON $AA 'End of Message indicator for EMIC strings
vol CON 5 'Used to set the volume of the EMIC
ptch CON 1 'Used to set the pitch of the EMIC
spd CON 1 'Used to set the speed of the EMIC

eePntr VAR Byte 'Pointer used for Scracth Pad RAM
char VAR Byte
x VAR Byte

'
'INITIALIZATION
'
PAUSE 4000 'Allow PINK time to get up & on the network

'
'MAIN
'
GOSUB Hard_Reset
PAUSE 2000
GOSUB Set_Voice

MAIN: 'The main program loop
PAUSE 300 'pause for serial reads/writes (PINK)
SEROUT 8,240,[noparse][[/noparse]"!NB0ST"] 'Poll for webpage update by sending a request
SERIN 7,240,100,MAIN,[noparse][[/noparse]NBSTATUS] 'for the state of the status register (PINK)
IF NewPost = 1 THEN speak 'Check for update from web interface
GOTO MAIN 'Check everything again!
END

'
'Subroutines
'

speak:
SEROUT 8,240,[noparse][[/noparse]"!NB0R04"]
SERIN 7, 240, 30, Say_String, [noparse][[/noparse]SPSTR 64]
GOSUB Say_String
RETURN

Hard_Reset:
LOW Rst
PAUSE 2
INPUT Rst
GOSUB Wait_OK
RETURN

Wait_OK:
SERIN Rx, 1021, 6000, TO_Error, [noparse][[/noparse]WAIT($55)]
RETURN

TO_Error:
DEBUG CLS, "EMIC module did not initialize correctly."
GOTO MAIN

Check_Busy:
PAUSE 1
DO WHILE (Busy = 1) : LOOP
RETURN

Say_String:
eePntr = 0
OUT0 = 1
SEROUT Tx, 1021, [noparse][[/noparse]$00]
DO
GET eePntr, char
SEROUT Tx, 1021, [noparse][[/noparse]char]
eePntr = eePntr + 1
LOOP UNTIL (char = CLS)
SEROUT Tx, 1021, [noparse][[/noparse]$AA]
GOSUB Check_Busy
RETURN

Set_voice:
GOSUB Check_Busy
SEROUT Tx, 1021, [noparse][[/noparse]$01, DEC vol, $AA]
GOSUB Wait_OK
SEROUT Tx, 1021, [noparse][[/noparse]$03, DEC ptch, $AA]
GOSUB Wait_OK
SEROUT Tx, 1021, [noparse][[/noparse]$02, DEC spd, $AA]
GOSUB Wait_OK
RETURN

Comments

  • latigerlillylatigerlilly Posts: 114
    edited 2007-02-26 09:49
    HTML of the webpage used for the above set-up:

    <html>
    <head>

    </head>

    <body>

    <big><b><center>Pink Experimental Webpage</center></b></big>

    The value of variable 04 is: <Nb_var04>

    <FORM method="post" action="/experwebpage.html" enctype="text/plain">
    <P>
    What value would you like stored in variable 04?
    <INPUT name="Nb_var04" type="text" size="64" maxlength="64">
    <INPUT type="submit" value="Speak">
    </P>
    </FORM>

    </body>
    </html>
  • ZootZoot Posts: 2,227
    edited 2007-02-26 13:42
    I would break things down to see where the failure is.....

    First, run the sample EmicTTS demo program from Parallax. You may need to change PIN assignments in that program of course. If that program runs the Emic perfectly, then you know it's something with your code and/or your interface to the Pink. If it doesn't, triple check the EmicTTS program for pin assigments, etc., and if you're good, it's possible there's a problem with your Emic.
    If it does run, then make some changes to that program to speak different phrases. If it works fine, then you can be confident it's your setup and not the Emic.

    Then I would remove the Pink interface stuff and just use DEBUGIN to "capture" the phrase you want to speak (where you import <=64 characters to the scratch pad). If *that* works, then you know it's the code where grab data from the PINK.

    At least this way you can begin to narrow down where the problem is occuring.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • latigerlillylatigerlilly Posts: 114
    edited 2007-02-26 15:57
    Dude, this IS the sample EMIC TTS demo program from Parallax. The PIN assignments are the same, too. As mentioned in my post, everything is the same as instructed on pages 12-14 of the PINK manual. The problem is not phrase specific.

    P.S. Zoot, I think I might have sounded a bit rude in this post. I did not mean to do so. I was smiling when I posted it (promise). Anyways, I just wanted to say that you are MOST appreciated. I will take a nap, wake up refreshed, then tackle this monster again. Thanks again. UR too cool.gif . yeah.gif

    Post Edited (latigerlilly) : 2/26/2007 4:44:43 PM GMT
  • ZootZoot Posts: 2,227
    edited 2007-02-26 16:02
    Dudette -- I meant the simple EmicTTS that does not use the Pink code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-02-26 16:39
    Typical causes of sporadic success include lack of a common ground, as well as missing pull-up resistors on lines that need them. As well as trying to use "too much distance" between signal 'senders' and signal 'recievers'. As well as marginal power supplies/batteries, which are so close to the edge of working that a slight power-surge (like driving a speaker) forces a reset.

    Trying to supply Vdd over too long a distance can cause this, too.

    I can't tell from your descriptions which of the above may or may not be happening, since I don't know how far away your EMIC module is from your PDB. And since you simply have that single line to "Vss", it's hard to know what's common and what isn't.

    Oh, and you do "LOW RESET", pause a bit, then do "INPUT RESET" -- which makes the "RESET" line high-impedance, which means 60 Hz noise could reset the EMIC.· If you're going to do that, the EMIC /Reset line definitely needs a 10 Kohm pullup to Vdd.

    Post Edited (allanlane5) : 2/26/2007 4:43:35 PM GMT
  • latigerlillylatigerlilly Posts: 114
    edited 2007-02-26 17:09
    allanlane5,

    What do you mean by "needs a 10 Kohm pullup to Vdd?" Could you please show me a pic or schematic? (even a quick and dirty one hastily drawn is fine).

    I am using the 9 VDC 300 mA power supply that comes from Parallax:
    www.parallax.com/detail.asp?product_id=750-00008 .

    As for the "too much distance" problem, I am displaying (using the PINK server function) the value of the spoken variable in PINK with a webpage. Therefore, my 100 ft category 6 ethernet cable is not too long. The connections that I am using are the green jumper wires that came with the PINK. These wires are less than a ft long. This is the wire that I'm using:
    www.parallax.com/detail.asp?product_id=800-00029

    Here is a picture of my set-up:
    pinktts.jpg

    The speaker I'm using is a Radio Shack 8 ohm 0.1 watt rated, 0.2 watt maximum speaker:
    www.radioshack.com/product/index.jsp?productId=2062406&cp=&pg=1&sr=1&y=12&y=11&origkw=8+ohm+speaker&kw=8+ohm+speaker&x=16&x=14&numProdsPerPage=40&parentPage=search

    Both dip switches on the EMIC TTS are set to the "off" position (both switches pulled down towards the "1" and "2" (away from "ON KE").

    Thanks again and much appreciation,
    Lilly. smile.gif

    Post Edited (latigerlilly) : 2/26/2007 5:36:04 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-02-26 17:37
    Very good -- distance should not be an issue. Power may be -- 300 mA to drive both the EMIC as well as the PINK as well as the PDB may not be sufficient. I'd measure the current using an ammeter myself.

    And I still don't see a ground wire connecting both the PINK and the EMIC to the PDB -- it may be there, I just don't see it.

    And by a "10 Kohm pullup to Vdd", I mean you put in a 10 Kohm resistor, one end of it on the EMIC '/Reset' line, the other end of it connected to Vdd. This will give you a default "high" level on the /Reset line, so that noise won't reset the EMIC.
  • ZootZoot Posts: 2,227
    edited 2007-02-26 17:44
    A pull-up resistor on the \RESET line to Vdd means that the reset line is held "high" when there is no LOW present from the Stamp pin -- even if the pin was disconnected. When you change a pin to INPUT, you are virtually disconnecting it from the circuit. The alternative to a pull-up is to hold the \RESET line high. That said, pull-up/pull-downs on reset and chip-select lines can be helpful because they keep the line in a known state while the Stamp resets (when all pins go to inputs).

    However, someone from Parallax would need to speak to the setup of the Emic -- a lot of the Parallax products have current-limiting resistors and pull-ups/pull-downs built-in so that wiring (and errors for users) are kept to a minimum. There may already be a pull-up to the \RESET line on the Emic board. The Ping))) is a good example -- it has a current limiting resistor and a pull-down on the signal pin (the former limits current on the line; the latter so that it only drives high, to help prevent shorts).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    Post Edited (Zoot) : 2/26/2007 6:53:46 PM GMT
  • latigerlillylatigerlilly Posts: 114
    edited 2007-02-26 18:49
    Hi guys,

    Very interesting.... On the LOWEST volume setting, my RadioShack digital multimeter (22-813) registered an average maximum of 0.6 mA on the lowest EMIC TTS volume setting. This was measured in series with one wire of the ammeter connected to SP+ on the EMIC TTS and the other wire of the ammeter connected to the + wire lead of the speaker. This doesn't sound like too much of a power drain. What's more, at the lowest power setting, reliability did not improve.

    Yes, both PINK and EMIC TTS are connected to VSS and VDD on the PDB with PS2P40. That's what you mean by "common ground," right?

    Is this what you mean by "10 Kohm pullup to Vdd":
    pinktts2.gif

    Thanks a bunch,
    Lilly.
    smile.gif
  • ZootZoot Posts: 2,227
    edited 2007-02-26 18:57
    No, by pullup on the reset, allanlane5 means -->

    1. connect Stamp pin to \RESET pin
    2. connect 10k resistor from \RESET pin to +5v

    It's like a debounce circuit, or a whisker circuit on the Boe-bot -- if the Stamp pin is OPEN, i.e. disconnected or in an input state, the 10k pull-up "takes over" and pulls the line high (no resets). If the Stamp pin goes LOW, the current out of the pin is stronger than the pull-up, and "overrides it", taking the whole line low and resetting the EMIC. If you take the Stamp PIN high, well, you're already high, so that's OK too. Pull-ups and pull-downs can also help prevent noise from creeping in and causing resets. It also means you can change the Stamp pin to INPUT rather than holding the pin high or low. This can ease current through your stamp pins.

    But again, there may already be pull-up on the \RESET line of the Emic on the board itself -- that I'm not sure of.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-02-26 19:32
    Yes, 'lilly', that schematic looks correct.

    Now, having looked at your picture, the only other issue could be noise. Having separate wires 'waving in the breeze' like that is not the most reliable connection method. Though it should work.

    One other check you may want to do is measure the Vdd to Vss on all three boards, while it's operating. It MUST stay at 5 volts (give or take a tenth of a volt or two). If you're pulling too much current from the power supply, the voltage will drop.

    It sounds like you measured the current going ONLY to the EMIC board -- but you don't know where the failure is coming from yet.
  • latigerlillylatigerlilly Posts: 114
    edited 2007-02-26 21:11
    Hi guys,

    I have connected all the various VSS leads to one wire going to VSS on the PDB. I have also connected all the various VDD leads to one wire going to VDD on the PDB. I measured the voltage between the VSS and VDD wire going to the PDB and it is 4.94 Volts, well within spec.

    Voltage specifically across VSS and VDD on just the EMIC TTS is 4.90 Volts.

    Voltage specifically across VSS and VDD on just the PINK is 4.92 Volts.

    Therefore, a voltage drop due to insufficient power is unlikely. I am thinking I need to contact Parallax for an exchange....

    Thanks,
    Lilly.
    P.S. This is the voltage while the EMIC TTS is speaking.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-02-27 16:42
    Lilly,

    I didn’t see anywhere where you mentioned if you tried Zoot’s original suggestion of trying the Emic by itself away from the PINK and using its own demo code, Emic_TTS. Have you tried this?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • latigerlillylatigerlilly Posts: 114
    edited 2007-02-27 18:44
    The 2 demos seem to work fine. Just a minor problem. If the text to be spoken is "I am Emic hear me roar," it gets spoken as "I Emic hear me roar." However, if works fine when you type in "I m Emic hear me roar." No big deal. I think that if you use phenomes instead of text, it should work fine.

    Back to the original question, it is probably a problem with the PINK demo program. The PINK is not communicating properly with the EMIC TTS. I will have to go over the program with a fine tooth comb. Right off the bat, my hypothesis is that it is a problem with insufficient pause time to allow the PINK to finish writing the information before the EMIC tries to grab it. I will increase the pause times in the program and see if it doesn't improve the PINK demo program's performance....
  • latigerlillylatigerlilly Posts: 114
    edited 2007-03-05 05:47
    Hi guys,

    I have been putting pauses in the program in various places until my face is blue but I cannot get the PINK demo program listed above to run more reliably. It seems to work fine with simple one word answers but it has trouble with longer responses. What is wrong with the program? Can some of you guys elucidate me as to what is wrong with the program? I am referring to the program listed in the first post of this thread.

    Thanks,
    Lilly.

    Post Edited (latigerlilly) : 3/5/2007 6:02:53 AM GMT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-16 14:55
    Lilly,

    I am working on revising the PINK documentation. That sample program may be removed as it was not tested by anyone other than the author who is no longer available. It may in fact not be a usable program and may be removed as we attempt to revise our documentation to be more solid and accurate. At some point soon the code will be tested to verify operation. Until then unless someone else tests it as working you may have to wait for our results. Perhaps someone with a PINK and a BS2p would be willing to see if it works for them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • skylightskylight Posts: 1,915
    edited 2007-03-30 02:45
    would it be possible running the emic text to speech module using a BS2 as opposed to the BS2p?

    I presume i would exchange the program directive at the top of the·code to·BS2 and·the baud rate setting· accordingly to match? apart from that it looks like the rest of the code is compatible, is this the case?

    regards

    Skylight
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-30 14:55
    Skylight,

    To be honest this application will most likely be removed. But the simply answer is that the BS2p has the Scratchpad RAM so it can buffer a 64 character incoming string. The BS2 would be limited to very small sentences (under 20 characters). On the other hand you could put in a bunch of pre-defined strings into a BS2 and have the PINK trigger them by a small ID packet…Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • skylightskylight Posts: 1,915
    edited 2007-03-30 15:24
    Thanks Chris
Sign In or Register to comment.