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

Intro: 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

2*Wheel

2*Tyre

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*Bluetooth

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:

www.mblock.cc

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 
#include 
#include 
#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(){
   
ir.begin();
}
void loop(){
   
if(ir.keyPressed(64)){
       
motor_9.run(255);
       
motor_10.run(255);
   
}else{
       
if(ir.keyPressed(25)){
           
motor_9.run(-255);
           
motor_10.run(-255);
       
}else{
           
if(ir.keyPressed(7)){
                motor_9.run(255);
                motor_10.run(-255);
           
}else{
                if(ir.keyPressed(25)){
                    motor_9.run(-255);
                    motor_10.run(255);
                }else{
                    motor_9.run(0);
                    motor_10.run(0);
                }
           
}

       
}
    }
   
ir.loop();    
}

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

learn.makeblock.cc/learning-arduino

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.

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Tiny Home Contest

      Tiny Home Contest
    • Audio Contest 2018

      Audio Contest 2018

    6 Discussions

    0
    None
    gkern

    4 months ago

    Great robot, picked up a bluetooth v1.1 mBot for 39 bucks, an incedible deal. Sucked me into th MakeBlock world, bought a second wifie enabled mBot, and a bunch of sensors and there LED displays, for almost next to nothing. The apps are great, and teach basic Scratch coding, and allow really complex behavior and contol of the MBot. The PC, Mac, and Linux version of the scratch MBot coding, allows much more complex scratch 3.0 coding, as well as lower level C progamming which allows for greater control of mBot features. All very worth while, except for one unfortunate problem, MakeBlockGreat robot, picked up a bluetooth v1.1 mBot for 39 bucks, an incedible deal. Sucked me into th MakeBlock world, bought a second wifie enabled mBot, and a bunch of sensors and there LED displays, for almost next to nothing. The apps are great, and teach basic Scratch coding, and allow really complex behavior and contol of the MBot. The PC, Mac, and Linux version of the scratch MBot coding, allows much more complex scratch 3.0 coding, as well as lower level C progamming which allows for greater control of mBot features.seems to have completely abandond support for these products. TheGreat robot, picked up a bluetooth v1.1 mBot for 39 bucks, an incedible deal. Sucked me into th MakeBlock world, bought a second wifie enabled mBot, and a bunch of sensors and there LED displays, for almost next to nothing. The apps are great, and teach basic Scratch coding, and allow really complex behavior and contol of the MBot. The PC, Mac, and Linux version of the scratch MBot coding, allows much more complex scratch 3.0 coding, as well as lower level C progamming which allows for greater control of mBot features.

    The only issue with the MakeBlock mBot product line is that they seem to have completely abandoned customer support,and while Web sites are still up they are for sale and or under maintenance, so books product support are not available. Any support available Ive gotten on YouTube , or personal sitess. Anyways if anyone knows the Status of MakeBlock corp, bankrupt, retooling, whatever, it would be great to know, unable to get any reponse fro, the company after several months, so any info would be great, love this product and would hate to see it abandoned.

    0
    None
    randmor54

    1 year ago

    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!

    0
    None
    arielschoy

    1 year ago

    very interactive

    0
    None
    Coco_Y

    3 years ago on Introduction

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

    0
    None
    EvansL1

    3 years ago on Introduction

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