1.Project Introduction
1.1 Project Design
In daily payment scenarios like convenience stores and food stalls, merchants sometimes need to verify if a customer's payment code is correct. This process not only takes time but also risks errors due to hasty operations. Supermarket self-checkout machines have already solved similar problems using image recognition technologyāby "looking at" product barcodes, they can automatically complete the checkout. This intelligent method inspired us: can we simplify the payment code scanning process using the same idea?
In this project, we use HUSKYLENS 2's QR code recognition technology to achieve this: it scans to determine if the object is a payment code. If a payment code is recognized, the micro:bit screen displays "ā"; otherwise, it shows "ā". The entire process requires no manual intervention, offering intuitive feedback. By building this system, you can not only practically apply AI image recognition in payment scenarios but also experience the fun and sense of achievement in transforming "intelligent verification" from a concept into a practical device.
1.2 Demo Video
2.Implementation Principle
The core logic is as follows:
In QR Code Recognition mode, HUSKYLENS 2 uses its built-in AI algorithm to analyze the real-time image captured by the camera and extract information from the QR Code. The system transmits this data to the micro:bit via I2C communication. Upon receiving the QR Code ID and recognition result, the micro:bit performs a corresponding feedback action based on the recognition result: if the recognized QR Code is a payment code (i.e., the QR Code's ID is 1), it displays "ā" on the screen; otherwise, it displays "ā".

3. Hardware and Software Preparation
3.1 Equipment List

Ā
3.2 Software
Ā
Mind+ Graphical Programming Software (Minimum Version Requirement: V1.8.1 RC1.0)
Ā

Ā
3.3 Hardware Connection
Make connections by referring to the diagram below.
Ā

Ā
3.4 Software Preparation
Ā
Download and install the Mind+ installation package (Version 2 and above) Ā from the official website. Double-click to open it after installation.
Ā

Ā
4.Project Making
4.1 HuskyLens 2
First, select the protocol type for HuskyLens 2. Ā
Tap System Settings -> Protocol Type -> Select I2C communication mode, then return to the main menu interface.
Ā

Ā
Second, swipe the screen to find the "QR Code Recognition" function.
Ā

Ā
Direct the HUSKYLENS 2 camera towards a screen containing QR codes. All detected QR codes in the frame will be boxed with white bounding boxes, where the information within each QR code will be displayed.
Ā

Ā
After configuring the parameters and selecting the mode in HuskyLens 2, next, train the model with multiple QR Code to trigger the product adding operation. Follow these steps:
Ā
Align HUSKYLENS 2 with the QR code to be learned, adjust its viewing angle to ensure the "cross" in the center of the screen is within the white box, then press Button-A on its top-right corner to learn this QR code.
Ā

Ā
Upon completion of learning, if a previously learned QR code is detected, the screen will frame it with a colored border, and display the QR code information and ID number above it. For example: Hello world:ID1.
Ā

Ā
For more detailed usage of HuskyLens 2, please refer to the following URL:
https://wiki.dfrobot.com/_SKU_SEN0638_Gravity_HUSKYLENS_2_AI_Camera_Vision_Sensor
After learning about payment codes, you can begin coding to implement a payment verification feedback system based on QR code recognition.
Ā
4.2 Programming
Open the programming software Mind+, choose "Coding" mode, then click "Upload" to create a new project.
Ā

Ā
Next, add the required extensions in Mind+, including micro:bit and HuskyLens 2.
Enter the "Extensions" page, switch to "Board" tab, search for"micro:bit", and click "micro:bit".
Ā


Ā
Click again after downloading until "Remove" appears in the top-right corner to confirm successful loading into the program.
Ā

Ā
Load the "HuskyLens 2 AI Camera" library by the same way from "Module" page.
Ā


Ā
Click the "Back" button to return to the programming interface.
Ā

Ā
Click the "Connect Devices", choose your device and "Connect".
Ā




Ā
After the device is successfully connected, write the program as follows: Ā Ā Ā Ā Ā Ā Ā Ā
Ā

Ā
The analysis of the core code is as follows:
Ā

Ā
There is a complete program file for this project in the attachment. (Note: The .mp file is compatible with both Mind+ v1.x (e.g., v1.8.1) and v2.x (e.g., v2.0), while the .mpcode file only works with Mind+ v2.0)
Open Project->Open Local File to load project.
Ā


Ā
Select the project in the attachment and click "Open".
Ā

Ā
Click "Upload" to run the program.
Ā

Ā
The effect is as follows:
Ā


Ā
5. Attachment









