Project 26:QR and Speech Recognition–Based Plant Identification Device

In botanical gardens, community parks or campuses, diverse plants enrich our living environment, but we often know little about them. We've created exclusive QR codes for community plants, storing info like name, age, category and characteristics. To help people identify and learn about plants more easily, we've developed a plant quick-check device using the speech and QR code recognition functions of the UNIHIKER K10. 


Project Objectives


Knowledge Objectives


1.Experience K10’s QR recognition; 
2.Understand QR encoding/decoding principle.


Practical Objective 


Pressing Button A activates the camera to scan QR codes, and pressing Button B enables users to ask about tree growth characteristics using keywords.

Materials List

 


 

HARDWARE LIST
1 UNIHIKER K10
1 USB Cable
1 MicroSD Memory Card
1 Card Reader

Preparations


Hardware


Connect the UNIHIKER K10 to the computer using a USB Cable.

Software


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

Hands-on Practice


Next, we'll use the UNIHIKER K10's camera and speaker to complete a plant quick-search device development in three tasks. 
Task 1: QR Code Recognition of Plants
First, we'll use the UNIHIKER K10's camera to scan plant QR codes and show the corresponding plant names on the screen for plant identification.
Task 2: Multiple Recognition and Display of Complete Plant Information
Then, we'll modify the code based on Task 1. After plant identification, if the A button is continuously pressed, the screen will show relevant plant information.
Task 3: Improve Voice Broadcast of the Device
Last, we'll further improve the plant quick-search device. Press A to recognize QR codes and obtain plant information, and press B for a voice inquiry about plant popular science knowledge. 


Task 1: QR Code Recognition of Plants


Materials Preparation


Use a QR code generator website to create QR codes for three plants respectively, with each QR code storing the plant name.
 

Number

QR Code

Content

1

Camphor Tree

2

Plane Tree

3

Magnolia grandiflora


Code 


The graphical instructions related to QR code recognition for the UNIHIKER K10 are located under the “AI”, and the instructions "switch mode", "detected", and "read QR code content" (as shown below) need to be used respectively.

QR code recognition can be done using the UNIHIKER K10's camera. Under the "Screen", find the "(enable) camera show" block, which is the pre-operation for QR code recognition.

Now, we can implement the program following this logic: Display camera feed→switch to QR code recognition mode→continuously detect QR codes→display results after recognition. The sample implementation code is as follows:


Run the Code


Click the“Upload”buttonand wait for the upload to finish. 
Once the camera feed is displayed on the UNIHIKER K10 screen, aim the device at a QR code for recognition and observe the recognized content on the screen (as shown below). 
Note: Test one QR code at a time; testing multiple QR codes may restart the code.

Code Review


 

Category

Blocks

Function

Show/Disable Camera. Use this command to display or not display the camera screen on the UNIHIKER K10 screen.

The block is used to switch between machine vision algorithm modes and to superimpose the recognition frame on the screen. 
In the corresponding algorithmic mode, it is used to determine whether a face/cat/dog/movement/QR code is detected or not.
Get the result of QR code recognition.


Task 2: Multiple Recognition and Display of Complete Plant Information


We've recognized and displayed QR code information. Now, we need to create detailed plant info images to switch display after recognition. 


Materials Preparation


We need to prepare identity introduction cards for the three plants (Camphor Tree, Plane Tree and Magnolia grandiflora), as shown below.

Code


Next, we can display corresponding card information by judging the recognized content. Also, clear the variables to prevent cards from flashing repeatedly on the screen. The core program is shown below:

Can't display video feed when an image is shown. How to handle this when enabling camera/video feed next time?
Press button A and enable the camera to easily accomplish this. That is, turn off the camera feed display after recognizing a QR code, and turn it on when the A key is pressed.

The complete modified sample program is shown below:

Run the Code

 


Click the“Upload”button and wait for the upload to finish. Then, the initial screen will appear on the UNIHIKER K10 screen. After pressing the A Button, the camera feed will show. Aim at the QR code for recognition, and wait to see the corresponding plant card. 
 


 

Task 3: Improve Device Voice Interaction


Next, we can start to implement the function of acquiring additional popular science knowledge via voice command words by pressing the B Button.


Materials Preparation


Relevant knowledge needs to be prepared for three types of plants (camphor tree, plane tree and magnolia grandiflora), as shown in the table below.

Name

Knowledge content

Camphor tree

Camphor tree is an evergreen tree. It sheds old leaves intensively in spring when new shoots grow, with red fallen leaves. In autumn, it produces small black fruits for birds. 

Plane tree

The plane tree, also called the French phoenix tree, turns bright yellow in autumn, forming golden avenues, an iconic late-autumn landscape in Shanghai. In winter, its twisted branches look elegant. 

Magnolia grandiflora

Magnolia grandiflora produces red follicles in autumn and winter, hanging on branches like brush heads, which is quite interesting. In spring, its new leaves are covered with rust-colored fuzz, as if wearing a "sweater".


Note: Store plant introduction audio files in the TF card in advance, then insert the TF card into the UNIHIKER K10's corresponding slot. The specific paths of relevant audio files are as follows:

Code  


Use Button B to switch voice recognition and conduct keyword inquiry. That is, in the program segment for pressing Button B, we can initialize voice recognition and set command words.

To distinguish between voice interaction and QR code recognition, use a “flag” variable to control functions. For example, set “flag” to 1 for QR code recognition and 2 for voice interaction and inquiry. Then, write the code:


Run the Code


Click the“Upload”buttonand wait for the upload to finish. The initial screen will be displayed on UNIHIKER K10. Press button A, point at the QR code to recognize it and get plant information. Press button B to ask about plant popular science knowledge via voice interaction.

Knowledge Base


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


What Is a QR Code?


A QR code is a square code composed of black-and-white patterns arranged by rules. It stores data and symbolic information in binary form. In a single small block, black dots are 1 and blank areas are 0. When many black and white dots combine, they can express complex binary information. 
Also, apart from data content, QR codes have "return"-shaped positioning markers at three corners to help scanning devices quickly identify direction and position.

Of course, as an information carrier, the core of the scanning device is to quickly parse and restore encoded content. With the wide use of mobile devices, QR codes are now widely used in daily scenarios such as payment, product traceability, and museum guidance. In this project, QR codes are used to bind plant identities for instant information access.


What Is Machine Vision?


In the previous activity, we used the UNIHIKER K10's camera for botanical garden QR code recognition. This is a practical application of machine vision in AI. Machine vision includes key technologies like OCR, face recognition, object detection, image classification, and 3D reconstruction. These technologies form the core framework of machine vision, enabling machines to process and understand visual information such as images and videos. 


Challenge Task


In museums, QR codes are used to obtain cultural relic information. Use the QR code recognition function of the UNIHIKER K10 to get the information in the following QR code, and use TF card to play relevant cultural relic information.

icon project 26.zip 4.99MB Download(0)
License
All Rights
Reserved
licensBg
0