Example Code for micro:bit-Face Recognition(Mind+)
Last revision 2026/01/20
This article details the process of connecting HuskyLens to micro:bit for face recognition using Mind+, covering hardware setup, software preparation, and coding to display results on the micro:bit's dot-matrix screen.
This chapter demonstrates how to connect HuskyLens to the micro: bit board, then the micro: bit board reads the face recognition results from HuskyLens. If HuskyLens recognizes you (the learned face), the dot-matrix screen of the micro: bit displays a smiling face, otherwise it displays a crying face.
The communication protocol between HuskyLens and micro: bit is I2C.
Mind+ Introduction
Mind+ is a Scratch 3.0-based programming tool, which allows you to build a program by dragging and snapping coding blocks. With tons of tutorials, sample projects and a large community, it is one of the best tools for you to learn programing from absolutely zero!
Mind+ supports a wide range of hardware including Arduino, micro:bit or even a series of ESP32-based educational microcontrollers.
Please view Mind+ official site to download the latest Mind+.
Hardware Preparation
- SEN0305 HuskyLens K210 AI Machine Vision Sensor x1
- MBT0039 micro:bit Board x1
- DFR0518 micro:bit expansion board x1
- FIT0773 Gravity: 4Pin I2C/UART Sensor Cable for Arduino(Included with SEN0305) x1
Wiring Diagram
The following picture is only for reference when wiring. The R and T pins of HuskyLens (their functions are SCL and SDA here) are connected to the SCL (P19) and SDA (P20) pins of the micro: bit respectively. The communication protocol between HuskyLens and micro: bit is I2C.
A micro: bit expansion board is recommended for simplify wiring.

HuskyLens consumes heavy current, up to 3.3V 320mA or more. The mciro: bit board is not enough to supply power. Therefore, external power supply is required. You can connect the external power supply to the external power connector of the micro: bit expansion board or the USB connector of HuskyLens.*
Software Preparation
- Download Mind+: Click to Download
Load HuskyLens Extension
-
In the upper right corner of the Mind+ window, dial the switch to the offline mode.

-
Click the
Extensionsbutton in the lower left corner to view the extensions window. -
Select a board. Here we select the micro:bit.

-
After selecting the board, the corresponding extension labels become selectable. Then click
Sensorlabel, find HuskyLens. Click it to load.You can enter the sensor's name in the search bar in upper right corner when there are many sensors listed in the menu.

-
After selecting the board and extensions, click
Backbutton in the upper left corner to return to the programming window.
HuskyLens Protocol Setting
You need to set the protocol type of HuskyLens. The protocol should be I2C. Of course, your can adopt the auto detect protocol, which is easy-to-use and convenient.

Sample Code
Drag and snap the coding blocks to program, and make a simple face recognition projects. The sample code is shown below.

Results
-
Click the
Connect Devicebutton, then select the COM port corresponding to the microbit.If no COM port is found or you use mcirobit for the first time, please click the
Install Serialport Driverbutton to install the driver with one click.
-
Click the
Uploadbutton to upload the sample code to your micro:bit board.
-
Let your HuskyLens learn your face first.
-
When HuskyLens recognizes your face, the dot-matrix screen on the micro: bit board will show a smiling face. If it were not your face, or no face appeared, it would display a crying face.
Was this article helpful?
