Skip to content

Search the documentation

Kit
Firmware

Mini

The Mini is a small wheeled robot with lights and a buzzer. You drive it from the MoBot app, and you can also write Python for it. It is sold on the website as the Smart Car Mini. In Python you reach every part of it through one object, called robot.

Chip ESP32
Motor driver DRV8833
Link to your phone Bluetooth, to the MoBot app
In code robot
Current firmware 3.0.2
Pins Mini pins

The website lists these parts in the box: the MoBoard board, two DC motors, wheels, a caster wheel and a holder for 6 AA batteries (the batteries are not included).

Every part is an attribute of robot. Click the class name to open its reference page.

Part In code Reference What it does
Bluetooth link robot.bluetooth BLEController The robot’s Bluetooth link to the MoBot app on your phone.
Game Pad robot.gamepad Gamepad The Game Pad in the MoBot app on your phone, received over Bluetooth.
LED 1 robot.led1 Led One of the robot’s lights (led1 or led2); brightness is in percent, 0 to 100.
LED 2 robot.led2 Led One of the robot’s lights (led1 or led2); brightness is in percent, 0 to 100.
Buzzer robot.buzzer Buzzer The robot’s buzzer: it plays songs in the background while your program goes on.
RGB LED robot.rgb_led RGBLed The robot’s colour light; colours are red, green and blue from 0 to 255, brightness in percent.
Left motor robot.left_motor DRV8833Motor One drive motor of the robot (left_motor or right_motor); speeds are in percent.
Right motor robot.right_motor DRV8833Motor One drive motor of the robot (left_motor or right_motor); speeds are in percent.
Distance sensor robot.distance_sensor DistanceSensor Measures how far away something is. It sends out a short burst of ultrasound, a sound too high for us to hear, and times how long the echo takes to come back, like a bat.
Line sensor (two eyes) robot.line_sensor LineSensor Sees a dark line on a light floor. Each eye shines infrared light at the ground and measures how much bounces back: dark surfaces send back less.

Other things on robot:

In code What it does
robot.name The robot’s Bluetooth name, as the MoBot app shows it.
robot.mode The robot’s mode number: 255 is Programmable (your program), the others are the app’s modes.
robot.set_name(name) Gives the robot a new Bluetooth name (text, not empty); it is kept after power-off.
robot.enable_distance_sensor() Switches on the distance sensor, robot.distance_sensor (it shares its two pins with the line sensor).
robot.enable_line_sensor() Switches on the line sensor’s two eyes, robot.line_sensor (they share their pins with the distance sensor).

The mobot module has two helpers: from mobot import map_range, sleep_ms. The built-in songs are in SONGS: from indicators import SONGS. They are on the Mini reference page.

The distance sensor and the line sensor share pins

Section titled “The distance sensor and the line sensor share pins”

The distance sensor and the line sensor use the same two pins, GPIO 26 and 27. Both are off until you switch one on, and you use one or the other:

  • robot.enable_distance_sensor() switches on robot.distance_sensor.
  • robot.enable_line_sensor() switches on robot.line_sensor, which has two eyes: a list with the left eye first, then the right eye.

See Shared pins. The website lists the Mini as expandable.

A part that did not start is None. The robot prints a line such as Left motor init error: and carries on. Check for None before you use a part that matters.

Firmware 3.0 renamed some of these. A robot that still runs 2.x needs the old names.

Firmware 3.0 Firmware 2.x
robot.bluetooth mobotMINI.ble
robot.gamepad.x, robot.gamepad.y mobotMINI.ble.x, mobotMINI.ble.y
robot.gamepad.is_pressed(name) mobotMINI.ble.isPressed[name]
robot.rgb_led mobotMINI.rgb
robot.distance_sensor mobotMINI.ultrasonic
robot.line_sensor mobotMINI.left_ir and mobotMINI.right_ir
robot.name mobotMINI.ble.mobot_name
robot.set_name(name) mobotMINI.ble.changeName(name)
robot.mode mobotMINI.ble.control_mode
robot.enable_distance_sensor() mobotMINI.initUltrasonic()
robot.enable_line_sensor() mobotMINI.initIRs()

Every other part has the same name on both: led1, led2, buzzer, left_motor and right_motor. The calls on each part were renamed too. See Names from 2.x to 3.0.

The MoBot app can put the Mini in a mode. Each mode has a number, and robot.mode tells you which one is running. The Name column gives the name the firmware uses, and the name on the app’s tile where it differs.

Number Name What it does
0 Manual (the app calls it Manual driving) You drive with the Game Pad in the MoBot app. If the app is quiet for half a second, or the phone disconnects, the motors, the buzzer and the RGB LED switch off.
1 Programmable Sequence Plays a list of steps that you build in the app: moves, sounds and lights. It waits for the app to send Go, and it can loop.
2 Piano (the app calls it Piano mode) The piano keys in the app play notes on the buzzer, and the RGB LED flashes with each note.
3 Police (the app calls it Police mode) A looping police siren, with LED 1 and LED 2 taking turns and a blue flash on the RGB LED. No motors. It starts when the app sends Go.
4 Ambulance (the app calls it Ambulance mode) A looping two-tone ambulance siren, with LED 1 and LED 2 taking turns and a red flash on the RGB LED. No motors. It starts when the app sends Go.
255 Programmable Your program runs.
  • Drive. robot.left_motor.forward(speed) and backward(speed) turn a wheel at a speed from 0 to 100 percent. drive(speed) takes a speed from -100 to 100, and a negative speed means backward. stop() lets the wheel roll to a stop, and brake() stops it at once.
  • Make light and sound. robot.led1.on() and robot.led1.set_brightness(percent) control a light. robot.rgb_led.set_color(r, g, b) lights the colour LED, each colour from 0 to 255. robot.rgb_led.rainbow() and blink(r, g, b) start effects, and you call robot.rgb_led.tick() in your loop to move them on. robot.buzzer.play_song(song) starts a song and returns at once.
  • Measure distance. After robot.enable_distance_sensor(), robot.distance_sensor.distance_cm() gives centimetres. A clear space in front of the sensor reads 200 centimetres. A reading of -1 means the driver reported an error, which is rare.
  • Follow a line. After robot.enable_line_sensor(), robot.line_sensor.read() gives two 0 and 1 values, the left eye first.
  • Listen to your phone. The Game Pad in the MoBot app reaches your program as robot.gamepad.x, robot.gamepad.y and robot.gamepad.is_pressed("a"). robot.bluetooth.is_connected() tells you whether a phone is connected.
  • Name your robot. robot.set_name("Pip") changes the Bluetooth name the app shows. It is kept after power-off.

Each of these has a full reference page. Start from the table above.

On the Mini, the USB link that you use to program and update the robot comes from the programming module. The website says the module is required for the blocks editor and for flashing, and that it is sold separately.