Software Setup & Voice Recognition Training

Software Setup

The software uses Arduino running on the ESP32. Here’s a simple tutorial on setting it up:

https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/

The board I have selected is “ESP32 Dev Module”.

Make certain you can follow their little tutorial, to build / program / run the example. If you’re having trouble programming the board, try pressing the “boot” button for a few seconds during the programming phase.

With Arduino-ESP32 working, there are two Arduino libraries that need to be installed: the SSD1306 OLED, and the Elechouse V3 voice recognition module.

Installing the Adafruit SSD1306 OLED library is very simple. Go here:
https://randomnerdtutorials.com/guide-for-oled-display-with-arduino/

…then scroll down to the “Libraries” section of that webpage, and do that.

Installing the Elechouse Voice Recognition V3 library is only slightly more work. Follow the instructions here:
GitHub – elechouse/VoiceRecognitionV3: Arduino library for elechouse Voice Recognition V3 module

Which is basically just downloading the .zip file and unzipping it into the specified location. BUT, this is an old arduino library which does not fully work on the ESP32. Once you’ve installed the Elechouse library, overwrite four of those files with my updated files from here:

Or if you prefer, you can grab the files individually from github here and here.

The 4 files to overwrite are VoiceRecognitionV3.cpp and .h, vr_sample_bridge.ino and vr_sample_train.ino. The fifth file in the above zip file, scope-control.ino, is the oscilloscope voice control application program.

These are ESP32-specific files; they won’t work on an Atmel / Microchip Arduino. But they do work for ESP32 Arduino. For full details, refer to this webpage:

https://blog.frankvh.com/2022/02/21/esp32-support-for-elechouse-voice-recognition-module-v3/

Restart the Arduino IDE.

 

Voice Recognition Training

The nice thing about the Elechouse module is it uses the same hardware for training as for applying it. I had previously been experimenting with a different system, where training was performed on a PC and then the result downloaded to the ESP32. The problem was using a different audio system (microphone etc) on the PC vs the ESP32 produced an inconsistent end result. Whereas the Elechouse module works reasonably well.

Before using the Elechouse voice recognition module you need to train it to your voice. I trained it with three words, stored in three records:

    • Record 0 = “STOP”
    • Record 1 = “SINGLE”
    • Record 2 = “RUN”

To train, first build / program / run the program “vr_sample_train” as described on the Elechouse github page. The syntax to make the training match my code is:

sigtrain 0 STOP

sigtrain 1 SINGLE

sigtrain 2 RUN

Note the capitals for STOP, SINGLE and RUN. For each record, you can train it as many times as you like until you’re happy. You get two tries for each training.

The vr_sample_train program is good for training, but it’s not great for verifying the training. Once you’ve trained the three words, build / program / run the program “vr_sample_bridge”. Then enter the commands:

01 (to check the voice recognizer)

31 (to clear the voice recognizer)

30 00 01 02 (to load records 0 1 & 2 into the voice recognizer)

Now when you say “stop”, “single” or “run” you should see responses appear on the screen. Specifically, the responses should look like what’s in the code, ie:

uint8_t vr3_stop_msg[]   = {0xAA, 0x0B, 0x0D, 0x00, 0xFF, 0x00, 0x00, 0x04, 0x53, 0x54, 0x4F, 0x50, 0x0A};
uint8_t vr3_single_msg[] = {0xAA, 0x0D, 0x0D, 0x00, 0xFF, 0x01, 0x01, 0x06, 0x53, 0x49, 0x4E, 0x47, 0x4C, 0x45, 0x0A};
uint8_t vr3_run_msg[]    = {0xAA, 0x0A, 0x0D, 0x00, 0xFF, 0x02, 0x02, 0x03, 0x72, 0x75, 0x6E, 0x0A};

If that looks good, build / program / run the “scope-control” program. You will need to edit the wifi_ssid, wifi_password, and scope_ip variables, towards the top of the program, to suit your network.

<< Hardware Software Operation >>