Here's how to interface an ancient, 80's era, General Instruments
SP0256-AL2 speech synthesizer chip to a Basic Stamp 2 so you too can give your robot the gift of virtually unintelligible, vintage, synthetic speech! (Listen closely to the audio clip and you can almost make out, "Hello world")
Audio ClipData Sheet:See
previous SP0256-AL2 post to download the data sheet.
Circuit Diagram:
sp0256-al2.sch

Note: the
LM386 amplifier circuit provided in
Robot Builder's Bonanza
just wouldn't work. It differed slightly from the one presented in the data sheet. The data sheet circuit is pictured above, but with the addition of a giant 100uF power decoupling cap; the LM386 was apparently drawing enough current with the speaker attached to cause the BS2 to reset similarly to
prior motor control problems. A somewhat smaller cap doesn't seem to work -- more investigation needed. The potentiometer above is actually not installed yet; a resistor is in place to prevent
clipping that was showing up on the o-scope.
The Code:
SP0256AL2.bs2
' {$STAMP BS2}' {$PBASIC 2.5}
' SP0256-AL2 Speech Chip' Control Code' Text: HELLO WORLD.' Phoneme: HH EH LL AX OW (PAUSE) WW ER1 LL PA2 DD1 (PAUSE)
' Octal: 033 007 055 017 065 003 056 063 055 001 025 004
' Dec: 27 7 45 15 53 3 46 51 45 1 21 4text
DATA 27,7,45,15,53,3,46,51,45,1,21,4,0
ptr
VAR WORDchar
VAR BYTEsetup:' P7 <- SBY ' P6 -> 'ADL
' P0-P5 -> DataDIRL = %01111111
HIGH 6
ptr = text
PAUSE 2000
go:' Set char to the next phoneme
' Send itREAD ptr,char
DEBUG DEC char,
CRIF char <> 0
THEN cont
ENDcont:GOSUB pout
ptr = ptr + 1
GOTO go
' Phoneme Output
pout:
' Now just set OUTL P6='ADL=1, (P0-P5) = phoneme byte
OUTL = char | %10000000
DEBUG BIN ?
OUTL' And set P6='ADL=0 for 2usec to tell the chip to readPULSOUT 6,1
' Wait for P7=SBY (standby) to indicate chip is done speakingnotdone:IF IN7 = 0
THEN notdone
RETURN
Quick Code Explanation:The data sheet goes into this in detail, but in short: the program puts the 6-bit phoneme data on data lines A1-A6, then pulses ^ALD low for a short time to let the chip know data is ready, then polls SBY until it goes high, then repeats until it runs out of phonemes.
That's it. This is just a prototype so there's lots more to do before this becomes useful. For example, wouldn't it be nice if a handy dandy AVR of some flavor could front end this chip and accept data over serial and/or I2C? Maybe even do true TTS?