Building a Voice-Activated Robot Car with Wio Terminal and TinyML
This guide demonstrates how to create a voice-activated robot car using the Wio Terminal’s built-in microphone for commands like “go” and “stop” while incorporating TinyML technology.
Training a Wake-Up Word Recognition Model with Codecraft
Utilize Codecraft, supported by Edge Impulse, to train a model for recognizing wake-up words. The steps involved are:
- 1.0 Developing an Embedded Machine Learning Model with Codecraft
- 2.0 Adapting Arduino Text Code for Wio Terminal
- 3.0 Coding for the Robot Car (uKit Explore – Arduino Mega 2560 Based)
- 4.0 Anticipated Outcomes
Understanding UART Serial Communication
UART (Universal Asynchronous Receiver-Transmitter) enables communication between devices like Arduino through transmit (TX) and receive (RX) lines. This facilitates data transfer, as illustrated below:
Refer to SparkFun’s guide for further details.
For instance, by employing UART serial communication, an Arduino UNO can connect to cloud platforms using an ESP8266/ESP32 for IoT applications lacking built-in Wi-Fi.
UART Serial Communication Between Wio Terminal and uKit Explore
Locate the TX (Pin 8) and RX (Pin 10) pins on the Wio Terminal for communication:
TXD – Pin 8
RXD – Pin 10
For uKit Explore, find the TX/RX pins at D0 and D1. Explore the complete pinout details in this guide.
RX0 – D0
TX0 – D1
To connect hardware, link Wio Terminal’s Pin 8 (TXD) to uKit Explore’s Pin D0 (RXD) and Pin 10 (RXD) to uKit Explore’s Pin D1 (TXD).
Training an Embedded Machine Learning Model Using Codecraft
Commence the project by creating a voice recognition model with Codecraft, supporting TinyML applications.
The training process involves:
1. Crafting a “Wake-Up Words Recognition (built-in microphone)” model
2. Acquiring data on-board
3. Training and deploying the model
4. Integrating programming with the model
STEP 1: Creating the “Wake-Up Words Recognition (built-in microphone)” Model
Access Codecraft IDE, select “(for TinyML) Wio Terminal,” and proceed to “Model Creation.”
Choose “Wake-Up Words Recognition (built-in microphone),” name the model, and move to the “Data Acquisition” section.
STEP 2: Data Acquisition (On-board)
In the Data Acquisition interface, modify labels like “hi wio” to “go” and “other words” to “stop” to suit your requirements.
NOTE: Update labels in the default data acquisition program accordingly.
Connecting Wio Terminal for Data Acquisition and Model Training
Make sure to follow these steps to connect your Wio Terminal for data acquisition and model training:
Step 1: Modify Labels and Upload Program
Start by modifying the labels and connecting your Wio Terminal. Upload the data acquisition program for further steps.
Note: To connect and upload code, download the Codecraft Assistant and use the Codecraft online IDE.
For detailed instructions on data collection, refer to the guide in the upper right corner.
Step 2: Training Neural Network
Access the model training interface by clicking on “Training & Deployment”. Choose the neural network size (small, medium, or large) and configure the following parameters:
- Number of training cycles (positive integer)
- Learning rate (0 to 1)
- Minimum confidence rating (0 to 1)
By default, the training cycles are set to 50, but consider increasing them for improved accuracy.
Step 3: Start Training and Review
Initiate the training by clicking “Start training” and monitor the process. Assess accuracy, loss, and overall model performance in the “Model Training Report” once completed.
Step 4: Model Deployment
After training, proceed to “Model Deployment”. Integrate the model with your Wio Terminal in the “Programming” window for further use.