18.5. Cutebot & AI Lens-One Button to Learn

Purpose


  • Use the Cutebot and AI Lens to achieve the one button to learn function.

Materials required


../../../_images/cutebot-16-04.png

Connections:


Steps to install the lithium battery pack:

../../../_images/cutebot-step-01.png

Assembly steps for bricks:

Parts list:

../../../_images/cutebot-step-02.png

Steps of build-up:

../../../_images/cutebot-step-03.png

../../../_images/cutebot-step-04.png

../../../_images/cutebot-step-05.png

../../../_images/cutebot-step-06.png

../../../_images/cutebot-step-07.png

../../../_images/cutebot-step-08.png

../../../_images/cutebot-step-09.png

Connections of the AI Lens:

Connect the RJ11 cable with the AI Lens and the other end in Dupont connection to the circled place in the below picture (make sure you connect to the right connections).

../../../_images/cutebot-step-10.png

Tips: the bricks holder here is flexible to be adjusted, we may manually adjust the angles of the AI lens to meet the requirements of the functions that you want to achieve.

Software Platform:


MicroSoft MakeCode

Programming


Step 1

Click “Advanced” in the drawer to see more choices.

../../../_images/cutebot-pk-1.png

  • We need to add a package for programming. Click “Extensions” in the bottom of the drawer and search with “cutebot” in the dialogue box to download it.

../../../_images/cutebot-pk-11.png

We need to add a package for programming the AI lens kit. Click “Extensions” in the bottom of the drawer and search with “https://github.com/elecfreaks/pxt-PlanetX-AI” in the dialogue box to download it.

../../../_images/cutebot-pk-12.png

Note: If you met a tip indicating that the codebase will be deleted due to incompatibility, you may continue as the tips say or build a new project in the menu.

Step 2

  • In the on start brick, initialize the AI Lens and switch to characters acquisition function.

../../../_images/case-20-011.png

  • While press the button A, set the learnt target as ID1.

../../../_images/case-20-021.png

  • In the “forever” brick, set to get one image form the AI lens. If the ID1 is in the image, we set the color of the headlights in blue and set a √ to display on the screen. Or set the color of the headlights in red and set a × to display on the screen.

../../../_images/case-20-03.png

Code

../../../_images/case-20-04.png

Link: https://makecode.microbit.org/_8Xe7ERhxEgza

You may also download it directly below:

---

Result


  • While pressing button A, set the learnt target as ID1, after learning it, the LED headlights light on in blue and the icon √ is displaying on the screen if ID1 is recognized; or set the LED lights on in red and display icon × .

Exploration


FAQ


Relevant Files