I admit it: I'm a total geek. I love electronics, programming, 3D art, vintage Apple hardware, and whisky. I'm always juggling half a dozen projects. I also enjoy documenting it all: my successes, my failures, my experiences... and everything geeky along the way.

Seeed Studio Fusion - $9.90 for 10pcs 2 layer 10x10cm boards


 
 
 
 
 

Fun With the SpeakJet Chip | Kevin Rye.net - Main

Kevin Rye

Geek Extraordinaire. Yeh, I said it.

Fun With the SpeakJet Chip

I’ve been wanting to play with the SpeakJet for a while now, but I just couldn’t justify the $25 that it sells for. It’s not SparkFun’s sometimes marked-up pricing, it’s $25 bucks pretty much wherever you can find it. I spent $99 on the SparkFun Hot Air Rework Station, so I figured I’d go for broke and add the SpeakJet to my order.

The SpeakJet is an amazing little 19-pin chip. From the documentation:

The SpeakJet is a completely self contained, single chip voice and complex sound synthesizer. It uses Mathematical Sound Architecture tm (MSA) technology which controls an internal five channel sound synthesizer to generate on-the-fly, unlimited vocabulary speech synthesis and complex sounds. The SpeakJet is preconfigured with 72 speech elements (allophones), 43 sound effects, and 12 DTMF Touch Tones. Through the selection of these MSA components and in combination with the control of the pitch, rate, bend, and volume parameters, the user has the ability to produce unlimited phrases and sound effects, with thousands of variations, at any time. This is not recorded waveforms or sound fragments but truly synthetic sound.



The SpeakJet will operate from 2-5.5V. So it can run of a 2 x AA battery pack. Awesome!

Pins 11 and 12 are the Mode Select pins (M0 and M1). For normal operation, connect M0 to GND and M1 to Vcc through a resistor. If you connect M1 to Vcc at power up, it’ll run in Demo Mode. In Demo Mode, the SpeakJet will annunciate all of the sounds that it can make.

To run the SpeakJet in Demo Mode, breadboard it like this:

speakjet demo mode configuration

Here’s the SpeakJet configured as shown above.

SpeakJet connected in Demo Mode

I found the output to be pretty low, so I connected the SpeakJet’s output to my SparkFun Audio Amp.

sparkfun audio amp

Here’s Demo Mode:



Wow! Did you hear that?! That was totally R2-D2!

I picked this chip up thinking it would make a great talking clock. It would be cool to make a clock that annunciated the time on the hour. I probably could make it without even needing any kind of display. Now that I hear what it can do, I’m thinking about making an R2-D2 box.

I connected my Arduino and took the SpeakJet out of Demo Mode.

SpeakJet_Board_0037

I then checked out the documentation and identified exactly what tones sounded the most like something that R2 would “say”. It’s basically anything from tones 200-230, with a few exceptions.

I threw a couple of the tones into a sketch just to see what it would sound like:

#include <SoftwareSerial.h>
#define txPin 2
#define RES 3
#define button 4

long randNumber;

SoftwareSerial SpeakJetSerial =  SoftwareSerial(RES, txPin);

void setup() {

  pinMode(txPin, OUTPUT);
  pinMode(RES, OUTPUT);
  pinMode(button, INPUT);
  SpeakJetSerial.begin(9600);

  digitalWrite(RES, LOW);
  delay(100);
  digitalWrite(RES, HIGH);
}

void loop() {

  //play tones when a button is pressed
  if (digitalRead(button) == HIGH) {

    char playTone[] = {
      210,207,6,209,208,227,218,202,203, 4,224,223,222,221,255};
    SpeakJetSerial.println(playTone); 
    delay(3000); 
  }
}

Here’s a video of the results:



That’s R2 all right!

It would be better if R2 could just rattle off a random string of tones instead of me hard-coding them. I put together a sketch that would pick 12 random tones and play them back when a button was pressed. There’s a few tones in there I don’t want it picking since they’re not very R2-ish. So I put in a few IF statements in there to tell it to pick anther one if it lands on one I don’t want.

R2 also needs his red and blue light! I added an RGB LED and set it to flash between red and blue when the button is pressed. If I do make a board for this, I’ll end up with 3 from OSH Park. It would make sense to design the PCB so that it has more functionality that just making R2-D2 sounds. I want to design the board so that if I want to use one as a talking clock, I could do it.

SpeakJet_Board_0053

I also connected my 3-way nav switch and as a proof-of-concept. I wanted to see if I could trigger multiple audio strings based on a different button press. I added a few other things to the sketch to trigger for the other switch modes:

UP - simply lights up the RGB LED in red.
CENTER - R2-D2 mode
DOWN - All Your Base Are Belong To Us!!!



That’s looking pretty good. Having a 3-way switch in there is a good way to insure that I can use the other 2 boards that I’ll get from OSH Park for something else.

OK, this thing looks like it’s really happening! Time for a PCB….

speakjet sch eagle 1
speakjet brd eagle 1

OSH Park quotes me a price of $19.35 because the board is 50mm x 50mm. I’m going to mount the PCB in a Sick Of Beige enclosure so I can’t shrink it down any smaller. I played around with a design that I’d be able to stack on top of my Bare Bones Arduino board. Doing so would eliminate the ATmega and a few components thus bringing the price down about $5 bucks.

speakjet osh park render top 1

I really want to use the Sick of Beige enclosure, so I guess I’m paying an extra $5 bucks.

speakject final assembly idea 1

I printed out the PCB and made sure all the components had enough clearance. Looks good.

SpeakJet_Board_0060

The speaker is going to be mounted on the back. Something like this:

speakject final assembly idea 2

Although, that raises a few issues. Where do the batteries go? I was going to mount a battery pack on the back, but then the speaker would have to go on the front. That’ll cover up the whole PCB. So the speaker has to definitely go on the back. I’m still messing around with how the batteries are going to fit. I might use a coupe of coin cells instead of a huge AA battery pack. I’ll have to mount them on the back, and then maybe glue the speaker to the acrylic.

speakject final assembly idea 3

Although I don’t think a tiny 3V coin cell will last very long. Even if I connect 2 in parallel it still won’t come to close to that of a few AAs. Maybe I can use one of those 3.6V 1/2AAs that go in my vintage Macs? Those last forever!

SL150 1:2 AA

I’ll just have to order an assortment of battery holders and see what makes the best fit.

For grins, I chalked up an R2-D2 shaped PCB and silkscreen in Eagle just to see what it would look like and how much it would cost to get such a board made.

R2D2_Eagle board

I made it the largest size you can with the free version of Eagle; which is about 4”x4”. OSH Park gave me a price of about $45. Having a few sheets of acrylic cut and engraved would probably cost another $20 or so. $60-70 seems to be a little overkill for what it does. It would be really cool to have the board shaped like R2-D2, but the purple board from OSH Park would be a deal-breaker. A purple R2 would look kind of silly. I guess I could only pull it off if the PCB was white with a blue silkscreen. Who knows how much that would cost to make? I really don’t want to spend $200 on this project. I guess for now, the Sick of Beige enclosure will have to do.

See this project from start to finish:
Fun With the SpeakJet Chip
The SpeakJet Board