Intermediate
30 min

Make hands-free control with VC-02 and STM32L073RZ

Control your device using speech

SpeakUp 3 Click with Nucleo-64 with STM32L073RZ MCU

Published Feb 26, 2024

Click board™

SpeakUp 3 Click

Dev. board

Nucleo-64 with STM32L073RZ MCU

Compiler

NECTO Studio

MCU

STM32L073RZ

Pure offline speech recognition solution

A

A

Hardware Overview

How does it work?

SpeakUp 3 Click is based on the VC-02, an offline voice recognition AI module from Ai-Thinker Technology, characterized by high reliability and robust versatility. The VC-02 module uses an integrated voice chip US516P6 from Unisound, which continuously optimizes and innovates algorithms in speech recognition technology. The offline recognition algorithm is deeply integrated with the chip architecture, providing customers with an ultra-low-cost offline voice recognition solution. This board can be widely and quickly applied to all smart small household appliances and products requiring voice control. The US516P6 chip uses a 32-bit RSIC architecture core, running at 240MHz, and incorporates a DSP instruction explicitly set for signal processing and speech recognition, an FPU arithmetic unit that supports floating-point operations, and an FFT accelerator (support 1024-point complex FFT/IFFT operations, or 2048-point real FFT/IFFT operations). What makes this module unique are features like

offline identification of 150 local instructions and self-learning of wake-up words, RTOS lightweight system, 90% recognition rate in a far field distance from 1 up to 5m, firmware update feature, as well as the selection of the communication method with the module. This Click board™ comes with a configurable host interface allowing communication with MCU using the chosen interface. The VC-02 can communicate with MCU using the UART interface, a default communication interface with commonly used UART RX and TX pins, and a default baud rate of 115200bps. Users can also use other interfaces, such as SPI and I2C, to configure the module and write the library by themselves. At the center of the SpeakUp 3 Click, an additional unpopulated header offers full support for debugging and programming capabilities. The Ai-Thinker has provided its users with a VC series development page. With a simple registration, they can create

their own command list/SDK/firmware for this module quickly and easily for free. With this header, the user can use a JTAG interface, in addition to the UART interface, for programming and debugging available through the JTAG interface pins (TCK and TMS). For more information and help when creating custom firmware, you can contact their help center. A special addition to this Click board™ are connectors, marked as MIC and SPK, for an analog omnidirectional microphone and 8Ω 2W cavity speaker from Shenzhen Anxinke Technology. These parts can be found in the same package as the Click board or can be acquired as a solo version in our shop. This Click board™ can only be operated with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.

SpeakUp 3 Click top side image
SpeakUp 3 Click lateral side image
SpeakUp 3 Click bottom side image

Features overview

Development board

Nucleo-64 with STM32L073RZ MCU offers a cost-effective and adaptable platform for developers to explore new ideas and prototype their designs. This board harnesses the versatility of the STM32 microcontroller, enabling users to select the optimal balance of performance and power consumption for their projects. It accommodates the STM32 microcontroller in the LQFP64 package and includes essential components such as a user LED, which doubles as an ARDUINO® signal, alongside user and reset push-buttons, and a 32.768kHz crystal oscillator for precise timing operations. Designed with expansion and flexibility in mind, the Nucleo-64 board features an ARDUINO® Uno V3 expansion connector and ST morpho extension pin

headers, granting complete access to the STM32's I/Os for comprehensive project integration. Power supply options are adaptable, supporting ST-LINK USB VBUS or external power sources, ensuring adaptability in various development environments. The board also has an on-board ST-LINK debugger/programmer with USB re-enumeration capability, simplifying the programming and debugging process. Moreover, the board is designed to simplify advanced development with its external SMPS for efficient Vcore logic supply, support for USB Device full speed or USB SNK/UFP full speed, and built-in cryptographic features, enhancing both the power efficiency and security of projects. Additional connectivity is

provided through dedicated connectors for external SMPS experimentation, a USB connector for the ST-LINK, and a MIPI® debug connector, expanding the possibilities for hardware interfacing and experimentation. Developers will find extensive support through comprehensive free software libraries and examples, courtesy of the STM32Cube MCU Package. This, combined with compatibility with a wide array of Integrated Development Environments (IDEs), including IAR Embedded Workbench®, MDK-ARM, and STM32CubeIDE, ensures a smooth and efficient development experience, allowing users to fully leverage the capabilities of the Nucleo-64 board in their projects.

Nucleo 64 with STM32L073RZ MCU double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M0

MCU Memory (KB)

192

Silicon Vendor

STMicroelectronics

Pin count

64

RAM (Bytes)

20480

You complete me!

Accessories

Click Shield for Nucleo-64 comes equipped with two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-64 board with no effort. This way, Mikroe allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. More than 1537 Click boards™, which can be stacked and integrated, are at your disposal. The STM32 Nucleo-64 boards are based on the microcontrollers in 64-pin packages, a 32-bit MCU with an ARM Cortex M4 processor operating at 84MHz, 512Kb Flash, and 96KB SRAM, divided into two regions where the top section represents the ST-Link/V2 debugger and programmer while the bottom section of the board is an actual development board. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-64 board out of the box, with an additional USB cable connected to the USB mini port on the board. Most of the STM32 microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the STM32 Nucleo-64 board with our Click Shield for Nucleo-64, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.

Click Shield for Nucleo-64 accessories 1 image

Microphone with PH2.0 female connector is an analog-type omnidirectional electret microphone, an electrostatic capacitor-based microphone, and is available with a lead terminated in a PH2.0 female connector. This microphone eliminates the need for a polarizing power supply by using permanently-charged material. With operating frequencies ranging from 100 to 20.000Hz, the microphone features sensitivity ratings as low as -40dB (±3) and signal-to-noise ratios from 57 to 70dBA (typical 60dBA). Housed in a compact package with diameters as small as 6mm, this omnidirectional microphone is ideally suited for various high-quality recordings in industrial and outdoor applications where moisture and environmental contaminants are present.

SpeakUp 3 Click accessories 1 image

Speaker with PH2.0 female connector is an 8Ω 2W portable all-in-one passive cavity speaker available in wire-lead mount configuration with a PH2.0 female connector with an operating frequency of 100kHz. This speaker is characterized by a long service life based on excellent build-material and technology, which enhance its service life, making it convenient and reliable. It is also built on strict quality control standards (design improved for more durability) with a low distortion rate, keeping the sound stable (clear sound quality providing superb music reproductions). Housed in a compact package with dimensions of 40×20×5.8mm (LxWxH), this cavity loudspeaker offers stable performance ideally suited for various audio-producing applications in consumer, medical, security, and many more.

SpeakUp 3 Click accessories 2 image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
NC
NC
CS
SPI Clock
PB3
SCK
SPI Data OUT
PB4
MISO
SPI Data IN
PB5
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
NC
NC
INT
UART TX
PA2
TX
UART RX
PA3
RX
I2C Clock
PB8
SCL
I2C Data
PB9
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

SpeakUp 3 Click Schematic schematic

Step by step

Project assembly

Click Shield for Nucleo-64 accessories 1 image hardware assembly

Start by selecting your development board and Click board™. Begin with the Nucleo-64 with STM32L073RZ MCU as your development board.

Click Shield for Nucleo-64 accessories 1 image hardware assembly
Nucleo 64 with STM32F401RE MCU front image hardware assembly
LTE IoT 5 Click front image hardware assembly
Prog-cut hardware assembly
LTE IoT 5 Click complete accessories setup image hardware assembly
Nucleo-64 with STM32XXX MCU Access MB 1 Mini B Conn - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Clicker 4 for STM32F4 HA MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for SpeakUp 3 Click driver.

Key functions:

  • speakup3_generic_read This function reads a desired number of data bytes by using UART serial interface.

  • speakup3_wait_for_reply This function waits up to @b wait_ms for a reply to the voice command.

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * @file main.c
 * @brief SpeakUp 3 Click Example.
 *
 * # Description
 * This example demonstrates the use of the SpeakUp 3 click board by reading
 * and displaying the voice commands reply messages.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes driver and logger.
 *
 * ## Application Task
 * Waits for the reply message to a voice command and displays it on the USB UART.
 *
 * ## Additional Function
 * - static void speakup3_display_reply ( void )
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "speakup3.h"

static speakup3_t speakup3;
static log_t logger;

/**
 * @brief SpeakUp 3 display reply function.
 * @details This function displays on the USB UART the reply message for the selected
 * reply instruction code.
 * @param[in] reply_ins : Reply instruction code.
 * @return None.
 * @note None.
 */
static void speakup3_display_reply ( uint8_t reply_ins );

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    speakup3_cfg_t speakup3_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    speakup3_cfg_setup( &speakup3_cfg );
    SPEAKUP3_MAP_MIKROBUS( speakup3_cfg, MIKROBUS_1 );
    if ( UART_ERROR == speakup3_init( &speakup3, &speakup3_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    uint8_t reply_ins;
    if ( SPEAKUP3_OK == speakup3_wait_for_reply ( &speakup3, &reply_ins, 1000 ) )
    {
        speakup3_display_reply ( reply_ins );
    }
}

void main ( void ) 
{
    application_init( );

    for ( ; ; ) 
    {
        application_task( );
    }
}

static void speakup3_display_reply ( uint8_t reply_ins )
{
    log_printf( &logger, " Reply: " );
    switch ( reply_ins )
    {
        case SPEAKUP3_INS_ENTER_WAKE_UP:
        {
            log_printf( &logger, "Hi, how can I help? / Hi, what's up? / Yes, I'm here.\r\n" );
            break;
        }
        case SPEAKUP3_INS_EXIT_WAKE_UP:
        {
            log_printf( &logger, "See you later.\r\n" );
            break;
        }
        case SPEAKUP3_INS_LEARN_MATCH_AC:
        {
            log_printf( &logger, "OK, match the air conditioner.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TURN_ON:
        {
            log_printf( &logger, "OK, turn on the air conditioner.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TURN_OFF:
        {
            log_printf( &logger, "OK, turn off the air conditioner.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_MODE_AUTO:
        {
            log_printf( &logger, "OK, automatic mode.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_MODE_COLD:
        {
            log_printf( &logger, "OK, cold mode.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_MODE_HEAT:
        {
            log_printf( &logger, "OK, heat mode.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_MODE_DRY:
        {
            log_printf( &logger, "OK, dry mode.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_MODE_FAN:
        {
            log_printf( &logger, "OK, fan mode.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_MODE_SLEEP:
        {
            log_printf( &logger, "OK, sleeping mode.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_WIND_AUTO:
        {
            log_printf( &logger, "OK, automatic fan.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_WIND_LOW:
        {
            log_printf( &logger, "OK, low fan.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_WIND_MID:
        {
            log_printf( &logger, "OK, medium fan.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_WIND_HIGH:
        {
            log_printf( &logger, "OK, high fan.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_WIND_INC:
        {
            log_printf( &logger, "OK, higher the fan.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_WIND_DEC:
        {
            log_printf( &logger, "OK, lower the fan.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_16:
        {
            log_printf( &logger, "OK, sixteen centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_17:
        {
            log_printf( &logger, "OK, seventeen centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_18:
        {
            log_printf( &logger, "OK, eighteen centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_19:
        {
            log_printf( &logger, "OK, nineteen centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_20:
        {
            log_printf( &logger, "OK, twenty centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_21:
        {
            log_printf( &logger, "OK, twenty one centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_22:
        {
            log_printf( &logger, "OK, twenty two centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_23:
        {
            log_printf( &logger, "OK, twenty three centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_24:
        {
            log_printf( &logger, "OK, twenty four centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_25:
        {
            log_printf( &logger, "OK, twenty five centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_26:
        {
            log_printf( &logger, "OK, twenty six centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_27:
        {
            log_printf( &logger, "OK, twenty seven centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_28:
        {
            log_printf( &logger, "OK, twenty eight centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_29:
        {
            log_printf( &logger, "OK, twenty nine centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_30:
        {
            log_printf( &logger, "OK, thirty centigrade.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_INC:
        {
            log_printf( &logger, "OK, warmer.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_TMP_DEC:
        {
            log_printf( &logger, "OK, cooler.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_SWEPT_ON:
        {
            log_printf( &logger, "OK, start to fan.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_SWEPT_OFF:
        {
            log_printf( &logger, "OK, stop to fan.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_SWEPT_VERT:
        {
            log_printf( &logger, "OK, air swing up and down.\r\n" );
            break;
        }
        case SPEAKUP3_INS_AC_SWEPT_CROSS:
        {
            log_printf( &logger, "OK, air swing left and right.\r\n" );
            break;
        }
        case SPEAKUP3_INS_SET_RESTORE:
        {
            log_printf( &logger, "OK, air conditioner reset.\r\n" );
            break;
        }
        default:
        {
            log_printf( &logger, "Unknown.\r\n" );
            break;
        }
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.