1 Project Introduction
Have you ever had the experience of wanting to buy apples, but spending ages searching for the corresponding code at the weighing counter? This project uses the UNIHIKER M10 combined with Self-Learning Classifier technology to create an intelligent scale tailored for supermarket scenarios. This device is perfectly suited for self-service weighing areas in community convenience stores and small supermarkets. Customers simply place items such as vegetables and fruits on the scale, and can quickly get the price without manually entering the category. It saves time for cashiers and makes checkout more convenient for customers.
The Self-Learning Classifier technology ensures accurate product recognition, while the weighing module provides precise weight data. Together, these deliver more efficient pricing, and the combination of screen display and voice prompts enhances the user experience. This solution directly addresses the common issues of slow manual weighing and errors in small supermarkets. From model training to price generation, this comprehensive workflow vividly demonstrates how AI technology can be easily implemented in daily life. It makes Self-Learning Classifier technology more life-oriented, user-friendly, and ultimately improves the overall shopping experience!
Demo Video
2. Project Implementation Principle
Its core logic is as follows: HuskyLens 2, in Self-Learning Classifier mode, performs incremental learning on product samples (e.g., images of apples and oranges) through built-in AI algorithms to establish a self-learning classification model. When the user places a product within the camera's detection range, the sensor collects images in real-time, completes inference locally, outputs the object's unique ID and corresponding name, and transmits the result to UNIHIKER M10 via the I2C interface.
UNIHIKER M10 is connected to a weight sensor via the I2C interface, which converts physical weight into electrical signals and calculates the weight value(in grams). After receiving HuskyLens 2's classification result, UNIHIKER M10 calculates the total price based on the preset commodity unit price and the weight value. Finally, it displays the product name, weight, and total price on the UNIHIKER M10 screen, completing the full process of recognition → weight detection → computation → display.

3. Hardware and Software Preparation
3.1 Equipment List
Note: HuskyLens requires Version HuskyLens 2.
Software: Mind+ Graphical Programming Software
3.2 Hardware Connection
Make connections by referring to the diagram below.

3.3 Software Preparation
Download and install the Mind+ installation package(Version 2 or 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 "Self-Learning Classification" function.

Learn all products by following the next instructions:
Learn an Object
Align HuskyLens 2 with the object to be learned, keep it within the yellow frame, then press Button A on its top-right corner to learn it.

Object Recognition
When an already learned object is detected, the screen will frame it with a colored box, and display "name: IDx Confidence" above it, for example, "Object: ID1 97%". Here, "name" defaults to "Object"; "ID1" refers to the first object learned; "97%" indicates a confidence level of 97%.

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 objects learning in HuskyLens 2, you can start writing code to implement a smart visual scale based on self-learning classification.
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 UNIHIKER M10, HuskyLens 2 and weight sensor.
Enter the "Extensions" page, switch to "Board" tab, search for"M10", and click "UNIHIKER M10".



Load the "HuskyLens 2 AI Camera" and “weight sensor”libraries by the same way from.

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

Expand the "Local Terminal", choose your device for connecting.


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 "Run" to run the program.

Note: After running the program, keep the scale unloaded (for zero calibration of the weight sensor) until the screen displays "no product". Then place the item on the scale to weigh it, to avoid initial loads affecting the accuracy of the weight data.

The effect is as follows:


5. Attachment









