Cutebot - Getting Started Image by Freepik

Cutebot - Getting Started

In this series of tutorials we will be using the Python programming language to instruct a robot car, the Elecfreaks Smart CuteBot, to perform a range of tasks including basic movements, line tracking, and light & object detection. In this tutorial, we will provide a tour of the Smart CuteBot robot car and instructions to connect it to the Microsoft MakeCode browser-based code editor.

1. Hardware Requirements

You will require the following hardware components and accessories to follow this tutorial.

1.1. Components
1.2. Accessories

2. Smart CuteBot

The robot car that we will be using in this series of tutorials is the Elecfreaks Smart Cutebot - a rear-drive smart car designed for the BBC Micro:bit. The following subsections provide a brief tour of the main features found on the Smart CuteBot.

Elecfreaks Smart CuteBot
Elecfreaks Smart CuteBot
2.1. Wheels

The Smart CuteBot consists of two rear-drive wheels powered by a high-speed DC motor capable of 300RPM.

CuteBot DC-powered wheels
CuteBot DC-powered wheels
2.2. Battery Compartment

The Smart CuteBot requires 3 x AAA 1.5V alkaline batteries which are placed in its integrated battery compartment.

CuteBot battery compartment
CuteBot battery compartment
2.3. Line Tracking Sensors

The Smart CuteBot features two line-tracking sensors enabling it to detect black lines and their edges.

CuteBot line tracking sensors
CuteBot line tracking sensors
2.4. Ultrasonic Sensors

The Smart CuteBot features an ultrasonic sensor enabling it to detect objects in front of it.

CuteBot ultrasonic sensor
CuteBot ultrasonic sensor

3. Micro:bit Code Editor

In order for the Smart CuteBot to perform specified actions, we need to program the Micro:bit with relevant instructions. To do this, we require a Micro:bit code editor. An online-based Micro:bit code editor enables you to develop the code for your Micro:bit entirely within your internet browser. When your program is ready, you can transfer the program to the Micro:bit via a USB cable - this transfer process is called flashing.

3.1. Microsoft MakeCode

In this series of tutorials, we will be using Microsoft MakeCode - an online, visually colour-coded and block-based code editor for the Micro:bit, designed for beginner programmers. To access Microsoft MakeCode, please visit https://makecode.microbit.org in your internet browser. To create a new coding project, select "New Project", enter a project name, and select the "Create" button, as illustrated in the image below.

Microsoft MakeCode - Create a new project
MakeCode - Create a new project
3.2. Python Editor

Microsoft MakeCode also supports JavaScript and Python text-based code development. In this series of tutorials, we will be coding instructions in Python. To open the Python editor in Microsoft MakeCode, select the "Python" option from the dropdown menu at the top of the Microsoft MakeCode interface as illustrated in the image below.

Microsoft MakeCode - Python editor
MakeCode - Python editor
3.3. CuteBot Extension

In order to develop programs for the Smart CuteBot, we need to import the CuteBot extension into Microsoft MakeCode. The CuteBot extension is a library of pre-developed code that enables our code to take advantage of all the CuteBot features such as basic movements, line tracking and measuring distances to objects. To import the CuteBot extension into Microsoft MakeCode:

  1. Select "Extensions" from the vertical menu of options in the Microsoft MakeCode editor screen.
  2. In the resultant "Extensions" screen, search for "cutebot" (as illustrated in the image below).
  3. Click on the "cutebot" extension (NOT the Cutebot-Pro extension).
  4. After the extension has been successfully imported, you will see the "CuteBot" extension listed in the same vertical menu of options in the Microsoft MakeCode editor screen.
Microsoft MakeCode - CuteBot extension
MakeCode - CuteBot extension
3.4. WebUSB Direct Flashing

Flashing the Micro:bit refers to the process of transferring your completed program to the Micro:bit's flash memory. In this series of tutorials, we shall use the WebUSB direct flashing method. This method involves physically connecting your Micro:bit to your computer via a USB cable, and then transferring your program directly from Microsoft MakeCode in your internet browser to the Micro:bit's flash memory by selecting the "Download" button (which uses the WebUSB API - a protocol that provides a way to safely expose USB devices to the web). Please refer to the instructions and/or video below to prepare the Micro:bit for flashing using Microsoft MakeCode.

  1. Physically connect the Micro:bit, which is connected to the Smart CuteBot, to your computer via a USB to Micro-USB (Type B) cable.
  2. In the Microsoft MakeCode editor screen, select the three dots next to the "Download" button.
  3. Select "Connect Device" from the resultant menu.
  4. Select your BBC Micro:bit device from the pop-up window, and then press the "Connect" button.
  5. A USB logo will now appear on the "Download" button. Now every time you select the "Download" button, your code will transfer directly to the Micro:bit.

4. Quick Start Summary

Please refer to the instructions below for a summary of the steps to prepare your Smart CuteBot for programming.

  1. Assemble the Smart CuteBot - attach the Micro:bit V2 (sold separately) and ultrasonic sensor to the base CuteBot unit, and insert 3 x AAA 1.5V alkaline batteries into the integrated battery compartment.
  2. Navigate to Microsoft MakeCode in your internet browser, and create a new project.
  3. Select the Python editor in Microsoft MakeCode.
  4. Import the CuteBot extension into Microsoft MakeCode.
  5. Physically connect the Micro:bit, which is now attached to the Smart CuteBot, to your computer using a USB to Micro-USB (Type B) cable.
  6. Select the "Connect Device" option in Microsoft MakeCode to enable direct flashing via the WebUSB protocol.

You are now ready to start programming the Micro:bit and hence the Smart CuteBot too!

Jillur Quddus
Written by

Jillur Quddus

Computational Mathematician @ HyperLearning AI