Shop OBEX P1 Docs P2 Docs Learn Events
Emic2 & I2C — Parallax Forums

Emic2 & I2C

I have an EMIC2 attached to an Arduino mega 2560 and also have a OLED screen attached on I2C. When the Emic2 talks my screen blanks out and the Arduino freezes and I have to restart it. If I comment out the lines where the Emic2 talks it runs with no issues. Has anyone else had issues similar to this or can anyone assist me with this issue. Thank you

Comments

  • How are you communicating with the Emic2? Are you using an UART on the Arduino?
    How are you powering your system? Is it possible the Emic2 causes a power spike which brownouts the Arduino?
    If you post your code I'd take a look at it.

  • ercoerco Posts: 20,256

    Per Duane, sounds like a power supply issue. More current needed. Higher capacity battery, fatter wiring, filter & decoupling caps all around.

  • jeffrojeffro Posts: 4
    edited 2022-02-10 15:26

    I was using a 5v 1000 mAH battery pack and that was the issue. Moved up to using a 7.4v 3000 mAH and the problem went away. Now I have a new question in regards to the Emic2.
    Based on the example sketch that is provided with the Emic2.
    I would like to know how to detect when the speech is complete. I was told that it will send a colon when it is complete.
    I do not see how to address this as I would normally with a serial.
    This is how I would do it normally, how do I do it with the emic.

    while (Serial3.available()) 
        char c = Serial3.read();      
        if (c == ':') {
          break; 
        }                  
      }
    
    #include <SoftwareSerial.h>  
    #include <SD.h>  
    #include "EMIC2.h"
    #define RX_PIN 5  
    #define TX_PIN 6  
    EMIC2 emic;  
    
    void setup()
    {
        // Initializes the EMIC2 instance
        // The library sets up a SoftwareSerial port
        // for the communication with the Emic 2 module
        emic.begin(RX_PIN, TX_PIN);
    
        emic.setVoice(8);  // Sets the voice (9 choices: 0 - 8)
    }
    
    void loop()
    {
    
        emic.speak("Hello");
    
    }
    
  • Personally, I'd set up a state machine.
    This would keep track of which activity to perform in each loop. Once the message has been sent to the Emic, I'd have the program monitor the input buffer to see if the message is complete.

    I'm not sure I have an Arduino Mega in working order but I have an ESP32 which should be similar for this purpose. I'll try to write up an example of how I'd do in the next couple of days (hopefully today).

  • Hey Duane
    The whole reason for this is so that when the speech starts I can turn off the Microphone and then when the speech is complete I can turn it back on.

  • I think I found what I was looking for.
    After looking at the code designed to be used with a SD card I saw this.

    // The speak method fetches a file from the SD card
    // and creates one message per line of the file that gets sent to the Emic 2 module
    // Only the filename needs to be provided (file is inside the emic2 folder)
    emic.speak("text001.txt", SD_C);
    emic.ready(); // Waits until playback finishes
    delay(2000);
    emic.speak("text002.txt", SD_C);

    emic.setDefaultSettings();  // Restores all settings to their default values
    

    The emic.ready(); I think is what will do it.
    Which should mean that before the phrase is spoke I can turn off the microphone and say the phrase and then turn the microphone back on.
    Please correct me if I am wrong.
    Thank you
    Jeff

Sign In or Register to comment.