Wireless Text-to-Speech Device

Would you like to be able to type ANY word, phrase, sentence, or paragraph and have it speak wirelessly from a speaker? Well it’s now a reality. This project allows you to type into a serial terminal connected to an XBee, and when you press enter, the words are sent to another XBee enabled text-to-speech module that speaks the words out loud on a connected speaker.

IMG_4817
Figure 1. XBee Serial Connection
 
IMG_4818
Figure 2. Text-to-Speech Module

Parts:
  • One solderless breadboard (MS MKKN2, AF 64, DK 438-1045-ND, SFE PRT-09567)
  • One XBee radio (Series 2/ZB firmware) configured as a Zigbee Coordinator AT mode (Digi: XB24-27WIT-004, DK 602-1098-ND)
  • One XBee radio (Series 2/ZB firmware) configured as a Zigbee Router AT mode (Digi: XB24-27WIT-004, DK 602-1098-ND)
  • One Arduino Uno board (MS MKSP4, SFE DEV-09950, AF 50)
  • Hookup wire or jumper wire kit (MS MKSEEED3, AF 153, DK 923351-ND, SFE PRT-00124)
  • USB A-to-B cable for Arduino (AF 62, DK 88732-9002, SFE CAB-00512)
  • XBee USB serial adapter (XBee Explorer or Digi Evaluation board) (AF 247, SFE WRL-08687)
  • One XBee shield (Seeed Studio SLD01103P, Arduino A000065, SF WRL-10854)
  • Parallax Emic 2 Text-to-Speech Module (Parallax 30016)
  • Speakers or earphones
  • Audio cable
  • Wire strippers (AF 147, DK PAL70057-ND, SFE TOL-08696)
  • Soldering tools (any hardware store)
  • A curious mind


Using the Arduino IDE

This project uses the Arduino software, known as the IDE, in order to program the Arduino Uno microcontroller. You can download it for free from the Arduino website software section at http://www.arduino.cc/en/Main/Software. There are many versions, so be sure to download the correct one. A basic guide to how to use it can be found at http://arduino.cc/en/Guide/HomePage.


Prepare and Configure your Coordinator Radio

  1. Use X-CTU to set the designated coordinator radio in AT mode.
  2. Configure the coordinator radio with a PAN ID (between 0x0 and 0xFFFFFFFFFFFFFFFF). Make sure you note this ID so that you can set up your router radio with the same one.
  3. Enter in the High and Low destination addresses of your router radio.


Prepare and Configure your Router Radio

  1. Use X-CTU to set the designated router radio in AT mode.
  2. Configure the router radio with the PAN ID you set the coordinator radio with.
  3. Set JV to 1 to ensure that your router attempts to rejoin the coordinator on startup.
  4. Enter in the High and Low destination addresses of your coordinator radio.


Construct the Text-to-Speech Module-XBee Connection via Arduino

IMG_4819

Figure 3. Module-Arduino-XBee Connection

  1. Place the XBee coordinator onto the XBee shield and then attach it to the Arduino.
  2. Attach the Text-to-Speech module to the breadboard so that the side with pins is closer to the Arduino.
  3. Using jumper wire, connect Arduino 5 volt power to the 5 volt pin on the module.
  4. Connect Arduino ground to ground pin on the module.
  5. Connect Arduino pin 10 to the SOUT pin on the module.
  6. Connect Arduino pin 11 to the SIN pin on the module.
  7. Connect the module to a speaker via audio cable or plug in a pair of earphones or headphones.
  8. Refer to Figure 3 for visual reference.


Program the Arduino microcontroller

*when uploading the program to the Arduino board, make sure you switch the TX (connected to pin 1 on Arduino) on the XBee off. This can be done on the XBee shield.

*
Upload the following program to the Arduino controlled security monitor:
 
// include the SoftwareSerial library so we can use it to talk to the Emic 2 module

#include <SoftwareSerial.h>

int rxPin = 10;  // Serial input (connects to Emic 2's SOUT pin)
int txPin = 11; // Serial output (connects to Emic 2's SIN pin)
String sentence = "";

// set up a new serial port
SoftwareSerial emicSerial =  SoftwareSerial(rxPin, txPin);

void setup()  // Set up code called once on start-up
{

// define pin modes
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial1.begin(9600);
// set the data rate for the SoftwareSerial port
emicSerial.begin(9600);

/*
When the Emic 2 powers on, it takes about 3 seconds for it to successfully initialize. It then sends a ":" character to indicate it's ready to accept commands. If the Emic 2 is already initialized, a CR will also cause it to send a ":"
*/
emicSerial.print('n');             // Send a CR in case the system is already up while (emicSerial.read() != ':');   // When the Emic 2 has initialized and is ready, it will send a single ':' character, so wait here until we receive it
delay(10);                          // Short delay
emicSerial.flush();                 // Flush the receive buffer
}
void loop()  // Main code, to run repeatedly
{
char letter;

// Speak some text
if (Serial1.available() > 0) {
letter = Serial1.read();
sentence = sentence + letter;

//if (letter == '.' || letter == '?' || letter == '!') {
if (letter == 'r') {
emicSerial.print('S');
emicSerial.print(sentence);
emicSerial.print('n');
sentence = "";
while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command
}
}
}