Electronic Kit for Scratch&Arduino

From MakeBlock

Jump to: navigation, search

Introduction

Buylink:
Robot Electronic Kit Pro
Robot Electronic Kit

Electronic Kit for Scratch&Arduino is a customized electronic kit designed for educator to teach scratch programming, for students to learn scratch programming. In the past, students usually write scratch scripts on computer. All scripts is run on computer virtually, students can't touch. Now you can use electronic kit to communicate with scratch(such as controlling a fan, control the led, read vales from Me light and grayscale sensor, Me PIR motion sensor and so on). If graphical programming is too easy for you and you want to challenge a little bit difficult code programming, you can learn Arduino code programming.

Scratch Programming

Install software Scratch For Robot

Download software Scratch For Robot from the link: http://makeblock-makeblock.stor.sinaapp.com/Scratch_For_Robot_v2.0.7.exe. After following installation suggestion to complete the whole installation, you can see the logo link of Scratch for robot on your computer desktopQQ图片20140719163317.jpg.
Scratchforrobotmain.png

Upload the firmware

First, connect Me Baseboard to your computer with USB cable. The on-board buzzer will beep after you have connected sucessfully. Click the top menu bar "connect—>COM11"( COM11 is a example. COM1,COM2 is not allowed to be choosen, please choose other COM ports).
Menu-connect.jpg

After you have sucessfully connected to COM11, you can see the red indicator turns into green in Scripts—>Robots section.
RedIndicator.jpg
GreenIndicator.jpg

Then Make sure that you have choosen "connect—>Arduino Leonardo" ,"connect—>COM11" from the top menu bar. Next you can click menu "connect—>Upgrade Firmware" to upload the Arduino code to Me Baseboard. When uploading, blue on-board LEDs and red on-board LEDs will flash continually and there is a processing bar showing the uploading progress. when finished, you will hear a beeping of the on-board buzzer.

Write scripts

Note:After you have uploaded, the COM ports will refresh, so you need to make sure that you have choosen "connect—>Arduino Leonardo" ,"connect—>COM11" from the top menu bar again.
Then you can write scripts with electronic module script blocks in "scripts—>Robot" section. Here is a entry-level demonstration reading the value of ultrasonic sensor, which is connected to the port 3 of Me Baseboard.
Ultrasonic sensor.jpg


Note: Scripts—>Robots section have many electronic module script blocks, which is designed to communicate with Makeblock electronic modules. You can use these script blocks to control DC motors, servos, leds, 7-segments display, or reading values from all kinds of sensors such as light sensor, sound sensor, tempterture sensor and so on.
ElectronicsScriptBlocks.jpg
More details about how to use electronic modules script blocks, please see below Electronic module script blocks Usage.

Arduino programming

If graphical programming is too easy for you and you want to challenge a little bit difficult code programming, please refer to this part contents to study. But don't worry, we have provided Arduino library to simplify your programming. Follow below steps to learn how to code with Arduino.

You can follow the video to finish how to upload the code, or follow the words below.

https://www.youtube.com/watch?v=yvz5V9nwbrQ&feature=youtu.be

Install Arduino IDE

Install Makeblock library

Download Makeblock library: https://github.com/Makeblock-official/Makeblock-Library.

Github下载库-0000.png


  • A: Automatically Installation

Unzip the library. In the Arduino IDE, navigate to Sketch > Import Library. At the top of the drop down list, select the option to "Add Library.

Install lib auto-A.png


Install lib auto.png



  • B: Manually installation

Unzip the library file, copy the folder named “Makeblock_Library” into the libraries file of Arduino IDE.

Your Arduino library folder should now look like this (on Windows): My Documents\Arduino\libraries\Makeblock_Library\Makeblock.cpp

My Documents\Arduino\libraries\ Makeblock_Library \Makeblock.h

My Documents\Arduino\libraries\ Makeblock_Library \ examples\ Makeblock_Robot_Starte_Kit ……..

or like this (on Mac):

Documents/Arduino/libraries/Makeblock_Library/Makeblock.cpp

Documents/Arduino/libraries/Makeblock_Library/Makeblock.h

Documents/Arduino/libraries/ArduinoParty/ examples\ Makeblock_Robot_Starte_Kit ……..

Run the Demo code

Use a USB cable to connect the Arduino board to your computer, when you plug in the USB cable in your computer, your computer will automatic install driver for the control board, this may take several minutes.

  • Starting the demo code:

In the Arduino IDE, navigate to file >examples>Makeblock_Library>examples>makeblock_Robot_Starter_Kit>…
Demo-code.png

  • Choose the board type

In the Arduino IDE, navigate to Tools>Board>Arduino Uno(If you use Me-Baseboard, please select Arduino Leonardo)
Choose board.png

  • Choose the serial port

In the Arduino IDE, navigate to Tools>Serial Port>Com x
Choose com port.png

  • Upload the code

Click the “upload” button to compile and upload the code to the control board. It will show “Done uploading” when finished.

Got problem running the code?

Due to Me BaseBoard core (Leonardo controller ATmega32U4), sometimes when you try to upload, an error message maybe pops up: "Couldn't find a Leonardo on the selected port". Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload. More details please visit Makeblock forum (http://forum.makeblock.cc/t/me-baseboard-leonardo-error/)
If you have any question about this product or you need technical support, please post it in Makeblock forum(forum.makeblock.cc).

Electronic module script blocks Usage

Note: please follow Scratch Programming step2-3 to make sure everything is gonna to work well.

Control digital pins of Me Baseboard

Me Baseboard has 13 digital pins in total. You can use the script block to set the output value of the digital pin as 0 or 1.. At the same time, you can read the input of the digital pin. Here is a scratch demo.

DigitalPin (2).jpg

Note: digital pin value range: from 0 to 13, output value: 0(LOW) or 1(HIGH).

Control analog pins of Me Baseboard

Me Baseboard has 11 analog pins in total. You can use script blocks to set the output value of the digital pin as 0 to 1023. At the same time, you can read the input value of the analog pin. Here is a scratch demo.

AnalogPin.jpg

Note: analog pin value range: 0 - 11, output value: from 0 to 1023.

Control the DC motor

Me Baseboard has 4 DC motor interfaces in total. There are two interfaces(M1,M2) intergrated on Me Baseboard and other two interfaces is the port 1,2 of Me Baseboard. when using port1,2, you need use addtional electronic module—DC Motor Driver to connect DC motor to Me Baseboard.
interfaces M1, M2 scratch demo

MotorM1.jpg

interfaces Port1, Port2 scratch demo

MtorPort1.jpg

Control the servo

Servo is not allowed to connect to Me Baseboard directly. So you may need to use Me servo driver to driver servos by connecting to Port1, 2 of Me Baseboard. Here is a scratch demo.

Servo.jpg

Note: Me Servo Driver has two slots, so you may need to check out which slot you have choosen in Scratch is the same as which slot you have plugged.

Control 7-segments display

7-segments display is usually used to display numbers and a few special characters. You can easily use it in your robot project to show speed, time, the value of sensors, or scores. 7-segment display is allowed to connect to Port3, 4, 5, 6, 7, 8 of Me Baseboard directly. Here is scratch demo. Scratch demo

Ultrasonic sensor.jpg

Control LEDs

Me RGB LED contains four full-color LEDs. you can connect it to Port3, 4, 5, 6, 7, 8 of Me Baseboard directly and control each LED individually. There are three parameters you need to set: LED index(1-4), Red value(0-255), Blue value(0-255),Green value(0-255).

4led.jpg

Read the value of the ultrasonic sensor

Ultrasonic sensor is usually used to measure the distance between the sensor and obstacles. You can connect it to the Port 3, 4, 5, 6, 7, 8 of Me Baseboard directly. Here is a scratch demo.

Ultrasonic sensor.jpg

Read the value of the light sensor

The light and gray sensor is usually used to measure the intensity of light in the surrounding environment. You can connect it to the port 3,4,5,6,7,8 of Me Baseboard directly. Here is a scratch demo.

Lightsensor.jpg

Read the value of the sound sensor

The sound sensor is designed to measure the intensity of the sound in the surrounding environment. You can connect it to the Port 3,4,,5,6,7,8 of Me Baseboard directly. Here is a scratch demo.

Ultrasonic sensor.jpg

Turn the light sensor into grayscale sensor

Me light and grayscale sensor is designed to not only measure the intensity of the sound, but also used as grayscale sensor to identify different colors. When you need to use it as a grayscale sensor, just light up the on-board led. Me light and grayscale sensor can be connected to the Port 3,4,5,6,7,8 of Me Baseboard directly.

Ultrasonic sensor.jpg


Read the value of line follower

Me Line Follower is used to give your robot the ability to detect lines or nearby objects. You can connect it to the Port 3,4,5,6,7,8 of Me Baseboard directly. Here is a Scratch demo.

Linefollower.jpg

Read the value of the potentiometer

Me potentiometer is a electronic module that outputs a continous changing value depending on the rotationg of the pot. You can connect it to the Port 3,4,5,6,7,8 of Me Baseboard directly. Here is a Scratch demo.

Potentiometer.jpg

Note: output value: from 0 to 1023.

Read the value of Me 3-Axis Accelerometer and Gyro Sensor

Me 3-Axis Accelerometer and Gyro Sensor is a low-power three-axis angular rate sensor. Based on I2C communication, you can connect it to the Port1,2,3,4,5,6,7,8 of Me Board directly. You can choose to read values of X axis, Y axis, Z axis.
Note: After you have connected the sensor to Me Baseboard by RJ25 cable, you may need to wait 10 senconds to initialize the sensor.

Here is a Scratch demo.

Gyro.jpg

Read the value of Infrared receiver

Me infrared receiver is usually designed for receiving infrared signals and controlling the robotics from the infrared remote control . You can connect it to the Port 3,4,5,6,7,8 of Me Baseboard directly. Here is a Scratch demo.

IRreceiver.jpg

Read the value of PIR motion sensor

Me PIR motion sensor is usually used to detect motion from animals/ humans from about 6m away. You can connect it to the Port 3,4,5,6,7,8 of Me Baseboard directly. Here is a Scratch demo.

PIRmotion.jpg

Read the value of tempeture sensor

Me tempeture sensor is perfect for immersive temperature detectionor detectingg something far away. It is not allowed to connect to Me Baseboard directly, you will need a RJ25 adapter to connect it to Me Baseboard. You can connect it to the Port 3,4,5,6,7,8 of Me Baseboard.

Here is a wiring demo

Me Temperature Sensor Waterproff Usage.jpg

Here is a Scratch demo.

TemputureSensor.jpg

Read the value of Me Joystick

Joystick is a electronic module that can turn directional movements into analog values(0-1023). You can connect it to the Port 3,4,5,6,7,8 of Me Baseboard directly. Here is a Scratch demo.

Joystick.jpg