How to Use Scratch or Arduino to Program a MBot With Makeblock




Posted in TechnologyRobots

Introduction: How to Use Scratch or Arduino to Program a MBot With Makeblock

A few days ago, I made a robot by Makeblock. We call it mBot---a robot better fit education and home use. It is simple to use, and more affordable. We believe this is the best robotic product in its category.

The mBot is designed especially for mBlock to help teachers and kids to have hands-on experience about robot and explore STEM education.

By the way, this project will probably issue on kickstarteraround March 17.

Now I will show you how to build it by steps.

Step 1: Introduction of Mblock

The mBlock is a customized version of Scratch which is a graphic programming language(developed by the lifelong kindergarten group at MIT Media Lab). With mBlock, those who are familiar with Scratch can easily interact with electronic modules in Arduino eco-system. Its electronic modules is based on Arduino open source platform, and mechanical parts are compatible with Makeblock parts and lego parts, so it is easy for you to extend.

Step 2: Tools You Need

Step 3: Mechanical Part List

1*Metal Base Plate

2*TT Gear Motor



1*Plastic Universal Wheel

1*Magic Tape 20*30mm

6*Brass Stud M4*25

14*Socket Cap Screw M4*8

6*Nut M4

4*Nut M3

4*Philip's Head Screw M3*25

2*Tapping Screw M2.2*9.5

Step 4: Electronic Modules List:

1*Arduino Based Control Board

1*Me Ultrasonic Sensor V3.0

1*Me Line Follower V2.2

1*Me Infrared Controller


1*Battery Holder for (4)AA

4*RJ25 Cable

1*USB A-Male to B-Male Cable

Step 5: Build the Mechanical Part

The construction of mechanical part mainly is building the motors and wheels, and the motors are TT Gear Motor, which are usual in our lives. To assembling them together is very convenient, because you just need to tighten several screws. The pictures above will show you some details in assembling processes.

Step 6: Build the Electronic Part

The construction of the electronic part mainly is building the electronic modules together and wiring. The electronic modules that you will use include the Line Follower module, the Ultrasonic Sensor module, the Bluetooth module and the Arduino Based Control Board. (The Bluetooth module and the Arduino Base Control Board are fixed together already.) I will show you the details in assembling process as pictures above.

Step 7: Use the Scratch (mBlock) to Programming

The mBlock is a customized version of scratch. It is easy to use mBlock to interact with electronic modules.

For more information about mBlock, please visit mBlock website listed below:

Step 8: Use the Arduino IDE to Programming

Arduino is an open-source electronics platform based on easy-to-use hardware and software. It’s intended for anyone making interactive projects. The Arduino development environment makes it easy to write code and upload it to the I/O board. You can use Arduino language (C\C++) to interace with Arduino hardware. We provide a complete Arduino using environment.

Following is one simple code for controlling the mBot by Infrared Controller.

#include "mBot.h"
#include "MePort.h"
MeBoard myBoard(mBot);
#include "MeIR.h"
#include "MeDCMotor.h"
double angle_rad = PI/180.0;
double angle_deg = 180.0/PI;
MeIR ir;
MeDCMotor motor_9((MEPORT)9);
MeDCMotor motor_10((MEPORT)10);
void setup(){
void loop(){


For more information about Arduino, please visit website listed below:

Step 9: Playing With It!

We can use the mBot built by ourselves to play some games or make them complete some functions autonomously, such as playing football, ultrasonic obstacle-avoiding and following line. The videos above will show you some ways to play with it.



    • Spotless Contest

      Spotless Contest
    • Microcontroller Contest

      Microcontroller Contest
    • Space Challenge

      Space Challenge

    We have a be nice policy.
    Please be positive and constructive.




    In the photo in Step 7 showing the Scratch (mBlock) code for navigating the car using the Up/Down/Left/Right Arrow keys, seems to have a bug which should prevent the right arrow key from working. Look at the fourth If/Else block. It says that when a "down arrow" occurs (which already was processed by the second If/Else block of code) to drive the two motors the opposite direction as was done for the "left arrow". Assuming the "left arrow" code is working, then the car should turn right if you reverse the voltages as compared to the left arrow code. So I suspect the bug is the that this fourth If/Else block should looking for the IR Remote condition where the right arrow is being pressed, not the down arrow!

    This is really a good robot for classroom, i like it.

    So cute~~~~it's lovely, looks easy to assemble. I'm not good at program but I could try this one. :)

    This is a great little robot!