Jython
Deutsch   English 

1. Assembling the mbRobot (Maqueen)

The Micro:Maqueen kit (sources of supply: bastelgarage.ch, www.mouser.ch, www.educatec.ch ) contains an 8 x 8.5 cm board, which the following already assembled components:
  • 2 infrared line trackers
  • buzzer
  • 2 red LEDs
  • 4 neopixels
  • chassis with 2 motors
  • I 2C interface
  • 2 three-pole plugs/sockets for GPIO P1/P2
  • connector  for the micro:bit
  • on/off switch

An ultrasonic sensor, two wheels and a battery holder must be installed.

 

  Additionally you need a micro:bit and three AAA (1.5 V) batteries. For rechargeable batteries you must use nickel-zinc batteries, since they must deliver 1.5 V.
 

Instead of the three AAA batteries, we recommend to buy a Lipo battery (3.7 V, 1.5 Ah) and attach it to the motors with a double-sided adhesive tape. Source of supply www.bastelgarage.ch.

The flat Lipo battery is particularly advantageous if you later want to add an ESP 32 coprocessor for IoT applications.

   


Installing the micro:bit MicroPython firmware
The programs are developed with the TigerJython programming environment. After editing, the program is downloaded via a USB cable to the micro:bit and executed there with a MicroPython interpreter  (a reduced Python version).

Previously MicroPython must be installed on the micro:bit as follows:

Connect the micro:bit to the computer via a USB cable. The micro:bit is recognized as an additional external USB device. (For Windows versions earlier than Windows 10 you have to install a USB driver. The installation file can be downloaded from here: mbed.zip).


Start TigerJython (version 2.16.25 or higher), connect the micro:bit to the computer with a USB cable and select micro:bit/Calliope under Tools/Devices.

Under Tools, click Flash Target. Wait until the copy process is completed and the message All done appears. 

 

 

Testing motors

Start TigerJython and enter the following test program or click on "Copy to clipboard" and paste it with Ctrl + v in the editor window.

Test program:

from mbrobot import *
            
forward()
delay(2000)
stop()  
► Copy to clipboard

  Click on the Download button to start the program.

The two motors should run forward for 2 seconds.

 

With a tiny switch at the back of the Maqueen board the power of all board components is switched on. It is often a good idea to apply power only after downloading the program, especially if the robot immediately starts to move.

A reset button is located on the back of the micro:bit. By clicking on this button, the last downloaded program can be executed again at any time.  

Testing the ultrasonic sensor

Test program:

from mbrobot import *

repeat:
    d = getDistance()
    print(d)
    delay(200)  
► Copy to clipboard

 

 

The distance measured by the ultrasonic sensor is displayed in the terminal window. Place your hand or an object in front of the robot. If the numbers in the terminal window correspond approximately to the distance in millimeters, the ultrasonic sensor functions properly.

Robot Simulation

Many simple programs for the mbRobot can also be executed with a virtual robot (in simulation mode). The robot movements are displayed in a graphics window. Even infrared and ultrasonic sensors as well as LEDs can be simulated. The programs for the real and the virtual robot are practically unchanged.

To execute a program in simulation mode, click the green start button.

  Simulation Real Mode
 

The robot in the graphics window moves a short distance forward.

 

Test program:

from mbrobot import *
            
forward()
delay(2000)
stop()  
► Copy to clipboard