Getting Started: Programming Ranger with mBlock

mBlock is an innovative way to learn and experiment with programming. It is a custom build upon Scratch – the de-facto standard of graphical programming software taught in many schools. Its functions include but not limited to:

  • “Write” your program by dragging and dropping blocks
  • Draw pictures, tell stories, write interactive projects and make games with code
  • Control your Ranger, Makeblock Starter Kit, Makeblock Ultimate Kit, and more projects built upon Makeblock’s RJ-25 Wiring System
  • Upload programs to your Makeblock robots so they can run by themselves
  • Convert your block-based program to full Arduino program and learn advanced programming skills
  • Express creativity with software-hardware combined projects such as games using human bodies as controllers.



Step 1: Download mBlock

The first steps are downloading and installing mBlock. We provide both Windows and Mac versions of the software.

Step 2: Install USB Drivers

If it is the first time you install and open mBlock, you need to install USB drivers otherwise USB cables won’t work on robots. Select “Connect”, “Install Arduino Driver” as the picture shown below.



Install Arduino drivers for MAC OS

The old driver was not signed, and therefore was not working out of the box on OS-X Yosemite and El Capitan. The latest driver appears to be signed, and should work out the box. The new driver is here

 Step 3: Connect Your Robot

mBlock provides three ways to connect your robot to the computer. USB cables are recommended for first time users and you can update firmware/reset default program only through USB cables; if you have a 2.4G model of Ranger, you can also connect through 2.4G Serial. Finally, if your computer support Bluetooth and you have a Bluetooth module, you can try Bluetooth connection.

Connect Your Robot Through USB Cables

Here are the steps:

  1. use a USB cable to connect between your robot/controller board and your computer
  2. make sure the robot is powered on (using the power switch)
  3. select “Connect”,  “Serial Port”, then the option corresponding to your robot. If you are using Windows, it should be something like “COM” and a number; if you are using a Mac, it starts like “/dev/tty.wchusbserial”. You may try different options if it does not works.



Connect Your Robot Through 2.4G Modules

The 2.4G module set comes with a electronic module and a USB dongle. If you are using the dongle first time, you need to connect the 2.4G electronic module to your robot; power up your robot; press the button on top of the 2.4G module, and then plug the dongle to your computer. When the LED light on the module turns from blinking to steady lighting, it means the 2.4G module is paired with the dongle.

On the software side, after pairing the dongle you need to select Connect->2.4G Serial->Connect in the software menu. When “Connected” is shown in the title bar, you know your Ranger is connected to the computer.



Connect Your Robot Through Bluetooth

If your computer supports Bluetooth and you have Bluetooth Modules for Ranger or Auriga, you can control and program your robot wirelessly.

For Windows Operating system, just power up your robot, select Connect->Bluetooth->Discover, select your device discovered in the list, then you are free to go.



For Mac OS X, you need to pair and connect to “Makeblock” in the Bluetooth menu of your system, then you can find you robot in the Serial Port menu.

Step 4: Select the type of your product/controller board

For Ranger users, select Boards->Auriga; for Start/Ultimate users or DIY users using Auriga Controller Board, select Boards->Auriga as the picture shown below.



Step 5: Upgrade Firmware

Before controlling your robot with mBlock, you need to upload/update the firmware of your Ranger or Auriga controller board. Select Connect->Upgrade Firmware to complete this step.

Step 6: Write your First Program for Your Robots

Now you may enjoy controlling your robots with mBlock. Basically, mBlock is based on Scratch. It includes all the command blocks from Scratch and it can run Scratch programs. Robot-related commands are located on “Robots” section. You can drag a block from this section and double click it to run. See if you own a Ranger, you may drag then double click a “run forward at speed 100” block to let the robot run (at speed 100).



Feel free to explore different command blocks and combinations in mBlock – endless possibilities awaits you!

Step 7: Upload your Program to your Robots

What truly amazed me is that programs written in mBlock may be uploaded into robots and run without a computer. This is particularly useful if you want to build a robot that runs on its own or you what to build a device (such as Christmas decoration) that works without always having a computer at its side. The steps to upload programs are easy: First, select “Edit->Arduino Mode” to switch to Arduino Mode:


Second, you may see the Arduino code generated by mBlock. Arduino is a programming language used to control electronic devices, mainly used by makers. If you are curious, you can see how Arduino code change as you drag and arrange new blocks in mBlock. There is one thing you need to know: your program need to start with a “header block” to work after uploading to the robot; and only blocks attached to the “header block” is effective.




Step 8: Examples for mBlock

 Drag the module block you need from Robots Area, select the correct port/pin. Then trigger the running event, you can see it works.

  • Control the On-Board RGB LEDs



Step 9: Start from some lessons

We have created some lessons about graphical programming and robotics to help teachers or kids get started easier. We suggest you start learning graphical logical programming with Scratch 2.0 The Adventures of Mike, then learn how to use Scratch2.0 to interact with Ranger with the book The Mars Adventure of Mark.

Scratch 2.0 The Adventures of Mike

Scratch 2.0 The Adventures of Mike

Scratch 2.0 the adventures of Mike has nine chapters with different projects. Kids can explore the world of Scratch 2.0 by creating a lot of interactive stories, games and animation in the virtual world, aiming to help kids learn basic logical programming and know how the Scratch2.0 works. More resources about Scratch2.0


The Mars Adventure of Mark

Thanks to the cooperation with Scratch teachers, we are developing sixteen chapters about learning graphical programming with Ranger. This course will guide you to program Ranger in lots of interesting scenes.

Resources and Going Further

(1) Arduino Firmware for mBlock: visit Github
(2) Makeblock Official Web Site:
(3) Makeblock Community:

Explore more about mBlock

Knowledge on Scratch is useful for using mBlock. If you are new to Scratch programming, you may check out one of Scratch books.

More Tutorials are available in mBlock tutorial sections of Makeblock’s forum.


Posted on