SparkFun Support and Front Desk will be closed on Thursday 11/14 from 1-2:30pm for a company event. Please plan to pick up your orders before or after this timeframe.
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.
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.
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.
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|
|Rx||18||2||-||Make sure that the jumper on the voicebox shield is removed.|
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.
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!