Use mBot with App Inventor


A new version (V1.9) has been released! It’s easier to use, especially in environments with multiple robots. Take a look now.
MIT App Inventor is a drag-and-drop block-based editor which can make Android Apps. You can use App Inventor to control mBots through an extension.

Add the mBot extension to App Inventor

You need an App Inventor website that supports extensions. One example is Login and start a new project.
In the “Extension” group of the left panel, click “Import Extension” link, then select “URL”. Paste the following linke to the text box:
Then click “import”. 
In the next screen, click “OK”. Then You will find a new “mBot” component in the “Extension” group:
Screen Shot 2016-05-23 at 3.32.35 PM

Connect to your mBot through a ListPicker

Drag a ListPicker component to the canvas, and add a mBot component (it is a non-visible component, won’t shown up in the phone screen but will be at the bottom of the phone screen):
Write a program like the following picture using blocks from ListPicker and mBot. When run, this will create a list of paired mBot robots (you need to link the mBot with the Android system’s Bluetooth setting screen at first use), and allow users to select and connect to one of the robot.
Screen Shot 2016-05-23 at 3.26.48 PM

Write Programs with App Inventor

When connected, you can control mBot and read from its sensors with any of blocks provided by the mBot extension. The following program is an example:
Screen Shot 2016-05-23 at 3.26.58 PM
Here is a list of blocks you can use to write your program:
 Screen Shot 2016-05-23 at 3.37.55 PM Make the robot move forward at a certain speed (number of 0-255)
Screen Shot 2016-05-23 at 3.37.59 PM Make the robot move backward at a certain speed (number of 0-255)
Screen Shot 2016-05-23 at 3.38.02 PM Make the robot turn left at a certain speed (number of 0-255)
 Screen Shot 2016-05-23 at 3.38.05 PM Make the robot turn right at a certain speed (number of 0-255)
 Screen Shot 2016-05-23 at 3.38.08 PM set the speed of both motors (0-255) of the connected mBot. This is for advanced control
 Screen Shot 2016-05-23 at 3.38.19 PM Make the mBot stop moving
 Screen Shot 2016-05-23 at 3.38.12 PM light up the mBot’s on-board RGD LEDs with a certain color.

“whichLight” field accept a number: (0: both lights, 1: right light, 2- left light).

 Screen Shot 2016-05-23 at 3.38.16 PM Play a musical note using the internal buzzer of mBot.

duration is in milliseconds, and frequency is for the pitch.

 Screen Shot 2016-05-23 at 3.38.21 PM read the value of the lightness sensor.
 Screen Shot 2016-05-23 at 3.38.25 PM read the value of the ultrasonic sensor. Usually connected to port 3.
 Screen Shot 2016-06-22 at 6.30.50 PM read the value of the temperature sensor (in Celsius degrees).
 Screen Shot 2016-06-22 at 6.29.57 PM read the value of the humidity sensor (in percentage).
 Screen Shot 2016-05-23 at 3.38.32 PM get a list of available mBot robots. Used in Bluetooth connection
 Screen Shot 2016-05-23 at 3.38.35 PM connect to a mBot with the certain address,

usually an item from the “availableRobots” list.

22 thoughts on “Use mBot with App Inventor”

    1. You can use the gyro/compass come with Android phones directly with App Inventor – they are provided as default.

      At current stage, this extension doesn’t contain blocks controlling Makeblock’s gyro module.
      If you have one, what do you want to make with that?

  1. Hello, I was currently testing the AppInventor mBot Extension with Me Orion and I was glad to notice that the ultrassonic sensor and the lightness sensor work alright, but I was wondering why the temperature sensor doesn’t. Would it be because the AppInventor blocks lack the RJ25 Adapter Slot (1 or 2) selection? Has anyone managed or even tried doing this?

    Thanks for any help you can give,

    1. Hi Thiago,

      We only developed the App Inventor to work with mBot. For using on Orion board,I am afraid that we do not have the ability to help, you may need figure it out by yourself.

  2. Hi,
    i succesfuly drive my mbot with yours instructions! thanks. But i would like to control a servo-motor plugged in port 1 of my robot and i don’t find any help to do this.
    I succed with a mblock program but there is no instruction like: “set servo port1 slot1 angle 90” under this mbot extension. I thank you if you could help me.

    1. Hi,

      The servo setting command is not included yet. Thanks for your interest in mBot App Inventor extension.

  3. Nice work, but… how could I disconnect the robot from my App?
    There’s no “Mbot1.DisconnectFromRobot” block, and I need it, because I’m sharing my robot with my students.

  4. Hi,
    thank you for this great work !

    Like Emmnuel, I would like to control a servo on pin 1 for example.
    Is the developpement of this functionality in progress ?
    It would be very helpful for my students.



  5. Hi, the App Inventor extension works really great with my older phones (Android 6.0.1), but on my just new phone (Somy Xperia XZ1 compact (Android 8.0.0) it does not work.
    The new phone sees the mBot in the Bluetooth section, but it does not want to pair (which should not be necessary anyway, I know) and using the example app (that works fine on the other phone), I only see the message that I should move closer and even on top of the mBot it does not connect.
    I am wondering, is this the new Android, my phone or the mBot AI extension that has a problem?
    Cheers, Ghica

  6. Hi Makeblock Team,

    I appreciate your work for the App Inventor Extention. I was wondering, do makeblock have an extension for Orion as well. If not, is there a chance of working on the same in future. I am robotics trainer. It would be really helpful if your reply.

  7. Hi there,
    I made the app but my android tablet is simply not connecting to the mBot via bluetooth. It sees the mBot but has an error while connecting. Any ideas on how to fix it?

Leave a Reply

Your email address will not be published. Required fields are marked *