Do I have a defective EMIC Text to Speech Module?
latigerlilly
Posts: 114
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:
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
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:
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
<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>
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
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 .
Post Edited (latigerlilly) : 2/26/2007 4:44:43 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
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
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:
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.
Post Edited (latigerlilly) : 2/26/2007 5:36:04 PM GMT
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.
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
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":
Thanks a bunch,
Lilly.
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
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.
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.
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
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....
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
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
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
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