This article will take you through the process of creating a custom natural-language understanding model that runs fully on-device using Picovoice Rhino Speech-to-Intent Engine, and deploying it into Arduino Nano 33 BLE . The entire process will take less than 15 minutes from the start to a working demo! Things you need to follow along:

The process can be broken down into three main steps:

Create an NLU Model

  1. Sign up for Picovoice Console if you haven't already.
  2. On Picovoice Console, go to the Rhino Page.
  3. Click on New Context.
  4. Enter a name for your model; I went with arduino_coffee_maker.
  5. Select the language for your model; English in our case.
  6. Choose Coffee maker from the list of available templates.
Train context using Picovoice Console - Phase A
  1. Click on Create Context; this will take you to the context editor.
Train context using Picovoice Console - Phase B
  1. The Coffee maker template only has one intent, orderBeverage, and three slots, beverage, size, and numberOfShots. Let's make it more interesting by adding one more intent, donateBeverage and one more beverage type:
    • Inside the new intent box inside the left panel, type donateBeverage and click on the + button
    • Click on the donateBeverage intent to open the expression editor
    • Add a new expression by typing I would like to donate a $beverage:donation and clicking on the + button. This expression will match phrases like I would like to donate a coffee or I would like to donate a cappuccino.
    • Click on the beverage slot to open the slot editor
    • Type your favorite beverage, chai in my case, and click on the + button
Train context using Picovoice Console - Phase C
  1. You can try out your context within your browser by clicking on the mic button on the right side of the editor as you modify it.

  2. Once you are happy with your context, save it.

Train an NLU Model for Arduino

  1. Click on the Download button.
  2. Pick ARM Cortex-M as the platform.
  3. Select Arduino Nano 33 BLE as your board type.
Download context model
  1. Enter the UUID for your board. To get the UUID:
    • Open the Arduino IDE
    • Download Picovoice_EN library
    • Run the GetUUID example from Picovoice_EN
    • Check the Serial Monitor to find the UUID of your board. Copy and paste it into the UUID field in the console
Grab UUID of the board
Picovoice SDK makes use of Picovoice Porcupine Wake Word Engine to detect utterances of given wake word, then employs Picovoice Rhino Speech-to-Intent Engine to extract intent from the follow-on spoken command within a given domain of interest (a "context").
  1. Click on the Download button. You should have a .zip file in your download folder now.

  2. Unzip it. Open the header file with a text editor. The CONTEXT_ARRAY[] contains your custom context model!

Deploy into Arduino Nano 33 BLE

  1. Open the Picovoice_EN example from the library.
  2. Replace CONTEXT_ARRAY[] defined in params.h with the one you just generated.
  3. Go to Picovoice Console's dashboard. Copy your AccessKey.
Copy AccessKey
  1. Put your AccessKey in PicovoiceExample.ino. Don't forget to wrap it in " and terminate the line with ;!
  2. Upload the sketch to your Arduino Nano 33 BLE Sense board.
  3. Open the Serial Monitor and say Picovoice, I would like to donate a chai. You should see the following output:

Picovoice SDK enables developers to create production-quality voice models within minutes. It runs on anything, including Arduino Nano 33 BLE and Arduino Portenta H7. Picovoice SDK is also available on STM32, NXP i.MX RT , Raspberry Pi, BeagleBone, NVIDIA Jetson, Android, iOS, web browsers, Linux, macOS, and Windows!

What's Next?

Learn More About Rhino

To learn more about Picovoice Rhino Speech-to-Intent Engine and the context editor, check out the following resources:

Custom Wake Word

In this demo, we used the default wake word, Picovoice. To learn how to train your own wake word, check out Arduino Voice Recognition in 10 Minutes or Less.

Non-English Models

Picovoice supports a wide range of languages, and the list is growing. If you train your models in a language other than English, you need to also use the corresponding library. For instance, if you train your models in German, you need to use Picovoice_DE library. You can find the list of supported languages and their corresponding libraries on the Arduino Quick Start page.