Need EMIC 2 TTS Help

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
miget
 
Posts: 2
Joined: Fri Sep 14, 2012 9:39 pm

Need EMIC 2 TTS Help

Post by miget »

Hi all,

So lately I have been trying to get my new EMIC 2 to talk to me the text I type to it using my Arduino.
But as you can probably tell due to this topic, I have had no luck.
I have been using the example code given, it says its start up text which is written in the code but does not allow me to give it any text I type to it.
I have tried using all the possible ":s", ":n", ":h" ect code with no effect.
not sure if this is important or not but it does not send anything to the serial window (not even sure if it is meant to).
Any help on this would be great. Also I will include the sample code so you don't have to look for it.
What I fear the most is that this code does not allow for user input, if so could someone help me with one which does.

Kind Regards,
Miget

(No don't read my name as Midget)

Code: Select all

/*
  
  Emic 2 Text-to-Speech Module: Basic Demonstration       
                                                         
  Author: Joe Grand [www.grandideastudio.com]             
  Contact: [email protected]                            
  
  Program Description:
  
  This program provides a simple demonstration of the Emic 2 Text-to-Speech
  Module. Please refer to the product manual for full details of system 
  functionality and capabilities.

  Revisions:
  
  1.0 (February 13, 2012): Initial release
  
*/

// include the SoftwareSerial library so we can use it to talk to the Emic 2
#include <SoftwareSerial.h>

#define rxPin 2    // Serial input (connects to Emic 2 SOUT)
#define txPin 3    // Serial output (connects to Emic 2 SIN)
#define ledPin 13  // Most Arduino boards have an on-board LED on this pin

// 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(ledPin, OUTPUT);
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  
  // set the data rate for the SoftwareSerial port
  emicSerial.begin(9600);

  digitalWrite(ledPin, LOW);  // turn LED off
  
  /*
    When the Emic 2 powers on, it takes about 3 seconds for it to successfully
    intialize. 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 up
  while (emicSerial.read() != ':');   // Wait for ':' character
  delay(10);                          // Short delay
  emicSerial.flush();                 // Flush the receive buffer  
   
  // Set volume to 12
  emicSerial.print("V12\n");
  while (emicSerial.read() != ':');   // wait for ':' character

  // Speak some text
  emicSerial.print('S');
  emicSerial.print("Hello. This ");
  emicSerial.print("is the EMIC 2, text to speech module. I am easy to use, ");
  emicSerial.print("just send me a text string and i will speak it for you.");  
  emicSerial.print('\n');
  while (emicSerial.read() != ':');   // Wait for ":" character
}

void loop()  // Main code, to run repeatedly
{
   //do nothing
}

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: Need EMIC 2 TTS Help

Post by adafruit_support_bill »

Where did you find this example code? As the comment says, the code does nothing after startup.

Code: Select all

v

void loop()  // Main code, to run repeatedly
{
   //do nothing
}

User avatar
miget
 
Posts: 2
Joined: Fri Sep 14, 2012 9:39 pm

Re: Need EMIC 2 TTS Help

Post by miget »

Ok now I feel like a muppet, can't believe I did not see that.
Does the example Adafruit give allow typing to the module.

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: Need EMIC 2 TTS Help

Post by adafruit_support_bill »

The example linked from the product page does not support typing to the module.

You can try replacing your loop with the code below. It will simply echo anything from the hardware serial port to the EMIC.
You will also need to add a "Serial.begin(9600);" to your setup() to initialize the hardware serial port.

Code: Select all

void loop()
{
  while (Serial.available() > 0) 
  {
    emicSerial.write(Serial.read());
  }
}

User avatar
sydeem
 
Posts: 46
Joined: Fri Oct 25, 2013 5:34 pm

Re: Need EMIC 2 TTS Help

Post by sydeem »

I would like to add tones to Emic 2 output. May I call for tones on the same pin as SIN (11) after the \n characters or is there a better way to add tones during a robot speaking tour?

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: Need EMIC 2 TTS Help

Post by adafruit_support_bill »

I don't see anything about tone output in the Emic 2 documentation:
http://parallax.com/sites/default/files ... n-v1.1.pdf

User avatar
sydeem
 
Posts: 46
Joined: Fri Oct 25, 2013 5:34 pm

Re: Need EMIC 2 TTS Help

Post by sydeem »

I was just wondering if a PWM signal would pass through the signal path or does everything get chopped up and run through in bytes. I guess it would not harm the Emic 2 if I tried that would it. The PWM signal would be at 5 volts.

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: Need EMIC 2 TTS Help

Post by adafruit_support_bill »

No. The EMIC expects ASCII serial input. It would not recognize a PWM signal.

User avatar
sydeem
 
Posts: 46
Joined: Fri Oct 25, 2013 5:34 pm

Re: Need EMIC 2 TTS Help

Post by sydeem »

Thank you for staying with me. I don't mean for the Emic 2 to operated on the signal; I just want the tone to leak through the path from pin 11 (which also can be used by one of the tone libraries) from SIN through the Emic2 to SOUT and on to a mono amp and a speaker so all I would have to do was call tones between speaking command sets.

I am neither a programmer nor a circuit engineer so I am probably leading you off on an impossible journey.

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: Need EMIC 2 TTS Help

Post by adafruit_support_bill »

No. It doesn't work that way.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”