Project 25: Speech Recognition–Based Smart Speaker

Topic Introduction–Artificial Intelligence (AI)


IoT connects things, AI adds intelligent interaction—empowering devices to proactively understand image/voice commands (vs. passive response) and reshape production/life. Powered by algorithm and data, AI enables accurate image recognition, smooth voice interaction, and LLM-based natural language abilities, breaking traditional human-machine collaboration barriers.
In this phase, we will learn AI-related knowledge in accordance with the following logic.

Project 25: Speech Recognition–Based Smart Speaker


Speech recognition, a key AI application, enables machines to understand human language for smooth, natural human-machine interaction. In this lesson, we'll build a smart home assistant with UNIHIKER K10, simulating basic functions of common commercial voice assistants to experience speech recognition in practice.


Project Objectives


Knowledge Objectives


1.Experience speech recognition.
2.Operate UNIHIKER K10 voice recognition.


Practical Objective


Implement an Intelligent Voice Assistant based on the UNIHIKER K10:use voice commands to control it, drive a fan or servo, and play music.


Materials List

HARDWARE LIST
1 UNIHIKER K10
1 USB Cable
1 DC motor fan
1 Module Cable

Preparations


Hardware


Connect the DC Motor Fan to the P0 pin of the UNIHIKER K10 via a module connection cable , then use a USB cable to connect the UNIHIKER K10 to a computer.

Software


Open Mind+ v2, switch to“Upload Mode”, connect the UNIHIKER K10 as shown in the figure below, and load the UNIHIKER K10 library.

Hands-on Practice


Next, using UNIHIKER K10's speech recognition, we'll complete the smart voice assistant via two tasks: voice-controlled device operation and assistant status monitoring.
Task 1: Speech Recognition-Based Device Control
First, we learn how to add command words to realize the control of lights and fans.
Task 2: Monitor the Assistant's Working Status
In this task, we use a program to detect the assistant's working status and improve the function of the recognition device.


Task 1:Speech Recognition-Based Device Control


Code


First, find the speech recognition-related commands under the UNIHIKER K10 category (as shown in the figure below).

Implement voice control of the assistant following the logic of "Initialization Settings→Set Control Commands→Continuously detect whether a command is recognized".

Note: The working status of the voice assistant is divided into wake-up and sleep. Wake-up required for command recognition. Wake-up time refers to duration from wake-up to sleep (unit: ms).
In the "set control commands" function, we can customize and add commands (also called command words). Write them with spaces between each syllable. Detected command words are matched via ID numbers.

Next, let's sort out which commands we need to use to control the devices.

Function

Command word

ID

Turn on the light

light on

0

Turn off the light

light off

1

Turn on the fan

fan on

2

Turn off the fan

fan off

3

According to the table above, copy the code into the program, add the command words in sequence, and set the corresponding ID numbers. The complete sample program is as follows:

Run the Code


Click the“Upload”button, wait for the upload to complete.
Speak "Hi Telly" into the microphone of the UNIHIKER K10. When you see the green LED next to the microphone light up, it indicates that the device has been woken up.

Then, speak the command words and observe the working status of the RGB light and the fan. For example, when you say "light on", the RGB light turns on.

Block Review

Category

Blocks

Function

Set the working length of continuous/single recognition and recognition language after waking up from speech recognition, and the unit of waking up length is milliseconds (ms).
Add speech recognition command word ID and command word, command word ID setting range is 0-199, command word is filled in with a single time, the words are separated by space, and the command word is preferred to be 2~5 syllables.
Used to determine whether the command word with the specified ID is recognized after waking up the K10.


Task 2: Monitor the Assistant's Working Status


Code


We've implemented the smart home assistant's voice device control, but the screen remains black. Now we'll add text to the screen to show the assistant's working status.
The voice assistant has two states: wake-up and sleep. Use the “speech recognition awake?” block to determine its working state, then display the corresponding prompt on the screen based on the result (as shown below).

For better display of execution results, we can also synchronously show the executed command words on the screen (e.g. displays "Light is turned on" when "light on" is recognized). The revised partial program is shown below.

Run the Code


Click the“Upload”button, wait for the upload to complete.
You will see prompt messages are visible on the UNIHIKER K10 screen. Speak "Hi Telly" into its microphone to wake up the assistant, then say a command word and observe the screen changes.

Block Review

Category

Blocks

Function

Used to judge the current state of the speech recognition mode.

Knowledge Base


Next, let's learn and summarize the knowledge used in this lesson.


What is Artificial Intelligence (AI)?


Artificial Intelligence (AI) is technology enabling machines to simulate human intelligent behaviors, such as speech recognition, image processing, natural language understanding, and speech synthesis. Via algorithms and big data analysis, it endows machines with perception, learning, reasoning, and decision-making capabilities. In this course, speech recognition and synthesis — key AI applications — allow devices to "understand" and "express."
The UNIHIKER K10 has built-in basic speech recognition, speech synthesis, and image recognition functions, enabling easy AI application experience. Relevant block commands can be found under the "AI" category on the device.

What is Speech Recognition Technology?


Speech recognition technology enables machines to recognize and understand human speech.
Core process:Microphone collects speech signals → converts to machine - processable signals → extracts acoustic features (pitch, intensity, timbre) via speech processing → AI model identifies corresponding phonemes (e.g./weɪ/ for "way", "we", "weigh", "whey") → determines the exact word through context.

Speech recognition is increasingly widely used in daily life, profoundly transforming people's interaction methods and life experiences. Covering voice assistants, speech translation, automatic customer service responses, speech recognition security and other fields.


Open Domain & Closed Domain


In speech recognition technology, "Open Domain" and "Closed Domain" are distinguished based on the scope of vocabulary they can recognize. Closed Domain is like a small, limited basket of words,while open domain, on the other hand, is like a vast and boundless ocean of language.

Closed Domain is suitable for scenarios that require simple, fast, and accurate command recognition; while Open Domain is more suitable for scenarios that require extensive language recognition capabilities and complex semantic understanding.


Challenge Task


You have finished making the Smart Voice Assistant (mini version), but the functions of smart voice assistants in daily life are far more complex than this—for example, playing music. Please try to implement this function by yourself!

License
All Rights
Reserved
licensBg
0