Using the TTS256 with the Voicebox Shield



What are we doing?

The TTS256 Text to Speech IC is a cool little chip that interfaces to the SpeakJet IC and allows the user to send a text string to the device and have the text automatically converted to sounds the SpeakJet can interpret. In essense you send english sentences to the TTS256 and then the Speakjet speaks the sentence aloud; how cool is that! While a person could certainly do this themselves the 'code cost' is very high; once the necessary code was written to interpret english you wouldn't have much code space left for your own application. The TTS256 means you can add text to speech to your project while still having plenty of room for other things.

In this short tutorial we'll cover how to add the TTS256 to the Voicebox Shield from SparkFun, and look at a basic sketch for sending sentences to the device.

What do I need?

Hardware:

Code:


Hook up the hardware!

There's not too much to do to get this project up and running; however there are a couple delicate solder connections that will have to be made. We'll start with the easy stuff though: solder the stackable headers onto the Voicebox Shield so that the male connectors are pointing down away from the components. Now we have to put the TTS256 IC onto the shield. The shield has 13 columns of prototyping vias, the TTS256 has 14 pins on each side. Bummer! A dirty fix that must be made is to bend pins 1 and 28 so that the rest of the chip can be put into the vias. Pin 1 is indicated on the IC with a little dot. Check it out below.

http://www.sparkfun.com/tutorial/TTS256/PIC1_S.JPG
TTS256 with bent pins

Put the TTS256 with the bent pins into the vias on the Voicebox shield. Orient the chip so that the bent pins are facing the 'Vin' pin on the shield. We have to solder a wire to one of the bent pins and this will make it easier.

http://www.sparkfun.com/tutorial/TTS256/PIC2_S.JPG
TTS256 inserted onto the Voicebox Shield

Now to the 'delicate' part; there are 5 signals that have to be connected on the TTS256. The table below describes the connections that need to be made. The 5V, GND and Rx pin of the TTS256 should be connected to shield header pins. The 'Ready' and Tx pins of the TTS256 will need to be wired to the Speakjet chip.

Signal Name TTS256 Pin Voicebox Pin Speakjet Pin Note
Vdd 28 5V -  
GND 14 Gnd -  
Rx 18 2 - Make sure that the jumper on the voicebox shield is removed.
SJ_Ready 20 - 15  
SJ_Tx 24 - 10  

http://www.sparkfun.com/tutorial/TTS256/PIC3_S.JPG
TTS256 with signals wired

http://www.sparkfun.com/tutorial/TTS256/PIC4_S.JPG
Jumper removed from pin 2 of Voicebox Shield

Now that the chip is soldered to the board correctly the only thing left to do is add a speaker. I added a 2 pin female header to the Voicebox shield and plugged wires from an 8 ohm speaker into them; but you can solder the speaker directly to the output terminals of the shield if you prefer.


Adding the Firmware

The TTS256 text to speech chip is quite easy to use; all that needs to be done is send a text string (english sentence) over a serial connection. In this project we'll use pin 2 on the Arduino for the serial transmission so that the hardware serial port isn't interfered with. Start by downloading the zip file from the Code Downloads section at the top of the tutorial. Unzip the folder in your Arduino sketchbook (the folder just contains a sketch). Once you've unzipped the folder open the sketch in Arduino.

If you check out the code you can see that it's a very basic sketch. After initializing all of the pins on the Voicebox shield along with the Tx pin that goes from the shield to the TTS256 pin the main code just waits for a string on the serial port. Once a carriage return character is received it is sent out through serial connection to the TTS256. The TTS256 takes the sentence and converts it to individual sound codes which are sent to the Speakjet chip. Finally the Speakjet chip converts the sound codes to sound and sends those sounds to the spekaer.

Compile and upload the code to your board. I actually didn't have much luck using the Arduino serial terminal; but if I used another terminal program like hyper-terminal, tera-term or X-CTU things worked out well. Once a connections is made (use the settings for 9600 baus, 8,N and 1) just type a sentence and press the 'enter' key. You'll find out that the rules the TTS256 chip uses to convert the words aren't always perfect; but in my case I found ways to manipulate the spelling of different words to achieve the desired sounds.

Good luck with your project!

Comments 17 comments

  • Member #182165 / about 13 years ago / 2

    I got this to work great right away. I am using putty on Windows 7 since there is no more hyperterminal. Just opened up the com port at 9600 and it worked. It says "ready" when you press the reset button anytime the Arduino is powered on. It did skip a couple of times, like stuck on repeat but that could have been stray capacitance since I was holding the Arduino. Creative spelling will get the sounds your looking for (example is u is often better replaced by o in most words. YMMV.
    Yes the new board is SMT, but the pinouts are identical, just be extra careful when soldering, clean your tip before every tiny joint.

  • I tried using this as a guide to connect the TTS256 to a SpeakJet on a breadboard. I changed the sketch to just use a fixed message and a 2 second delay between each time it sends it. I get the "ready" when it powers up, but then nothing. However, if I disconnect the Vout wire from the audio amp input (I'm using the Mono Audio Amp breakout) and then reconnect it, I'll hear it output part of the message that is being sent. E.g. I'm sending the message "testing 1 2 3 testing four five six" and I'll hear "1 2 3 testing" or "2 3 testing four five".

    The SpeakJet data sheet shows a "two pole" low pass filter that I didn't have the needed capacitors on hand to build. I'm guessing that circuit will help get rid of the high pitch whistle I currently get, but should it help with the incorrect output?

    I'm trying to get some of the niftier components figured out for projects for HS kids. They kid bored easily with the basic projects, so I'm hoping cool sound effects and text-to-speech might keep them engaged.

  • Member #358327 / about 9 years ago / 1

    If you do not wish to bend the Pin 1 and 28 as recommended add two strip of 14 way 'Turn-Pins' cutting off pin 1 and 28 - There is no connection to pin 1 and wire pin28 to +5V by soldering a 'wire-wrap' wire to the underside of your home made socket. Remove the Jumper from JP2 - Look carefully on the SMT version of the voice shield the jumper is next to 'TX' and Digital I/O '2'. I was able to run a wire from pin-2 of JP2 via the via to pin 24 of TTS256 so the only wire that needed to be connected to Speak Jet was on pin 15.

  • Member #224236 / about 11 years ago / 1

    Quick question, I am not sure about the components, I thought the SpeakJet was able to synthesize on its own, so what is the purpose of this extra chip, is it just a way to implement the communication protocol used by the SpeakJet? Something as shown below,

    Arduino -> Serial -> TTS256 -> (Something weird + serial data) -> SpeakJet -> Sound

    Thanks!

    • MikeGrusin / about 11 years ago / 1

      You can certainly interface directly to the SpeakJet without the additional TTS chip. However, the SpeakJet only understands "allophenes", the individual sounds that make up speech, so you'll need to break your desired speech output into those sounds. You can do this yourself using the information and dictionary included in the SpeakJet documentation (see this tutorial). This works fine for a limited vocabulary, but if your application requires unlimited or arbitrary speech output, the TTS (Text To Speech) chip does the work of translating (more or less) any english text into the allophenes that the SpeakJet understands.

  • Member #215328 / about 12 years ago / 1

    but in this video had show TTS256 need to interface with using a X-CTU to write the text..

    is TTS256 can stand alone without interface with X-CTU??

    and is it possible if by using a TTS256, it can run directly that means if we write it directly using keyboard and it will appear at the 16x2 LCD and when press "ENTER" it will pronounce the word?.

  • quickdrawluke / about 12 years ago / 1

    I bought this and when I tried to soder rx pin 18 to the shield pin 2 trace it came off. Will It still work if I connected it directly to the header pin 2 instead since I can no longer attach to the trace?

    • MikeGrusin / about 12 years ago / 1

      I hate when that happens! Yes, that should still work. There will normally be a little airspace when connecting boards together, so if you solder it to the very top of the pin on the underside of the shield, you should be fine. (If you won't be plugging further shields into this one, you could also stick a wire jumper or 1-pin header into the socket end of pin 2 and get a connection that way). Good luck!

  • quickdrawluke / about 12 years ago / 1

    I bought this and when I tried to soder rx pin 18 to the shield pin 2 trace it came off. Will It still work if I connected it directly to the header pin 2 instead since I can no longer attach to the trace?

  • Member #216677 / about 13 years ago / 1

    Is there a way of altering the output voice? Perhaps via something like Abelton? Or do we have to put up with mister robotic?

  • viperspd / about 13 years ago / 1

    Thanks SparkFun! This works great!

  • DevilMakes3 / about 13 years ago / 1

    I believe I followed all the instructions, and all I get is a varying number of 'ready' statements. No discernable difference in tone no matter what I send. Any luck getting this to work on a MAC using coolterm or cornflake? (Didn't work on hyperterm on PC either).

  • dakkumar / about 13 years ago / 1

    Is this shield compatible with the Uno?

  • JustAnotherBuilder / about 14 years ago / 1

    I just received a shield as well, and yeah it looks slightly different. Did you remove the solder on pin 2? I think that's what is meant by "jumper".
    Where are you having the trouble? Does it do anything at all? Did you read this note about the datasheet: (note: The correct character to append to the end of text is 0x0D and not 0x0A as listed)?

    • gowgow / about 13 years ago / 1

      I believe I had the same problem as Boppyer. And the problem was the jumper. The instrutions really aren't as clear as they should be regarding this point. As you mentioned, you actually need to wipe away the solder on pin 2. Use a multi-meter and test if pin 10 on the speakjet is connected to pin 2 on the shield. If it is, the jumper connection still exists and needs to be wiped away. After making this change it worked.
      The new shields use a much smaller speakjet chip which makes doing the soldering even more difficult. You definitely need the very thing wire-wrapping wire to make these connections.

  • Boppyer / about 14 years ago / 1

    Anyone got this to working? I followed the instructions but I can't get it to work :-( I also noticed the shield in the photo looks slightly different to the one I received from Sparkfun. Anyway to test that I've done it right?
    Cheers
    Boppyer