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

About: Makeblock was founded in 2012 as the world's first open-source robot and programing platform. With more than 400 mechanical components, electronic modules, and software tools, we are determined to bring meanin…

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.Now I will show you how to build it by steps.

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

www.makeblock.com

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.

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

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

buy now

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

buy now

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.

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

www.makeblock.com

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.

For more information about makeblock, please visit mBlock website listed below:
www.makeblock.com

Circuits Contest 2016

Participated in the
Circuits Contest 2016