Shop OBEX P1 Docs P2 Docs Learn Events
Need help with new SpeakJet — Parallax Forums

Need help with new SpeakJet

SN96SN96 Posts: 318
edited 2006-06-12 19:48 in BASIC Stamp
I have attached a pdf of the circuit I am working with at the bottom.
I recently bought the SpeakJet and I am able to get it to work in demo· mode setting the jumpers M0 to V+ and M1 to V+ but when I set M0 to V- and M1 to V+ (Normal mode) the speak jets ready LED is on but when I try to run the example code, it does not do anything. I'm trying to figure out if my custom board design is at fault, or if I am doing something wrong with the serial interface. I have Pin 15 of the stamp going to the SPeakJet's RCX pin and Pin 14 of the stamp going to D2 of the SPeakJet.

Do I need to set the baud rate? Are my serial connections wrong? I am not using the DB9 connector, I want to use the stamp pins of the Homework Board.
' =========================================================================
'
'   File...... SpeakJet_Demo.BS2
'   Purpose... Serial Control of TIGERBOTICS SpeakJet Board
'   Author.... (c) 2004 Parallax, Inc. -- All Rights Reserved
'   E-mail.... [url=mailto:support@parallax.com]support@parallax.com[/url]
'   Started...
'   Updated... 30 JUL 2004
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================

' -----[noparse][[/noparse] Program Description ]---------------------------------------------
'
' Connections:
'
'   P15  ---->  DB9.2
'   P14  <----  DB9.8
'   Vss  -----  DB9.5

' -----[noparse][[/noparse] Revision History ]------------------------------------------------

' -----[noparse][[/noparse] I/O Definitions ]-------------------------------------------------
Tx              PIN     15                      ' serial out to SpeakJet
Rdy             PIN     14                      ' Ready in from SpeakJet

' -----[noparse][[/noparse] Constants ]-------------------------------------------------------
#SELECT $stamp
  #CASE BS2, BS2E, BS2PE
    T2400       CON     396
    T4800       CON     188
    T9600       CON     84
    T19K2       CON     32
  #CASE BS2SX, BS2P
    T2400       CON     1021
    T4800       CON     500
    T9600       CON     240
    T19K2       CON     110
#ENDSELECT
Inverted        CON     $4000
Baud            CON     T9600 + Inverted
Sync            CON     $55

' -----[noparse][[/noparse] SpeakJet Control Codes ]------------------------------------------
PA0             CON     0                       ' pauses
PA1             CON     1
PA2             CON     2
PA3             CON     3
PA4             CON     4
PA5             CON     5
PA6             CON     6
Fast            CON     7
Slow            CON     8
Stress          CON     14
Relax           CON     15
_Wait           CON     16                      ' note underscore
Soft            CON     18
Volume          CON     20
Speed           CON     21
Pitch           CON     22
Bend            CON     23
PortCtr         CON     24
Port            CON     25
Repeat          CON     26
CallPhr         CON     28
GotoPhr         CON     29
Delay           CON     30
Reset           CON     31
IY              CON     128
IH              CON     129
EY              CON     130
EH              CON     131
AY              CON     132
AX              CON     133
UX              CON     134
OH              CON     135
AW              CON     136
OW              CON     137
UH              CON     138
UW              CON     139
MM              CON     140
NE              CON     141
NO              CON     142
NGE             CON     143
NGO             CON     144
LE              CON     145
LO              CON     146
WW              CON     147
RR              CON     148
IYRR            CON     149
EYRR            CON     150
AXRR            CON     151
AWRR            CON     152
OWRR            CON     153
EYIY            CON     154
OHIY            CON     155
OWIY            CON     156
OHIH            CON     157
IYEH            CON     158
EHLL            CON     159
IYUW            CON     160
AXUW            CON     161
IHWW            CON     162
AYWW            CON     163
OWWW            CON     164
JH              CON     165
VV              CON     166
ZZ              CON     167
ZH              CON     168
DH              CON     169
BE              CON     170
BO              CON     171
EB              CON     172
OB              CON     173
DE              CON     174
_DO             CON     175                     ' note underscore
ED              CON     176
OD              CON     177
GE              CON     178
GO              CON     179
EG              CON     180
OG              CON     181
CH              CON     182
HE              CON     183
HO              CON     184
WH              CON     185
FF              CON     186
SE              CON     187
SO              CON     188
SH              CON     189
TH              CON     190
TT              CON     191
TU              CON     192
TS              CON     193
KE              CON     194
KO              CON     195
EK              CON     196
OK              CON     197
PE              CON     198
PO              CON     199
RO              CON     200
R1              CON     201
R2              CON     202
R3              CON     203
R4              CON     204
R5              CON     205
R6              CON     206
R7              CON     207
R8              CON     208
R9              CON     209
A0              CON     210
A1              CON     211
A2              CON     212
A3              CON     213
A4              CON     214
A5              CON     215
A6              CON     216
A7              CON     217
A8              CON     218
A9              CON     219
_B0             CON     220                     ' note underscore
_B1             CON     221
_B2             CON     222
_B3             CON     223
_B4             CON     224
_B5             CON     225
_B6             CON     226
_B7             CON     227
_B8             CON     228
_B9             CON     229
C0              CON     230
C1              CON     231
C2              CON     232
C3              CON     233
C4              CON     234
C5              CON     235
C6              CON     236
C7              CON     237
C8              CON     238
C9              CON     239
D0              CON     240                     ' DTMF tones
D1              CON     241
D2              CON     242
D3              CON     243
D4              CON     244
D5              CON     245
D6              CON     246
D7              CON     247
D8              CON     248
D9              CON     249
D10             CON     250
D11             CON     251
M0              CON     252                     ' sonar pin
M1              CON     253                     ' pistol shot
M2              CON     254                     ' WOW
EOS             CON     255                     ' end of string

' -----[noparse][[/noparse] Variables ]-------------------------------------------------------
eeAddr          VAR     Word                    ' address of speech element
element         VAR     Byte                    ' speech element / code
idx             VAR     Word

' -----[noparse][[/noparse] EEPROM Data ]-----------------------------------------------------
' SCP strings
NoPuMsg         DATA    "\0237J32H80NX", EOS
ClearBuf        DATA    "\0RX", EOS
ClearAll        DATA    "\08J0N1J0N11J0N2J0N12J0N3J0N13J0NX", EOS
AllOff          DATA    "\08J0N11J0N12J0N13J0NX", EOS
DialTone        DATA    "\08J0N1J350N2J440N11J18N12J18NX", EOS
' allophone strings
Defaults        DATA    Reset, Volume, 127, EOS
Welcome         DATA    WW, EH, LE, PA4, KO, AW, MM, PA5, EOS
SpeakJet        DATA    SE, PE, IY, PA4, KE, PA5, JH, EY, TT, PA5, EOS
Demo            DATA    DE, EH, MM, OWWW, PA5, EOS
Parallax        DATA    PE, Fast, EYRR, UX, LE, AY, AY, KE, SE, PA5, EOS
Basic           DATA    BE, EYIY, SE, IH, Fast, PA4, OK, PA5, EOS
Stamp           DATA    SE, TU, AY, EH, MM, PE, PA5, EOS
RobotSad        DATA    Reset, Bend, 0, Speed, 61, _B8, PA1, C9, PA1,
                        Reset, EOS
ParaPhone       DATA    Slow, D9, PA5, Slow, D1, PA5, Slow, D6, PA5,
                        Slow, D6, PA5, Slow, D2, PA5, Slow, D4, PA5,
                        Slow, D8, PA5, Slow, D3, PA5, Slow, D3, PA5,
                        Slow, D3, EOS

' -----[noparse][[/noparse] Initialization ]--------------------------------------------------
Setup:
  GOSUB No_PwrUp_Msg                            ' no "Ready" prompt

' -----[noparse][[/noparse] Program Code ]----------------------------------------------------
Main:
  FOR idx = 0 TO 1
    LOOKUP idx, [noparse][[/noparse]Defaults, Welcome], eeAddr
    GOSUB Play_String
  NEXT
  PAUSE 1500
  FOR idx = 0 TO 1
    LOOKUP idx, [noparse][[/noparse]SpeakJet, Demo], eeAddr
    GOSUB Play_String
  NEXT
  PAUSE 750
  eeAddr = RobotSad
  GOSUB Play_String
  PAUSE 3000
  FOR idx = 0 TO 2
    LOOKUP idx, [noparse][[/noparse]Parallax, Basic, Stamp], eeAddr
    GOSUB Play_String
  NEXT
  PAUSE 3000
  FOR idx = 15 TO 127 STEP 16
    SEROUT Tx\Rdy, Baud, [noparse][[/noparse]Volume, idx]          ' set volume level
    eeAddr = Parallax                           ' say "Parallax"
    GOSUB Play_String
    PAUSE 500
  NEXT
  PAUSE 3000
  eeAddr = DialTone                             ' simulate dial tone
  GOSUB Play_String
  PAUSE 4000
  eeAddr = ParaPhone                            ' dial Parallax number
  GOSUB Play_String
  PAUSE 4000
  GOTO Main
  END

' -----[noparse][[/noparse] Subroutines ]-----------------------------------------------------
' Play a string of SpeakJet sound elements from EE.  This subroutine
' uses flow-control to prevent sending elements when the SpeakJet
' buffer is full.
'
' -- put start of string in 'eeAddr'
Play_String:
  DO
    READ eeAddr, element                        ' get element from EE
    eeAddr = eeAddr + 1                         ' point to next
    IF (element = EOS) THEN EXIT                ' end? if yes we're done
    SEROUT Tx\Rdy, Baud, [noparse][[/noparse]element]              ' send element to SpeakJet
  LOOP
  RETURN

No_PwrUp_Msg:                                   ' clears PU Msg assignment
  eeAddr = NoPuMsg
  GOSUB Play_String
  RETURN



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike





Post Edited (SN96) : 6/4/2006 1:32:03 PM GMT
pdf
29K
Im.pdf 28.6K

Comments

  • SN96SN96 Posts: 318
    edited 2006-06-04 14:27
    Well I got it to work but I had to change the following line of code by the SEROUT command:

    Play_String:
      DO
        READ eeAddr, element                        ' get element from EE
        eeAddr = eeAddr + 1                         ' point to next
        IF (element = EOS) THEN EXIT                ' end? if yes we're done
        SEROUT Tx\Rdy, $0054, [noparse][[/noparse]element]              ' send element to SpeakJet
      LOOP
      RETURN
    

    I had to use $0054 inplace of the Baud variable and I used a different pin (#9). I also used just the RCX line and removed the Rdy wire. Not sure why this worked but it did.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike



    ·
  • SSteveSSteve Posts: 808
    edited 2006-06-04 14:57
    SN96 said...
    I had to use $0054 inplace of the Baud variable...Not sure why this worked but it did.
    $54 = 84 decimal, so you can use "T9600" in place of $0054. I think that means the device doesn't use "inverted" serial.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows

    Post Edited (SSteve) : 6/4/2006 3:01:45 PM GMT
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2006-06-04 15:39
    Indeed, as SSteve says, used the T9600 -- no INVERTED is needed. The SpeakJet "talks"
    straight 9600 TTL by default. RS-232 has inverted logic levels but this isn't RS-232.
    Using RS-232 on the SJ without some sort of level conversion chip (DS275 comes to mind)
    will probaby kill your SJ RCX pin!!! If that happens you'll really be in bad shape.

    Please note that the spec sheet for the SJ declares a NEED for a resistor attached to
    the RST (Reset) pin for proper operation. The same thing applies to M0 & M1. I know
    the diagrams for minimal connections in the spec sheet for demo'ing the SJ do not show
    any resistors but that's intended for testing. PLEASE HEED THE DIRECTIONS IN THE TEXT.
    SpeakJet schematics I've seen use resistors with a value of about 4.7K-ohms (YELLOW-VIOLET-RED).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = KD4WLZ = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
  • SN96SN96 Posts: 318
    edited 2006-06-05 12:30
    Thanks for the input guys. I did read the user manual and I was aware that the DB9 would require a conversion chip, and trying to hook directly to the RS232 interface will damage the Speakjet.

    I did not know that you needed a resistor for the reset pin as well as M0 & M1. I am going to revise my schematic to add resistors to these nets. Even though the SJ seems to work fine without them, I figure it's cheap insurance to add the resistors.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike



    ·
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2006-06-05 18:32
    > I figure it's cheap insurance to add the resistors.

    You betchya!!! Besides the spec' calls for 'em. Alas, they never say what value... :-|
    If you've dealt with PIC processors before then keep in mind that the SpeakJet is really
    just a preprogrammed PIC -- not some hotshot new piece of silicon. Pullups on the
    event inputs would be considered a good thing too -- it keeps 'em from "floating".
    Oh, it's been recommended that for Pin 4, place a small (~100-Ohms) resistor in series
    with the pin to any input. Not necessary for operation but, since Pin 4 is the MCLR pin
    (read "Master Clear") which is used when reprogramming PIC you probably don't want
    some negative going spike to clear yer SpeakJet. smile.gif

    Have phun!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = KD4WLZ = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
  • SN96SN96 Posts: 318
    edited 2006-06-09 14:14
    I made my changes to the design to have resistors put in where needed. I have been playing around with the speakjet and its alot of fun. I do have another question though. How can I program the SJ to store phrases and then to call those phrases from memory using the one wire TTL serial interface? I read the manual but im not sure how I would code this in the BS2. Are there any simple code examples showing how to put a single phrase into memory and then call it?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike



    ·
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2006-06-09 19:14
    Yes. What you'd be doing is storing the phrase that you want into a particular phrase slot in
    EEPROM of the SpeakJet. After that's been done use the MSA command to say GOTO PHRASE 'n'.
    This boils down to sending two characters, a ASCII-29 followed by ASCII-n, where 0<= 'n' < 16.
    So two characters to the SJ will get a phrase played. This phrase can 'call' or 'gosub' to another
    phrase in EEPROM and come back to the previous phrase; upto 3-levels deep so you can chain
    these critters.

    It's easiest to use the 'PhraseALator' program to get your phrases setup. Otherwise, see
    page 11 of the 7/2004 version** of the manual about writing phrases to EEPROM on the SJ.
    Alas, I don't have any code but you might check the Files section of the SpeakJet group on
    Yahoo -- there may be some code there.

    Any questions, just gimme a holler.

    ** Sorry, I'm at work right now but I thought there was a newer manual around but I can't
    find it. I could be wrong.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = KD4WLZ = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
  • SN96SN96 Posts: 318
    edited 2006-06-12 19:48
    Thanks Rusty,

    I will re-read the manual and see if I can get this going. I'll get with you if I can't get it to work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike



    ·
Sign In or Register to comment.