Showing posts with label VoiceRecognizerV3. Show all posts
Showing posts with label VoiceRecognizerV3. Show all posts

Saturday, March 17, 2018

Voice Control V3 (2) Software intro

Due to some other activities it has been a while ago that i made my last post. This post is an introduction to the software for the Voice Control V3 Module.
The Voice Control V3 module is a relative cheap module that can recognize 80 words/phrases. However it only can recognize 7 words/phrases at the same time. To recognize sound you first need to train the words/phrases in a training mode. In the recognition mode you can load the phrase identification numbers in special registers. ( I now will use the word phrase in this post but it can also be s word or another sound).
After this the module waits until the trained phrase is recognized and sends a signal.
I used the state machine idea in he software..
Each state has an id, the state id. When the system starts it starts in state one.
When a (new) voice recognition state is entered the 7 phrase id's are loaded in the module and the software waits until one of the 7 phrases is recognized..
When a phrase is recognized two things need to happen:
- An action is performed
- The machine enters a new state. (In this new voice recognition state the seven new (other) phrases are loaded, the module starts listening to [other] phrases until the module comes again in a new state.)
Each state also has a timeout. When no matching phrase has been recognized before a certain time this also triggers entering a new state and action to be performed.

State table for state(n)
State Input Load Output Output
StateN 1 PhraseId ActionId NewStateId
StateN 2 PhraseId ActionId NewStateId
StateN 3 PhraseId ActionId NewStateId
StateN 4 PhraseId ActionId NewStateId
StateN 5 PhraseId ActionId NewStateId
StateN 6 PhraseId ActionId NewStateId
StateN 7 PhraseId ActionId NewStateId
StateN TimeOut TIME ActionId NewStateId

When the actions are programmed the system can be configured loading a data table containing info about the PhraseId's, ActionId's, StateId's for each state like the state table above.
To make the software more robust i want to do the actions at the beginning of the new state after setting the timer for the timeout not at the end. Therefore after receiving the input trigger i immediate change state and pass the ActionId of the action that needs to be executed to the new state.
Steps after entering a new state are:
1) Set the timer for TimeOut.
2) Load new PhraseId's in the voice module.
3) Do the action (that need to be done due to the previous state change).
4) Wait for the new input triggers.
The details can be loaded from a table and some variables like the Previous_ActionId.
TimeOut also protects for timeout of the actions as it is set before the execution of the action. If needed an action can modify or stop and later restart the watchdog timer to give it more time to execute.
Changing a state can only trigger one action. To facilitate execution of multiple actions after receiving a trigger special states are added: A (numerical) range of states do not load PhraseId's and wait for voice command. This states only execute the actions. When the action is ended it immediately enters a new state. 
Special states are also:
0 stop  No actions are executed. The system stops. 
1 boot No actions are executed. All variables are reset This is the first state that will be executed when system powers up. 
Besides the voice input and timeout other triggers can be used to change the state. The module can have hardware like (one one multiple) push buttons or an IRreceiver.
Actions that can be performed also depend on the other hardware. The most simple action is a dummy action that does nothing. Other actions can be e.g. a led (color or blinking), a buzzer to give visual or audio feedback. An IR-transmitter can sends out a IR remote control code, a 433MHz transmitter or bluetooth transmitter for a radio control signal or if connected to an network e.g. a http://request.
Other special actions that could be added are learning actions to learn a new voice command or a IR control code.
However the best is not to make your voice recognizer to complex. Let your home automation system control of your home hardware. Let the voice recognizer module communicate to your home automation system. (and only add a led and a buzzer for some feedback.)
To connect the Voice Recognizer V3 to your home automation system using Wifi is a (simple and cheap)  ESP8266 module (e.g. the Wemos D1 mini) can be used. This will be presented in one of the next posts about this topic.

Wednesday, August 2, 2017

Voice control V3 (Part 1)

An interesting input device is the ElecHouse Voice Recognition Module V3. It comes with a microphone and some pins to solder on the PCB. I ordered my "1set Speed Recognition, Voice Recognition Module V3" module on Aliexpress (between 17 and 18 euro 2017).
Voice Recognizer V3 & Arduino Uno
The question is what can this module do for your projects and how can you use it? The answer is simple: it  can recognize your voice and output a signal depending on the word or short phrase that you have learned the module. The good news is that (according to the spec) you can train this relative cheap module to recognize 80 words or phrases. These words or phrases are stored in memory on the module. The bad news is the module can only recognize 7 different phrases at the same time. And you also need to train the system first with all your phrases.
You can create a system that knows what to do with commands like:

"James light on"
"James light off"
"James light color white"
"James light color green"
"James light color blue"
"James light color yellow"

"James light dim 25"
"James light dim 50"
"James light dim 75"
"James light dim 100"

"James TV off"
"James TV on"
"James TV channel next"
"James TV channel prev"
"James TV channel one"

"James Radio on"
"James Radio off"

And yes, this are much more than 7 phrases! You can do this using a menu structure!

Teach the system all the separate words ("James", "light", "TV" ," Radio" "color" etc.)
Load only the word "James". If the module recognizes "James" load the three words "light" "TV" Radio" if the module recognizes "light", load the words "on" "off" "color" "dim" and build a menu system.
You can get the same (or even better) effect with Amazon Alexa or a Google app on your android. Using this module the voice recognition finds happens inside the module. You do not need internet access and perhaps even more important the privacy: The audio is not transmitted to the internet.

A small disadvantage is that you need to train the module. My first test of the module was with an Ardhuino Uno. The ElecHouse website has a link Arduino library with some examples including a voice training example. Connect GND and VCC (5v) , RXD to Arduino pin 3 and TXD to Arduino pin 2. (If you do not like to use pin 2 and 3 you can use other pins. However you need to make a small change in the software). You only need to connect this four pins on the V3 module (and the included microphone) to a working Arduino to start.

Some info from ElecHouse about the module:
ELECHOUSE Voice Recognition Module is a compact and easy-control speaking recognition board.
This product is a speaker-dependent voice recognition module. It supports up to 80 voice commands in all. Max 7 voice commands could work at the same time. Any sound could be trained as command. Users need to train the module first before let it recognizing any voice command.
This board has 2 controlling ways: Serial Port (full function), General Input Pins (part of function). General Output Pins on the board could generate several kinds of waves while corresponding voice command was recognized.
What's new?
We already have Voice Recognition module V2. It supports 15 commands in all and only 5 commands at the same time.
On V2, voice commands are separated into 3 groups while you training it. And only one group (5 commands) could to be imported into Recognizer. It means only 5 voice commands are effective at the same time.
On V3, voice commands are stored in one large group like a library. Any 7 voice commands in the library could be imported into recognizer. It means 7 commands are effective at the same time.
Parameter
Voltage: 4.5-5.5V
Current: <40mA
Digital Interface: 5V TTL level for UART interface and GPIO
Analog Interface: 3.5mm mono-channel microphone connector + microphone pin interface
Size: 31mm x 50mm
Recognition accuracy: 99% (under ideal environment)
Feature
Support maximum 80 voice commands, with each voice 1500ms (one or two words speaking)
Maximum 7 voice commands effective at same time
library is supplied
Easy Control: UART/GPIO

On internet is a lot more info about this and similar modules. Here is link to a YouTube video : S134 - Voice Recognition Module V3