Sunday, March 30, 2008

Robots in Art

Back in college I and my best friend, Paul Potts, started talking about building a robot. We never did but we came up with a lot of fun ideas.

Paul is an artist and has had a lot of showings locally and is always coming up with some new creative idea. Here's his latest-- robot paintings!



Thursday, March 27, 2008

Say What?

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 Clip

Data 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 4

text DATA 27,7,45,15,53,3,46,51,45,1,21,4,0
ptr VAR WORD
char VAR BYTE

setup:
' P7 <- SBY ' P6 -> 'ADL
' P0-P5 -> Data

DIRL = %01111111
HIGH 6

ptr = text

PAUSE 2000

go:
' Set char to the next phoneme
' Send it

READ ptr,char
DEBUG DEC char, CR
IF char <> 0 THEN cont
END
cont:
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 read
PULSOUT 6,1

' Wait for P7=SBY (standby) to indicate chip is done speaking
notdone:
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?

Sunday, March 23, 2008

Circuit Design on Mac OS X

Circuit design is fine to do on paper for the simplest stuff but a CAD program is nice for everything else. I'd been using TinyCAD on my P3 400MHz, 128M desktop but am trying to move away from this glacially slow system, not to mention minimizing my exposure to Windows. :)

One good answer for Mac users is the free version of CadSoft Eagle running under the X11 windowing environment (follow the link to install X11). While it's not a seamless Aqua interface, it is actually a heck of a nice program once you get use to using it and it has an integrated PCB designer that works quite well. The user interface is a little bizzare, but with some practice I'm getting faster at drafting circuits. So far, the parts library seems to be pretty comprehensive, too.

If you want the app to show up in your Dock, you can write a shell script and use Platypus to create a wrapper application (may take several tries to figure it out) or try mine below which includes the shell script. Click on the link, save to disk, unzip, and copy the Eagle.app to /Applications. This app assumes the EAGLE-X11 folder is already installed in /Applications.