Serial communication between Voice Recognition Module and Arduino

I still can't get out of this thing. I have this talking clock project using voice recognition (VR) module v3, rtc, wave shield and arduino. My professor asked me to explain step-by-step on how arduino and voice recognition module communicate with each other in a serial 2-wire bus. Here is the scenario:

I have trained a voice command with a signature "time" and it controls the LED (LOW/HIGH). So when I speak "time", the LED will change its state. (LED is being used to test and see to it that the voice command is being recognized)

My concern is what happen in the serial communication between the two during the scenario stated above. There's a VR library reference attached in the link given below. Thanks in advance.

#include <SoftwareSerial.h>
#include "VoiceRecognitionV3.h"

/**        
  Connection
  Arduino    VoiceRecognitionModule
   2   ------->     TX
   3   ------->     RX
*/
VR myVR(2,3);    // 2:RX 3:TX, you can choose your favourite pins.

uint8_t records[7]; // save record
uint8_t buf[64];

int const ledTime = 13

#define timeRecord (0)

void setup() {
  /** initialize */
  myVR.begin(9600);
  
  Serial.begin(115200);
  Serial.println("Elechouse Voice Recognition V3 Module\r\nControl LED sample");
  
  pinMode(ledTime, OUTPUT); digitalWrite(ledTime, HIGH);
    
  if(myVR.clear() == 0){
    Serial.println("Recognizer cleared.");
  }else{
    Serial.println("Not find VoiceRecognitionModule.");
    Serial.println("Please check connection and restart Arduino.");
    while(1);
  }
  if(myVR.load((uint8_t)timeRecord) >= 0){
    Serial.println("timeRecord loaded");
  }

}

void loop() {
  int ret;
  ret = myVR.recognize(buf, 50);
  if(ret>0){
    switch(buf[1]){
      case timeRecord:
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        break;
      default:
        Serial.println("Record function undefined");
        break;
    }
    /** voice recognized */
    printVR(buf);
  }
}

Start here https://en.wikipedia.org/wiki/RS-232https://en.wikipedia.org/wiki/RS-232

I have looked briefly at your program and I have read your Post but I don't understand what you want help with. What is causing a problem?

I suspect the use of delay() here is a bad idea as the Arduino cannot listen for any further messages.

switch(buf[1]){
      case timeRecord:
        digitalWrite(led, LOW);
        delay(1000);
        digitalWrite(led, HIGH);
        break;

Have a look at how millis() is used to manage timing without blocking in several things at a time

...R

Thanks for the reply and for the correction Sir. How about the serial communication between them? Our professor wants to know how arduino and VR module interact with each other during the scenario and I'm gonna explain it to him.

fxlnxjude:
Our professor wants to know how arduino and VR module interact with each other during the scenario and I'm gonna explain it to him.

My guess is that the VR module sends a message to the Arduino and the Arduino program interprets the message.

If you need more detail than that then you need to study the documentation for the VR module. One of us will have to read it and I would much prefer it if you do that.

If there is something specific in the documentation that you don't understand let me know what it is and I will try to help.

...R

I really really appreciate your help sir (Thank you). Yes sir, I already read the documentation more specifically the .load() and .recognize() methods. I also posted last week about this project but I understand a little especially the 'buf' value, and I'm a little bit shy to reply or post with the same project all over again. Sir, could you elaborate further the return value 'buf' when I speak the command 'time', the value stored in variable 'ret', and the length of valid data in buf, in a serial communication way of understanding? Based on the scenario I have posted sir.

buf value.pdf (138 KB)

VR3 Library Reference.pdf (55.3 KB)

If you posted last week about the same problem why have you started a new Thread?

I don't want to waste time giving answers that you have already got from someone else. Please post a link to your earlier Thread.

And, are you asking me to explain how the load() and recognize() methods are used? If so, that Reference PDF does not have enough information. It is just a summary.

I have no idea what the buf value.pdf is or where it came from. It does not seem to be part of the documentation.

...R

I thought you would help sir. I don't know how to explain it to my prof. :sob:

fxlnxjude:
I thought you would help sir. I don't know how to explain it to my prof. :sob:

In my world teachers are paid to explain things to students.

I cannot help without more assistance from you. I mentioned a few things in Reply #6 but you have not responded to them.

...R

Okay sir, I will clarify the problem. When I speak "time" the VR will sense the command, and then what's next? What does the VR send to the Arduino? What does the Arduino do or say? Then what will the VR does after the Arduino did something to it? (until the LED state changed.)

fxlnxjude:
What does the VR send to the Arduino?
What does the Arduino do or say?
Then what will the VR does after the Arduino did something to it? (until the LED state changed.)

I don't know how you expect me to answer those questions.

It is necessary to study the documentation for the VR program to know those answers and you have not posted a link to that documentation.

Another way to figure out what is going on is to study the example code and the code for the VR library carefully. (I'm lazy and I don't propose to do that for you)

Have you added Serial.print() statements to your Arduino program so that you can see what data is received from the VR device?

What the Arduino does should be clear from the Arduino code.

...R

Hello Friend,

According to your Post, I suggesting you learn the Softwareserial communication between Arduino and Voice recognition module? How it will communicate Arduino 2(tx)and 3 (rx) pin and how its sending and receiving data serially.