Voice recognition multicommand

I'm now working with a project which need to use a voice recognition module and set a 9 digit of password. But the problem is that the voice recognition module v3 only run 7 command at one time. So, in order for me to proceed to the second group of command, I need to use the switchcommand in order for it to switch ton another group.

Did anyone know how I can speak randomly from 0 to 9 without following the sequence. Below is my code:

/**
  ******************************************************************************
  * @file    vr_sample_multi_cmd.ino
  * @author  JiapengLi
  * @brief   This file provides a demostration on 
              how to implement a multi voice command project (exceed 7 voice command) 
              by using VoiceRecognitionModule
  ******************************************************************************
  * @note:
        voice control led
  ******************************************************************************
  * @section  HISTORY
    
    2013/06/13    Initial version.
  */
  
#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 record[7]; // save record
uint8_t buf[64];

int led = 13;

int group;

#define switchRecord        (0) //hello

#define group0Record1       (1) //0
#define group0Record2       (2) //1
#define group0Record3       (3) //2
#define group0Record4       (4) //3
#define group0Record5       (5) //4
#define group0Record6       (6) //5

#define group1Record1       (7) //6
#define group1Record2       (8) //7
#define group1Record3       (9) //8
#define group1Record4       (10) //9
#define group1Record5       (11) //enter

void setup()
{
  /** initialize */
  myVR.begin(9600);
  
  Serial.begin(115200);
  Serial.println("Elechouse Voice Recognition V3 Module\r\nMulti Commands sample");
  
  pinMode(led, OUTPUT);
    
  if(myVR.clear() == 0){
    Serial.println("Recognizer cleared.");
  }else{
    Serial.println("Not find VoiceRecognitionModule.");
    Serial.println("Please check connection and restart Arduino.");
    while(1);
  }
  
  record[0] = switchRecord;
  record[1] = group0Record1;
  record[2] = group0Record2;
  record[3] = group0Record3;
  record[4] = group0Record4;
  record[5] = group0Record5;
  record[6] = group0Record6;

  group = 0;
 if(myVR.load(record, 7) >= 0){
    printRecord(record, 7);
    Serial.println(F("loaded."));
  }
   
  
}

void loop()
{
  int ret;
  ret = myVR.recognize(buf, 50);
  if(ret>0){

    Serial.print("buf[0] >");
    Serial.print(buf[1]);
    switch(buf[1]){
       
        if(group == 0 || group == 1)
        {
          
            myVR.clear();
            record[1] = group1Record1;
            record[2] = group1Record2;
            record[3] = group1Record3;
            record[4] = group1Record4;
            record[5] = group1Record5;
            
        
          if(myVR.load(record, 7) >= 0)
          {
              printRecord(record, 7);
              Serial.println(F("loaded."));
          }
          else
          {
              
              myVR.clear();
              record[0] = switchRecord;
              record[1] = group0Record1;
              record[2] = group0Record2;
              record[3] = group0Record3;
              record[4] = group0Record4;
              record[5] = group0Record5;
              record[6] = group0Record6;
         
             if(myVR.load(record, 5) >= 0)
             {
                printRecord(record, 5);
                Serial.println(F("loaded."));
             }
          }
 
        }
 
        break;
      default:
        break;
    
    }
    /** voice recognized */
    printVR(buf);
  }
}

/**
  @brief   Print signature, if the character is invisible, 
           print hexible value instead.
  @param   buf     --> command length
           len     --> number of parameters
*/
void printSignature(uint8_t *buf, int len)
{
  int i;
  for(i=0; i<len; i++){
    if(buf[i]>0x19 && buf[i]<0x7F){
      Serial.write(buf[i]);
    }
    else{
      Serial.print("[");
      Serial.print(buf[i], HEX);
      Serial.print("]");
    }
  }
}

/**
  @brief   Print signature, if the character is invisible, 
           print hexible value instead.
  @param   buf  -->  VR module return value when voice is recognized.
             buf[0]  -->  Group mode(FF: None Group, 0x8n: User, 0x0n:System
             buf[1]  -->  number of record which is recognized. 
             buf[2]  -->  Recognizer index(position) value of the recognized record.
             buf[3]  -->  Signature length
             buf[4]~buf[n] --> Signature
*/
void printVR(uint8_t *buf)
{
  Serial.println("VR Index\tGroup\tRecordNum\tSignature");

  Serial.print(buf[2], DEC);
  Serial.print("\t\t");

  if(buf[0] == 0xFF){
    Serial.print("NONE");
  }
  else if(buf[0]&0x80){
    Serial.print("UG ");
    Serial.print(buf[0]&(~0x80), DEC);
  }
  else{
    Serial.print("SG ");
    Serial.print(buf[0], DEC);
  }
  Serial.print("\t");

  Serial.print(buf[1], DEC);
  Serial.print("\t\t");
  if(buf[3]>0){
    printSignature(buf+4, buf[3]);
  }
  else{
    Serial.print("NONE");
  }
//  Serial.println("\r\n");
  Serial.println();
}

void printRecord(uint8_t *buf, uint8_t len)
{
  Serial.print(F("Record: "));
  for(int i=0; i<len; i++){
    Serial.print(buf[i], DEC);
    Serial.print(", ");
  }
}`Preformatted text`

What I would do is set up the voice recognition to recognize the first digit of the passcode plus 6 other digits. When the first digit is recognized, set it up to recognize the second digit and six other digits. Repeat until all digits of the passcode are recognized.

Ya. I have trained the voice recognition module for it to recognize digit 0 until 9. The problem is that I can speak 0 until 6 only. For further proceed to 7,8 and 9, I need to set a command maybe "hello" or anything in order for it to proceed to 7,8 and 9. Because this module only can be recognize 7 word at the same time.

Did you actually read what @johnwasser said?

I not really understand what he said. Can u explain in a more understandable way for me.

Not sure if I can, it seems quite straightforward to me.

You first set up your system to recognise the first number along with 6 other random numbers that doesn't include the first number. You can use the not recognised return result along with the 6 wrong numbers to do what every you need to do when you get a wrong number. Possibly restart the whole sequence.

Then after the first number has been successfully said you change the setup to recognise the second number in the password along with six others chosen at random but not including the second password number.

Repeat this until you have recognised all your password in the right order.

I not sure u have misunderstood my question. Now I need to speak from digit 0 to digit 9. But the problem is that this voice recognition module only can recognize 7 command means digit 0 to digit 6. So in order for me to speak from another digit which is 7 to 9, I need to set a command "hello" to switch and enable second group with digit 7 to 9. To speak again from 0 to 6, hello command need to be speak. So , a switch command is required between this two group.

How can I eliminate this step, in order for me to speak from digit 0 to 9 randomly

And I am certain you have not understood my answer.

We are giving you an answer to your problem but it seems you are not wanting to just actually solver your problem, but to solve your problem, your way.

I don't know how to solve it your way, except perhaps use two voice recognition modules.

So let's see if some one knows how to solve your problem your way.

Good luck.

Ya. I not really understand actually. Can you write an example for one of it? I would be appreciate it, thanks. This project really important for me.

Sorry no, because I haven’t got one of those modules myself so I couldn’t test it.

Yes you do. There is no way the single voice command can be recognised as one of your numbers with more that 7 words. So you have to get clever.

That code you posted switches the settings of your unit when you say the word “Hello”. Make it so that the settings are switched to the second group on recognising the first number of your password, not “Hello”.

Your second set of numbers should change when your second number of your password is said. So for a trial to get the hang of things, make your password just two numbers long, and have the action you want with that.

Get that going first.

Then extend it so your second password number switches to a third set of words before your action.

Get that going and then extend it so that third password number, sets up a fourth set of numbers.

And so on until you have the length of password that you want.

I understand about this. Meaning once I finish said the number from 0 to 6, I use digit 0 to switch to the second set of command which is 7,8,9. Am I right?

Not quite, when you have said the FIRST NUMBER in the password, you automatically switch to another set of words.

But now I no set the password first. I wanna make it to speak from digit 0 to digit 9 randomly. So, I must have set randomly digit in order to switch right?

Did u means that since digit 0 to 6 is first group and 7 to 9 is second group. So, any number I speak from first group, I set it to recognize the 3digit in second group?

No. Why can't you get this, it is very simple?
You need as many groups as you have numbers in your password. The trigger to move onto the next group is your password number.

Maybe you are not experienced enough to do this project and you need more time to learn basic stuff before approaching it.

By the way can u explain again this statement? I have the idea of it ed.

This is the key to getting started.

There is little point in just explaining it again as I have tried this four times already and you are not getting it.

Unless you can ask something specific about the explanation just read through the answers again.

Since digit 0 is my first number, when I speak digit 0, it will switch to second group. So, when something digit from second group is speech l, it will jump back to group 1?

No, you will only switch to group 1 if what is said is not the second number of the password.

If what is said is the second number jump to a third group, or will end successfully if you only have two numbers in your pass word.