Pages: [1]   Go Down
Author Topic: Using phraselator with SpeakJet and Arduino Uno  (Read 1946 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anyone know how I can connect my SpeakJet to my Arduino Uno such that I can use the Phraselator software on my PC to test out the sounds before having to upload them into a program on the Arduino? I can connect my Arduino to my PC and set up an Serial connection to send data to the SpeakJet but whenever I try to send data from Phraselator it won't speak. I can see the TX/RX lights light up when I send the data but nothing comes out of the SpeakJet. Thanks.
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 216
Posts: 13673
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PLease post your code and probably some URL's of the used hardware as I can't see what you can smiley
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Van Alstyne, TX
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Haven't smoked an Arduino... yet.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

kdecker,
    All you need to use is an RS-232 (or USB) to TTL Serial converter between your PC and your
SpeakJet chip -- you don't need an Arduino.  The Phrase-A-Lator software was intended to be
used with the SpeakJet development boards.

    -Rusty-
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks all. I have an Arduino Uno and my SpeakJet is connected to it per the instructions in the SpeakJet documentation. Works great for speech strings that are sent from an arduino program. For example, the following works great:

#include <NewSoftSerial.h>
// set up the SoftwareSerial port to connect to the SpeakJet
int lightPin = 0;
int done = 0;
NewSoftSerial SpeakJetSerial =  NewSoftSerial(2, 3);

  char goodMorning[] = {20, 96, 21, 114, 22, 100, 23, 2, 8, 179, 138, 138, 177, 140, 7, 137, 7, 153, 22, 150, 141, 129, 143, 30, 10, 22, 100, 187, 191, 8, 131, 186, 132, 132, 141, 22, 120, 128, 22, 130, 128, 0};
void setup()
{
  SpeakJetSerial.begin(9600);
}
 
void loop()
{
  int val;
  int threshold = 625 ;
  val=analogRead(lightPin); // read the light level from the light pin.
  if (val <= threshold) // light level goes from 0 to 900. Higher number is darker.
  {
    if (done == 0) // if we haven't spoken yet...
    {
      SpeakJetSerial.print(goodMorning); // send string to the SpeakJet
      done = 1; // set done to 1 so it doesn't keep talking forever.
    }
  }
  else
  {
    done = 0; // set done back to 0 so the next time the light comes on
              // it will speak again.
  } 
  delay (1000);
}
--------------------------------------------------------------------
With a different program, I was hoping to use the arduino as kind of a "passthrough" from my PC to the SpeakJet since the PC is already connected to the arduino via the USB software serial port, and the speakjet is connected to the arduino.

So I want to also be able to test out sounds and phrases using phraselator without having to disconnect the speakjet from the arduino.

To make arduino a "passthrough" to speakJet, I figured I would just read anything that comes across the serial port from the PC to the arduino and print it to the speakjet port.

Using the code below, I can send data from the Phraselator to the arduino (I can see the arduino Rx light flashing when I send the data). But it doesn't seem to send it to the SpeakJet to make the sounds.


#include <NewSoftSerial.h>

NewSoftSerial SpeakJetSerial =  NewSoftSerial(2, 3);

void setup()
{
  SpeakJetSerial.begin(9600); // serial port to SpeakJet.
  Serial.begin(9600); // serial port from PC to arduino.
}

void loop()
{
  if (Serial.available())
  {
    SpeakJetSerial.print((char)Serial.read());
  }
}
Logged

Toronto, Canada
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can use a button to let the Arduino know it has to forward all communications from the hardware serial to the pins where the Speakjet is connected, then do a loop like this:

Quote
   while(1)
    {
      byte pc2spkjet = digitalRead(hwRxPin);
      digitalWrite(spkjetTxPin, pc2spkjet);
    
      byte spkjet2pc = digitalRead(spkjetRxpin);
      digitalWrite(hwTxPin, spkjet2pc);
    }


Of course, hwRxPin is 0, hwTxPin is 1, spkjetRxPin and spkjetTxPin are what ever you choose (2 and 3 in your example). And don't forget to set the pins to input (Rx) and output (Tx) using the PinMode command in setup().
This works at 9600 baud. For higher baud rates, you need to use the fast digitalRead and Write.
« Last Edit: March 04, 2011, 05:20:10 pm by Ro-Bot-X » Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks! I'll give it a try.
Logged

Pages: [1]   Go Up
Jump to: