Dobot Scratch User Guide V1.3.1 PDF
Dobot Scratch User Guide V1.3.1 PDF
Issue: V1.3.1
Date: 2020-01-15
Copyright © ShenZhen Yuejiang Technology Co., Ltd 2020. All rights reserved.
No part of this document may be reproduced or transmitted in any form or by any means
without prior written consent of Yuejiang Technology Co., Ltd
Disclaimer
To the maximum extent permitted by applicable law, the products described (including its
hardware, software and firmware, etc.) in this document are provided AS IS, which may have flaws,
errors or faults. Yuejiang makes no warranties of any kind, express or implied, including but not
limited to, merchantability, satisfaction of quality, fitness for a particular purpose and non-
infringement of third party rights. In no event will Yuejiang be liable for any special, incidental,
consequential or indirect damages resulting from the use of our products and documents.
Before using our product, please thoroughly read and understand the contents of this document
and related technical documents that are published online, to ensure that the robotic arm is used on
the premise of fully understanding the robotic arm and related knowledge. Please use this document
with technical guidance from professionals. Even if follow this document or any other related
instructions, Damages or losses will be happen in the using process, Dobot shall not be considered
as a guarantee regarding to all security information contained in this document.
The user has the responsibility to make sure following the relevant practical laws and
regulations of the country, in order that there is no significant danger in the use of the robotic arm.
Preface
Purpose
This manual introduces the use of Scratch, including equipment connection, building blocks,
etc., for the convenience of users to understand and use Scratch.
Intended Audience
This document is intended for:
Customer Engineer
Sales Engineer
Installation and Commissioning Engineer
Technical Support Engineer
Change History
Symbol Conventions
The symbols that may be founded in this document are defined as follows.
Symbol Description
Contents
Introduction .............................................................................................................. 1
Devices and Extension Center................................................................................. 2
Quick Start ............................................................................................................... 3
Device Connection ............................................................................................................ 3
Program Upload ................................................................................................................ 4
Program Instructions............................................................................................... 6
Maigcian/Magician Lite .................................................................................................... 6
Setting .................................................................................................................. 6
Motion ................................................................................................................. 8
Detection ........................................................................................................... 11
I/O(Only Magician supported) ..................................................................... 12
Calibration (Only Magician Lite supported) ..................................................... 14
Extension Device ............................................................................................................ 17
Sliding rail ......................................................................................................... 17
AI ....................................................................................................................... 19
Photoelectric and Color Sensor ......................................................................... 31
Magic Box....................................................................................................................... 32
Mobile Platform .............................................................................................................. 35
Mobile Platform................................................................................................. 35
Sensor ................................................................................................................ 37
Arduino ........................................................................................................................... 42
Serial Port .......................................................................................................... 42
IO Operation ...................................................................................................... 44
Vision Recognition ............................................................................................ 46
Speech Recognition ........................................................................................... 50
JoyStick ............................................................................................................. 51
AIStarter.......................................................................................................................... 53
AIStarter ............................................................................................................ 53
Motion ............................................................................................................... 54
Sensor ................................................................................................................ 56
Xbee................................................................................................................... 61
Introduction
DobotScratch is a building block programming and code programming software based on the
offline version of Scratch 3.0, which not only allows users to create story, game, and animation, etc,
but also provide programming instruction for Dobot hardware devices. The devices that
DobotScratch supported are Dobot Magician, Dobot Magician Lite, Magic Box, AI-Starter, Mobile
Platform, and Arduino. The homepage is shown below.
1 Menu bar Change system language, save and upload your works, etc
2 Dance area Show your work, connect device, set role and background, etc
5 Jogging control area connection control, motion direction control, end control and slide rail control
We will introduce the device lib and extension center in this chapter, you can click to
view device lib. As shown below.
The block area will shown the corresponding instruction after selecting device. You can also
NOTE
One DobotScratch can control multiple devices at the same time.
Quick Start
Device Connection
DobotScratch supports multiple Dobot devices. This section uses Dobot Magician Lite as an
example to describe how to connect devices.
Prerequisites
Magician Lite has been connected to PC via USB
Procedure
Power on Magician Lite.
Program Upload
DobotScratch supports multiple Dobot devices. This section uses AI-Starter as an example to
describe how to upload program to devices.
Prerequisites
AI-Starter has been connected to PC via USB.
Procedure
Program Instructions
Maigcian/Magician Lite
Setting
Table 4.1 Select end-tool
Instruction
Parameters end-tool:
Gripper
Suction cup
Pen
Return None
Instruction
Parameter Speed ratio: Set the speed ratio. Set the speed multiplied by the ratio to the actual speed
Acceleration ratio: Set the acceleration ratio. Set the acceleration multiplied by the ratio as the
actual acceleration
Return None
Table 4.3 Set the speed and acceleration of the joint axis
Instruction
Return None
Table 4.4 Set the speed and acceleration of the Cartesian axis
Instruction
Return None
Instruction
Description Set the stepper motor speed. (This block is only supported by Magician)
Return None
Table 4.6 Set the height of the lift in Jump mode and the height limit of the Z axis
Instruction
Description Set the height of the lift in Jump mode and the height limit of the Z axis
Return None
Instruction
Description Set a lost step detection threshold to detect whether the positioning error exceeds the threshold.
If the threshold is exceeded, the motor lost steps
Return None
Instruction
Descriptio Set the number of stepper motor speed pulses. (This block is only supported by Magician)
n
Return None
Instruction
Parameter None
Return None
Instruction
Description Set the conveyor motor speed (this block is only supported by Magician)
Return None
Motion
Table 4.11 Home robot
Instruction
Parameter None
Return None
Instruction
Return None
Table 4.13 The robot moves to the set target position with a certain type of motion
Instruction
Description The robot moves to the set target position with a certain type of motion
Movement type:
Joint
Straight Line
Return None
Instruction
Return None
Instruction
Return None
Instruction
Mode:
Return None
Instruction
ON
OFF
Return None
Instruction
Grip
Release
Off
Return None
Detection
Table 4.19 Get real-time robot coordinates
Instruction
Parameter Axis:
X
Y
Z
R
Instruction
Parameter Joint:
Instruction
Parameter None
Instruction
Parameter None
Return None
Instruction
Function type:
IOFunctionDummy
IOFunctionDO
IOFunctionDI
IOFunctionPWM
IOFunctionADC
IOFunctionDIPU
IOFunctionDIPD
Return None
Instruction
Return None
Instruction
Return None
Instruction
Instruction
If Magician Lite is required for precise positioning and grasping, coordinate calibration is
required in advance. The calibration steps are as follows.
Click “Coordinate Calibration” to pop up the calibration interface, follow the
prompts to install the suction cup, and click Next.
After placing the calibration plate in the box under the camera according to the
prompts, the four calibration points A, B, C, and D will be displayed in the figure.
Click Next.
Follow the prompts to jog the robot arm to move the end suction cup to the calibration
point A, and click Next.
Figure 4.4 Move the end suction cup to the calibration point A
NOTE
Do not move the calibration plate during the calibration process, otherwise the calibration
will be invalid.
Extension Device
Sliding rail
Table 4.28 Set sliding rail state
Instruction
Version: Click the drop-down box to select the corresponding version of the sliding rail
Return None
Instruction
Parameter None
Return None
Instruction
Return None
Instruction
Return None
Instruction
Return None
Instruction
Instruction
Instruction
Parameter None
AI
Speech Recognition
Speech Recognition
Click Open speech recognition popup the voice recognition interface.
Close this interface, and the recognition result will be saved to Speech recognition
results module .
Instruction Description
Table 4.36 Recognize speech automatically
Instruction
return None
Example
Click to execute program. Say something for 5s, wait for 3s to broadcast
speed result.
Instruction
return Nome
Example
Click to xexcute program. Click Start to say something, when you finish speaking, click
Instruction
Parameter None
Instruction
return None
Image Getting
Table 4.40 Get image automatically
Instruction
return None
Example
Click and the camera will take a picture after 3s, if the picture’s tag contains Home, the
Instruction
Parameter None
return None
Example
Click and click take a picture, if the picture’s tag contains Home, the Robot will execute
home function
Instruction
Parameter None
return Image
Image Recognition
Create Image Date
Click Edit classification data to popup create image date interface.
Click to get image and name it. (please colse your computer camera before
using camera)
If you need to cut the object in the picture, you can check Cut and click the object in
the box to get the picture.
Click Training model to test image, put object below the camera, and the system
will match it via feature.
Instruction Description
Table 4.43 Image name recognition
Instruction
Instruction
return None
Example Click space key to execute program. If picture’s tag is home, get coordinate value and to make
robot execute home function
Instruction
Parameter None
Instruction
return name
Instruction
coordinate:select axis
Face Recognition
Create Face Date
Click New face data topopup the create face date interface.
Put your face below the camera, and click Test to match it via feature.
Instruction Description
Table 4.48 sexual recognition
Instruction
Sexual:male, female
False:Recognize failed
Example Click key space to execute and recognize a man’ sexual and expression.
Instruction
Parameter Expression:
Normal
Smile
Laugh
False:Recognize failed
Instruction
return Name
Example Click to execute program. If the picture match is greater than 0, broadcast
picture’s name
Instruction
OCR Recognition
Table 4.52 OCR recognition
Instruction
Return Text
Example Press space key to execute program, the camera will take a picture after 3s, if the picture
contains text Laugh, program will broadcast hahahahahaha
Instruction
Port: Select the port where the sensor is connected to the robot
Return None
Instruction
Parameter port:Select the port where the sensor is connected to the robot
Return Value
Instruction
On
Off
Port: Select the port where the sensor is connected to the robot arm
Return None
Instruction
Red
Green
Blue
Magic Box
Table 4.57 Output analog signal pin value
Instruction
Return None
Instruction
Return None
Instruction
Function type:
IOFunctionDummy
IOFunctionDO
IOFunctionDI
IOFunctionPWM
IOFunctionADC
IOFunctionDIPU
IOFunctionDIPD
Return None
Instruction
Return None
Instruction
Instruction
Instruction
0:low level
Instruction
Return None
Instruction
Return None
Instruction
Return None
Mobile Platform
Mobile Platform
Table 4.67 Initialize the mobile platform
Instruction
Parameter None
Return None
Instruction
Parameter None
Return None
Instruction
LED1
LED2
LED3
LED4
Set state:
ON
OFF
BLINK
Return None
Table 4.70 Set the movement direction and speed of the car
Instruction
Parameter Direction:
Ahead
Back
Turn Left
Turn Right
Return None
Table 4.71 Set the movement direction, speed and time of the car
Instruction
Description Set the movement direction, speed and time of the car
Parameter Direction:
Ahead
Back
Turn Left
Turn Right
Return 无
Instruction
Right
Left
Return None
Instruction
Return None
Sensor
Instruction
Right Front
Front
Left Front
Return None
Instruction
Right Front
Front
Left Front
Instruction
Description Obtain ultrasound data of a certain position, that is, the distance between the car and the obstacle
Right Front
Front
Left Front
Return Distance
Instruction
IR1
IR2
IR3
IR4
IR5
IR6
Return IR data
Instruction
Right
Left
Return None
Instruction
Right
Left
state:
ON
OFF
Return None
Instruction
Description This block is used to obtain the color value by the color sensor
Right
Left
Color:
Red
Green
Blue
Instruction
Description This block is used to detect whether the color sensor detects a color
Right
Left
Color:
Red
Green
Blue
Instruction
1
2
Return 1:press
0:release
Instruction
Right
Left
Return Angle
Instruction
Parameter Set threshold: set the detection threshold, value range: 0 ~ 51.2cm
Return None
Instruct
ion
Param IR:
eter IR1
IR2
IR3
IR4
IR5
IR6
Set offset: Set the offset of each infrared pair. When setting the offset, you need to set the 6 infrared pair
offsets to symmetric data centered on 0, for example: -3, -2, -1, 1, 2, 3 This will not cause the car to deviate
from the black line during the line inspection process.
Return None
Instruction
Parameter None
Table 4.87 Get the infrared sensor offset after PID processing
Instruction
Parameter None
Arduino
Serial Port
Table 4.88 Set pin mode
Instruction
Select mode:
OUTPUT
INPUT
INPUI_PULLUP
Return None
Instruction
Parameter Baud rate: Set the baud rate for data transmission
Return None
Instruction
Parameter Baud rate: Set the baud rate for data transmission
Return None
Instruction
Return None
Instruction
Return None
Parameter None
Instruction
Parameter None
Return String
IO Operation
Table 4.95 Set Arduino digital level
Instruction
Parameter pin
level:high or low
Return None
Instructio
n
Descripti Write analog value to the specified analog pin, used to control the brightness of the LED indicator or
on control the speed of the motor
Return None
Instruction
Instruction
Instruction
Table 4.100 Set the output frequency and output duration of the ultrasonic pin
Instruction
Description Set the output frequency and output duration of the ultrasonic pin
Return None
Instruction
Return None
Vision Recognition
You need to initialize it before using the vision kit. If you have previously saved the
initialization data, you can click to import to initialize it. Otherwise, click
to complete the initialization according to the wizard. The initialization steps are
as follows
Follow the prompts to complete the initialization preparations.
NOTICE
Move the robot arm to the suction cup close to the plane and click the "Record"
button to record the plane height.
According to the actual situation, write in the height of the different colored squares,
and then click "Record".
Move the camera to the wooden block recognition position, click "Record" to obtain
the position of the robot arm or manually enter the position of the robot arm and click
"Record".
Record the PixyMon calibration point reading. Follow the prompts to place the three
calibration blocks into the camera's field of view. Click "Action" in the PixyMon
window and repeatedly use the Signature1 box to select three wooden blocks, and
write in the coordinates and height and width of the wooden blocks according to the
box selection results, and click "Record".
NOTICE
Before using Signature1 to select wooden blocks, you need to open the Console. Click
on "View-> Console"
Record the robot coordinates of the calibration block. Hold the robot arm close to the
center of the three wooden blocks and click "Record" to record separately.
Figure 4.26 Hold the robot arm close to the center of the three wooden blocks
Color calibration. Put the wooden block that needs to identify the color in the field
of vision, click "Action" according to the prompt and use Signature1, 2, 3, 4 to select
the wooden block of the corresponding color, and match the color with the mark in
the option box.
Speech Recognition
Table 4.102 Initialize speech recognition module
Instruction
Parameter None
Return None
Instruction
Speech recognition phrase: Select the speech recognition phrase serial number to be
added
Return None
Instruction
JoyStick
Table 4.105 Get button status
Instruction
Red
Green
Blue
Return State:
true: Up
false: Down
Instruction
Red
Green
Blue
State:
ON
OFF
Return None
Instruction
Red
Green
Blue
True: ON
False: OFF
Instruction
x
y
Instruction
Parameter None
true: Up
false: Down
AIStarter
AIStarter
Table 4.110 Initialize AI-Starter
Instruction
Parameter None
Return None
Instruction
Parameter None
Return None
Instruction
LED1
LED2
Set state:
ON
OFF
BLINK
Return 无
Instruction
Return None
Motion
Instruction
Parameter Direction:
Ahead
Back
Turn left
Turn right
Return None
Table 4.115 Set the movement direction, speed and time of AI-Starter
Instruction
Parameter Direction:
Ahead
Back
Turn left
Turn right
Return None
Instruction
LEFT
RIGHT
Return None
Instruction
Return None
Instruction
Return None
Instruction
Angle:set angle
Return None
Sensor
Table 4.120 Start sonar
Instruction
Right Front
Front
Left Front
Return None
Instruction
Description Detect whether a barrier is exist in front of AI-Starter, before calling this module, please start
the corresponding sonar
Right Front
Front
Left Front
Instruction
Description Get the detection distance of sonar, which is the distance between AI-Starter and barrier.
Right Front
Front
Left Front
Instruction
Parameter IR:
IR1
IR2
IR3
IR4
IR5
IR6
Instruction
Parameter None
Instruction
Description Calibration method: Press down the left-most key after starting up, make AI-Starter rotate
360°around space axes X, Y, Z respectively, press down the left-most key once again to finish
calibration
Parameter None
Return None
Instruction
Right
Left
Return None
Instruction
Right
Left
state:
ON
OFF
Return None
Instruction
Right
Left
Color:
Red
Green
Blue
Instruction
Right
Left
Color:
Red
Green
Blue
Instruction
Parameter Switch:
Switch 1
Switch 2
Switch 3
false: Release
Instruction
Parameter None
Instruction
Return None
Instruct
ion
Param IR:
eter IR1
IR2
IR3:
IR4:
IR5:
IR6:
Set offset: Set the offset of each infrared pair. When setting the offset, you need to set the 6 infrared
pair offsets to symmetric data centered on 0, for example: -3, -2, -1, 1, 2, 3 This will not cause the
car to deviate from the black line during the line inspection process.
Return None
Instruction
Parameter None
Table 4.135 Get the infrared sensor offset after PID processing
Instruction
Parameter None
Instruction
Right
Left
Xbee
Table 4.137 Get Xbee value
Instruction
Description 该Instruction用于读取Xbee数值
Parameter 无
Return Xbee数值
Instruction
Return None
Instruction
False: different
Instruction
Parameter None
Return None
DOBOT
Shenzhen Yuejiang Technology Co., Ltd
www.dobot.cc