0% found this document useful (0 votes)
777 views67 pages

Dobot Scratch User Guide V1.3.1 PDF

Uploaded by

dborcic61
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
777 views67 pages

Dobot Scratch User Guide V1.3.1 PDF

Uploaded by

dborcic61
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

User Guide

Dobot Scratch User Guide

Issue: V1.3.1

Date: 2020-01-15

Shenzhen Yuejiang Technology Co., Ltd


Dobot Scratch User Guide

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.

Shenzhen Yuejiang Technology Co., Ltd


Address: Floor 9-10, Building 2, Chongwen Garden, Nanshan iPark, Liuxian Blvd, Nanshan
District, Shenzhen, Guangdong Province, China
Website: www.dobot.cc

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


i
Dobot Scratch User Guide Preface

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

Date Change Description

2020/01/11 The first release

Symbol Conventions
The symbols that may be founded in this document are defined as follows.

Symbol Description

Indicates a hazard with a high level of risk which, if not


DANGER avoided, could result in death or serious injury

Indicates a hazard with a medium level or low level of


WARNING risk which, if not avoided, could result in minor or
moderate injury, robotic arm damage

Indicates a potentially hazardous situation which, if not


NOTICE avoided, can result in robotic arm damage, data loss, or
unanticipated result

NOTE Provides additional information to emphasize or


supplement important points in the main text

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


ii
Dobot Scratch User Guide Contents

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

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


iii
Dobot Scratch User Guide 1 Introduction

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.

Figure 1.1 Homepage

Table 1.1 Homepage description

No. Function Description

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

3 Block area Provide all blocks

4 Code area Drag block to this page and edit it.

5 Jogging control area connection control, motion direction control, end control and slide rail control

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


1
Dobot Scratch User Guide 2 Devices and Extension Center

Devices and Extension Center

We will introduce the device lib and extension center in this chapter, you can click to
view device lib. As shown below.

Figure 2.1 device selection

The block area will shown the corresponding instruction after selecting device. You can also

click to add extension device in extension center. As shown below.

Figure 2.2 extension center

NOTE
One DobotScratch can control multiple devices at the same time.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


2
Dobot Scratch User Guide 3 Quick Start

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.

Click on DobotScratch into Choose a Device interface, where you should


select Magician Lite.

Click to connect Magician Lite on device interface.

Figure 3.1 Connect Magician Lite and Scratch

After connecting Dobot Magciain Lite and DobotScratch successfully, you


can drag the blocks in the block area to start programming. As shown in the figure

below, click to home Maigcian Lite.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


3
Dobot Scratch User Guide 3 Quick Start

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

Click on DobotScratch into Choose a Device interface, where you should


select AI-Starter.
Drag the blocks to the block area, as shown below.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


4
Dobot Scratch User Guide 3 Quick Start

Figure 3.2 Drag blocks to the block area

Click to select the corresponding serial port and click upload to


upload code. As shown below.

Figure 3.3 select the corresponding serial port to upload code

Power on AI-Starter to perform it after uploading code.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


5
Dobot Scratch User Guide 4 Program Instructions

Program Instructions

Maigcian/Magician Lite
Setting
Table 4.1 Select end-tool

Instruction

Description Select end-tool

Parameters end-tool:

 Gripper

 Suction cup

 Pen

Return None

Table 4.2 Set PTP motion ratio

Instruction

Description Set motion ratio

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

Description Set the speed and acceleration of the joint axis

Parameter Speed: Set the speed of each joint coordinate axis

Acceleration: Set the acceleration of each joint coordinate axis

Return None

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


6
Dobot Scratch User Guide 4 Program Instructions

Table 4.4 Set the speed and acceleration of the Cartesian axis

Instruction

Description Set the speed and acceleration of the Cartesian axis

Parameter Speed: Set the Cartesian axis speed

Acceleration: Set acceleration of Cartesian axis

Return None

Table 4.5 Set the stepper motor speed

Instruction

Description Set the stepper motor speed. (This block is only supported by Magician)

Parameter Motor: Select the motor first

Speed: motor speed (puls/s)

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

Parameter Height: set the door height

Z-axis height limit: Set the Z-axis height limit

Return None

Table 4.7 Set lost step threshold

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

Parameter Parameter setting: set cutting value

Return None

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


7
Dobot Scratch User Guide 4 Program Instructions

Table 4.8 Set the number of stepper motor speed pulses

Instruction

Descriptio Set the number of stepper motor speed pulses. (This block is only supported by Magician)
n

Parameter Motor: Select motor

Speed: Set the motor speed (puls/s)

Pulse number: set the number of motor pulses

Return None

Table 4.9 Perform motor loss detection

Instruction

Description Perform motor loss detection

Parameter None

Return None

Table 4.10 Set the convert motor speed

Instruction

Description Set the conveyor motor speed (this block is only supported by Magician)

Parameter Motor: Select motor

Speed: Set the motor speed

Return None

Motion
Table 4.11 Home robot

Instruction

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


8
Dobot Scratch User Guide 4 Program Instructions

Description Home robot

Parameter None

Return None

Table 4.12 Robot moves to a set target point in jump mode

Instruction

Description Robot moves to a set target point in jump mode

Parameter X: Set the X coordinate value

Y: set the Y coordinate value

Z: Set the Z coordinate value

R: Set the R coordinate value

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

Parameter X: Click the edit box to set the X coordinate value

Y: Set Y coordinate value

Z: Set the Z coordinate value

R: Set the R coordinate value

Movement type:

 Joint

 Straight Line

Return None

Table 4.14 Robot moves a relative Cartesian coordinate increment

Instruction

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


9
Dobot Scratch User Guide 4 Program Instructions

Description Robot moves a relative Cartesian coordinate increment

Parameter △ X: set x increment value

△ Y: set y increment value

△ Z: set z increment value

△ R: set r increment value

Return None

Table 4.15 Robot moves to the set joint target position

Instruction

Description Robot moves to the set joint target position

Parameter Joint 1: Set the angle of Joint 1

Joint 2: Set the angle of Joint 2

Joint 3: Set the angle of joint 3

Joint 4: Set the angle of joint 4

Return None

Table 4.16 Set R axis rotation angle

Instruction

Description Set R axis rotation angle

Parameter R-axis angle: set rotation angle

Mode:

 Relative: Relative coordinate

 Absolute: Absolute coordinate

Return None

Table 4.17 Set suction cup switch

Instruction

Description Set suction cup switch

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


10
Dobot Scratch User Guide 4 Program Instructions

Parameter Suction cup status:

 ON

 OFF

Return None

Table 4.18 Set gripper status

Instruction

Description Set gripper status

Parameter Gripper status:

 Grip

 Release

 Off

Return None

Detection
Table 4.19 Get real-time robot coordinates

Instruction

Description Get real-time robot coordinates

Parameter Axis:

 X

 Y

 Z

 R

Return Coordinate value

Table 4.20 Get real-time joint angle of robotic arm

Instruction

Description Get real-time joint angle of robotic arm

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


11
Dobot Scratch User Guide 4 Program Instructions

Parameter Joint:

 Joint 1: Set the angle of Joint 1

 Joint 2: Set the angle of Joint 2

 Joint 3: Set the angle of joint 3

 Joint 4: Set the angle of joint 4

Return Return joint angle

Table 4.21 Detect Robot lost step results

Instruction

Description Detect Robot lost step results

Parameter None

Return True: step lost

False: no step lost

Table 4.22 clearthe robot alarm

Instruction

Description Clear robot alarm

Parameter None

Return None

I/O(Only Magician supported)


Table 4.23 Set EIO state

Instruction

Description Set EIO state

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


12
Dobot Scratch User Guide 4 Program Instructions

Parameter EIO: Select IO address according to function type

Function type:

 IOFunctionDummy

 IOFunctionDO

 IOFunctionDI

 IOFunctionPWM

 IOFunctionADC

 IOFunctionDIPU

 IOFunctionDIPD

Return None

Table 4.24 Set PWM output

Instruction

Description Set PWM output

Parameter EIO: Select IO address

Frequency: Set the frequency. Value range: 10HZ ~ 1MHZ

Duty Cycle: Set the duty cycle. Value range: 0 ~ 100

Return None

Table 4.25 Set digital output to high or low

Instruction

Description Set digital output to high or low

Parameter EIO: Select EIO address

Value: high or low

Return None

Table 4.26 Read the value of a digital signal

Instruction

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


13
Dobot Scratch User Guide 4 Program Instructions

Description Read the value of a digital signal

Parameter EIO:Select EIO

Return 0:low level;1:high level

Table 4.27 Read the value of an analog signal

Instruction

Description Read the value of an analog signal

Parameter EIO:Select EIO

Return 0:low level;1:high level

Calibration (Only Magician Lite supported)

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.

Figure 4.1 Install suction cup

Follow the prompts to place the device. Click Next.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


14
Dobot Scratch User Guide 4 Program Instructions

Figure 4.2 Place Magician Lite

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.

Figure 4.3 Place calibration plate

Follow the prompts to jog the robot arm to move the end suction cup to the calibration
point A, and click Next.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


15
Dobot Scratch User Guide 4 Program Instructions

Figure 4.4 Move the end suction cup to the calibration point A

Figure 4.5 Calibration point A

NOTE

Do not move the calibration plate during the calibration process, otherwise the calibration
will be invalid.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


16
Dobot Scratch User Guide 4 Program Instructions

Follow step 4 to calibrate point B, point C and point D.

Extension Device
Sliding rail
Table 4.28 Set sliding rail state

Instruction

Description Set Sliding rail status

Parameter Status: Click the drop-down box to set the status

Version: Click the drop-down box to select the corresponding version of the sliding rail

Return None

Table 4.29 Get sliding rail state

Instruction

Description Get Sliding rail state

Parameter None

Return None

Table 4.30 Move the sliding rail for a certain distance

Instruction

Description Move the sliding rail for a certain distance

Parameter Distance: Set the moving distance of the sliding rail

Return None

Table 4.31 Set the speed and acceleration in PTP mode

Instruction

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


17
Dobot Scratch User Guide 4 Program Instructions

Description Set the speed and acceleration in PTP mode

Parameter Speed: Set the speed of the sliding rail

Acceleration: Set the acceleration of the sliding rail

Return None

Table 4.32 Set the speed and acceleration in jogging mode

Instruction

Description Set the speed and acceleration in jogging mode

Parameter Speed: Set the speed of the sliding rail

Acceleration: Set the acceleration of the sliding rail

Return None

Table 4.33 Get the speed and acceleration in PTP mode

Instruction

Description Get the speed and acceleration in PTP mode

Parameter Select the parameter speed (mm / s) or acceleration (mm / s²)

Return Speed or acceleration

Table 4.34 Get the speed and acceleration in jogging mode

Instruction

Description Get the speed and acceleration in jogging mode

Parameter Select the parameter speed (mm/s) or acceleration (mm/s²)

Return Speed or acceleration

Table 4.35 Get sliding rail postion

Instruction

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


18
Dobot Scratch User Guide 4 Program Instructions

Description Get sliding rail position

Parameter None

Return Sliding rail position(mm)

AI

Speech Recognition
Speech Recognition
Click Open speech recognition popup the voice recognition interface.

Figure 4.6 Open speech recognition

Please select a language,Click Start to recognize your voice.

Figure 4.7 Start recognition

Click Stop to finish speech recognition.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


19
Dobot Scratch User Guide 4 Program Instructions

Figure 4.8 Stop recognition

Close this interface, and the recognition result will be saved to Speech recognition

results module .

Instruction Description
Table 4.36 Recognize speech automatically

Instruction

Description Recognize speech automatically

Parameter Select language:select language to Chinese_putonghua or English

Time:set speech recognition time

return None

Example
Click to execute program. Say something for 5s, wait for 3s to broadcast
speed result.

Table 4.37 Recognize speech manually

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


20
Dobot Scratch User Guide 4 Program Instructions

Instruction

Description Recognize speech manually

Parameter Select language:select language to Chinese_putonghua or English

return Nome

Example
Click to xexcute program. Click Start to say something, when you finish speaking, click

Stop, wait for 3s to broadcast speed result.

Table 4.38 Speech recognition result

Instruction

Description speech recognition will be saved in this module

Parameter None

return Speech recognition

Example Please refer to Table 4.36

Table 4.39 broadcast speech

Instruction

Description Broadcast speech

Parameter Set speech that need to broadcast

return None

Example Please refer to Table 4.36

Image Getting
Table 4.40 Get image automatically

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


21
Dobot Scratch User Guide 4 Program Instructions

Instruction

Description Get image automatically

Parameter Set time to get image

return None

Example
Click and the camera will take a picture after 3s, if the picture’s tag contains Home, the

Robot will execute home function.

Table 4.41 Get image manually

Instruction

Description Get image manually

Parameter None

return None

Example
Click and click take a picture, if the picture’s tag contains Home, the Robot will execute

home function

Table 4.42 Save image

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


22
Dobot Scratch User Guide 4 Program Instructions

Instruction

Description An image will be saved in this module

Parameter None

return Image

Example Please refer to Table 4.41

Image Recognition
Create Image Date
Click Edit classification data to popup create image date interface.

Figure 4.9 Edit classification data

Click to get image and name it. (please colse your computer camera before
using camera)

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


23
Dobot Scratch User Guide 4 Program Instructions

Figure 4.10 Get image and name it

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.

Figure 4.11 Cut picture

Click Training model to test image, put object below the camera, and the system
will match it via feature.

Figure 4.12 Training model

Click Finish to finish creating image after finish image testing.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


24
Dobot Scratch User Guide 4 Program Instructions

Figure 4.13 Finish model

Instruction Description
Table 4.43 Image name recognition

Instruction

Description Recognize image name

Parameter Put an image into the module

return Image name

Example Please refer to Table 4.40

Table 4.44 Cut and recognize image

Instruction

Description Cut and recognize image

Parameter Put an image into the module

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

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


25
Dobot Scratch User Guide 4 Program Instructions

Table 4.45 Get the number of image which is cut

Instruction

Description Get the number of image which is cut

Parameter None

return Image number

Example Please refer to Table 4.44

Table 4.46 Get number of picture which is cut

Instruction

Description Get number of picture which is cut

Parameter Picture number:set cut picture number

return name

Example Please refer to Table 4.44

Table 4.47 Get coordinate of picture

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


26
Dobot Scratch User Guide 4 Program Instructions

Instruction

Description Get coordinate of picture which is cut

Parameter Picture number:set cut picture number

coordinate:select axis

return Coordinate value

Example Please refer to Table 4.44

Face Recognition
Create Face Date
Click New face data topopup the create face date interface.

Figure 4.14 Create face data

Click to get face data and name it.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


27
Dobot Scratch User Guide 4 Program Instructions

Figure 4.15 Get face data and name it

Click Training model to test face date

Figure 4.16 Training model

Put your face below the camera, and click Test to match it via feature.

Figure 4.17 Train model

Click Finish to finish creating face data.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


28
Dobot Scratch User Guide 4 Program Instructions

Figure 4.18 finish training model

Instruction Description
Table 4.48 sexual recognition

Instruction

Description Recognize sexual via face data

Parameter Face data:put face data into the module

Sexual:male, female

return True:Recognize successfully

False:Recognize failed

Example Click key space to execute and recognize a man’ sexual and expression.

Table 4.49 Expression recognition

Instruction

Description Recognize expression via face data

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


29
Dobot Scratch User Guide 4 Program Instructions

Parameter Expression:

 Normal

 Smile

 Laugh

return True:Recognize successfully

False:Recognize failed

Example Please refer to Table 4.48

Table 4.50 Get name

Instruction

Description Get name via face data

Parameter Put face date into the module

return Name

Example Click to execute program. If the picture match is greater than 0, broadcast
picture’s name

Table 4.51 Face match

Instruction

Description Get face match results

Parameter face:put a face data into the module

name:select match name

return Match range:0%~100%

Example Please refer to Table 4.50

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


30
Dobot Scratch User Guide 4 Program Instructions

OCR Recognition
Table 4.52 OCR recognition

Instruction

Derscription Recognize the text of image

Parameter Put an image into this module

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

Photoelectric and Color Sensor


Table 4.53 Set infrared sensor state

Instruction

Description Set infrared sensor state

Parameter Status: set status on, off

Version: Select the appropriate sensor version

Port: Select the port where the sensor is connected to the robot

Return None

Table 4.54 Get infrared sensor value

Instruction

Description Get Infrared Sensor value

Parameter port:Select the port where the sensor is connected to the robot

Return Value

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


31
Dobot Scratch User Guide 4 Program Instructions

Table 4.55 Get color sensor state

Instruction

Description Set color sensor status

Parameter Status: set status

 On

 Off

Version: Select the corresponding color sensor version

Port: Select the port where the sensor is connected to the robot arm

Return None

Table 4.56 Get color sensor value

Instruction

Description Get color sensor value

Parameter Select color:

 Red

 Green

 Blue

Return Color value

Magic Box
Table 4.57 Output analog signal pin value

Instruction

Description Output analog signal pin value

Parameter Pin:Set pin number

Value:Set value, value range: 0~255

Return None

Table 4.58 Output digital signal pin value

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


32
Dobot Scratch User Guide 4 Program Instructions

Instruction

Description Output digital signal pin value

Parameter Pin:Set pin number

Level:1:high level, 0:low level

Return None

Table 4.59 Set pin state

Instruction

Description Set pin state

Parameter Pin: Select the pin according to the function type

Function type:

 IOFunctionDummy

 IOFunctionDO

 IOFunctionDI

 IOFunctionPWM

 IOFunctionADC

 IOFunctionDIPU

 IOFunctionDIPD

Return None

Table 4.60 Set PWM output

Instruction

Description Set PWM output

Parameter Pin: input pin

Frequency: Set the frequency. Value range: 10HZ ~ 1MHZ

Duty Cycle: Set the duty cycle. Value range: 0 ~ 100

Return None

Table 4.61 Read the value of a digital signal

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


33
Dobot Scratch User Guide 4 Program Instructions

Instruction

Description Read the value of a digital signal

Parameter Pin: Enter the pin number

Return 1:high level, 0:low level

Table 4.62 Read the value of a digital signal

Instruction

Description Read the value of a digital signal

Parameter Pin: Enter the pin number

Return True: read successfully

false: read failed

Table 4.63 Read the value of an analog signal

Instruction

Description Read the value of an analog signal

Parameter Pin: Enter the pin number

Return 1:high level

0:low level

Table 4.64 Set stepper motor speed

Instruction

Description Set stepper motor speed

Parameter Motor: Select motor

Speed: Motor speed (puls / s)

Return None

Table 4.65 Set the number of stepping motor speed pulses

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


34
Dobot Scratch User Guide 4 Program Instructions

Instruction

Description Set the number of stepping motor speed pulses

Parameter Motor: Select motor

Speed: Set motor speed (puls/s)

Pulse number: set the number of motor pulses

Return None

Table 4.66 Set the conveyor motor speed

Instruction

Description Set the conveyor motor speed

Parameter Motor: Select motor

Speed: Set the motor speed

Return None

Mobile Platform
Mobile Platform
Table 4.67 Initialize the mobile platform

Instruction

Description Initialize the mobile platform

Parameter None

Return None

Table 4.68 Initialize the mobile platform key

Instruction

Description Initialize the mobile platform key

Parameter None

Return None

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


35
Dobot Scratch User Guide 4 Program Instructions

Table 4.69 Set LED state

Instruction

Description Set LED state

Parameter Sselect LED:

 LED1

 LED2

 LED3

 LED4

Set state:

 ON

 OFF

 BLINK

Return None

Table 4.70 Set the movement direction and speed of the car

Instruction

Description Set the movement direction and speed of the car

Parameter Direction:

 Ahead

 Back

 Turn Left

 Turn Right

Speed: set the duty cycle, range (0 ~ 255)

Return None

Table 4.71 Set the movement direction, speed and time of the car

Instruction

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


36
Dobot Scratch User Guide 4 Program Instructions

Description Set the movement direction, speed and time of the car

Parameter Direction:

 Ahead

 Back

 Turn Left

 Turn Right

Speed: set the duty cycle, range (0 ~ 255)

Time: Set time (seconds)

Return 无

Table 4.72 Set the motor speed

Instruction

Description Set the motor speed

Parameter Select motor:

 Right

 Left

speed:Set the motor speed, the setting range (0 ~ 160rpm)

Return None

Table 4.73 Set the motor parameters

Instruction

Description Set the motor parameters

Parameter KP: scale factor. Value range: 0.5 ~ 2.5

KI: integration factor. Value range: 0.05 ~ 0.5

Return None

Sensor

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


37
Dobot Scratch User Guide 4 Program Instructions

Table 4.74 Start sonar

Instruction

Description Start sonar

Parameter Select sonar:

 Right Front

 Front

 Left Front

Return None

Table 4.75 Detect barrier

Instruction

Description Detect barrier

Parameter Select sonar:

 Right Front

 Front

 Left Front

Return true: Obstacle detected

false: No obstacle detected

Table 4.76 Get detection distance

Instruction

Description Obtain ultrasound data of a certain position, that is, the distance between the car and the obstacle

Parameter Select sonar:

 Right Front

 Front

 Left Front

Return Distance

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


38
Dobot Scratch User Guide 4 Program Instructions

Table 4.77 Get the infrared sensor data

Instruction

Description Get the infrared sensor data

Parameter Select IR:

 IR1

 IR2

 IR3

 IR4

 IR5

 IR6

Return IR data

Table 4.78 Set the color sensor white balance

Instruction

Description Set the color sensor white balance

Parameter Select color sensor:

 Right

 Left

Return None

Table 4.79 Set color sensor state

Instruction

Description Set color sensor state

Parameter Select color sensor:

 Right

 Left

state:

 ON

 OFF

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


39
Dobot Scratch User Guide 4 Program Instructions

Return None

Table 4.80 Get RGB value

Instruction

Description This block is used to obtain the color value by the color sensor

Parameter Select color sensor:

 Right

 Left

Color:

 Red

 Green

 Blue

Return Infrared sensor color value. Value range: 0 ~ 255

Table 4.81 Detect color

Instruction

Description This block is used to detect whether the color sensor detects a color

Parameter Select color sensor:

 Right

 Left

Color:

 Red

 Green

 Blue

Return True: Color detected

False: No color detected

Table 4.82 Get the switch state

Instruction

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


40
Dobot Scratch User Guide 4 Program Instructions

Description Get the switch state

Parameter Select button:

 1

 2

Return 1:press

0:release

Table 4.83 Get the motor angle

Instruction

Description Get the motor angle

Parameter Select motor:

 Right

 Left

Return Angle

Table 4.84 Set the ultrasonic sensor detection threshold

Instruction

Description Set the ultrasonic sensor detection threshold

Parameter Set threshold: set the detection threshold, value range: 0 ~ 51.2cm

Return None

Table 4.85 Set position offset

Instruct
ion

Descri Set the position offset corresponding to the sensor


ption

Param IR:
eter  IR1

 IR2

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


41
Dobot Scratch User Guide 4 Program Instructions

 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

Table 4.86 Get the infrared sensor offset

Instruction

Description Get the infrared sensor offset

Parameter None

Return Return deviation

Table 4.87 Get the infrared sensor offset after PID processing

Instruction

Description Get the infrared sensor offset after PID processing

Parameter None

Return Return deviation

Arduino
Serial Port
Table 4.88 Set pin mode

Instruction

Description Set pin mode

Parameter Pin: input pin index

Select mode:

 OUTPUT

 INPUT

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


42
Dobot Scratch User Guide 4 Program Instructions

 INPUI_PULLUP

Return None

Table 4.89 Set baud rate for serial data transmission

Instruction

Description Set baud rate for serial data transmission

Parameter Baud rate: Set the baud rate for data transmission

Return None

Table 4.90 Set Xbee data transmission baud rate

Instruction

Description Set Xbee data transmission baud rate

Parameter Baud rate: Set the baud rate for data transmission

Return None

Table 4.91 Serial print

Instruction

Description Serial print

Parameter Set data

Return None

Table 4.92 Serial line feed

Instruction

Description Serial line feed

Parameter Set data

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


43
Dobot Scratch User Guide 4 Program Instructions

Return None

Table 4.93 Get serial value length

Description Get serial value

Parameter None

Return Serial data byte

Table 4.94 Get serial string

Instruction

Description Get serial string

Parameter None

Return String

IO Operation
Table 4.95 Set Arduino digital level

Instruction

Description Set Arduino digital level

Parameter  pin

 level:high or low

Return None

Table 4.96 Set analog pin value

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

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


44
Dobot Scratch User Guide 4 Program Instructions

Paramet  pin:pin number


er  value:value range 0~255

Return None

Table 4.97 Read digital signal pin

Instruction

Description Read digital signal pin value

Parameter Pin: Pin number

Return True: read successfully

False: read failed

Table 4.98 Read digital signal pin value

Instruction

Description Read digital signal pin value

Parameter Pin: Pin number

Return Pin value

Table 4.99 Read analog signal pins

Instruction

Description Read analog signal pins

Parameter Pin: Pin number

Return Pin value

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

Parameter  Pin number


 Output frequency, value range: 31~65535HZ

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


45
Dobot Scratch User Guide 4 Program Instructions

 Output duration, value range: 0~4294967295 us

Return None

Table 4.101 Set angle of the servo motor

Instruction

Description Set angle of the servo motor

Parameter  Pin: Pin number

 Angle: Motor angle, value range: 0°~180°

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.

Figure 4.19 Vision sorting initialization

NOTICE

Need to download and install PixyMo n according to different PC systems

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


46
Dobot Scratch User Guide 4 Program Instructions

Figure 4.20 Download PixyMon

Move the robot arm to the suction cup close to the plane and click the "Record"
button to record the plane height.

Figure 4.21 Record base level

According to the actual situation, write in the height of the different colored squares,
and then click "Record".

Figure 4.22 Record block height

Move the camera to the wooden block recognition position, click "Record" to obtain

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


47
Dobot Scratch User Guide 4 Program Instructions

the position of the robot arm or manually enter the position of the robot arm and click
"Record".

Figure 4.23 Record recognition position

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".

Figure 4.24 Record calibration position

NOTICE

Before using Signature1 to select wooden blocks, you need to open the Console. Click
on "View-> Console"

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


48
Dobot Scratch User Guide 4 Program Instructions

Figure 4.25 open 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

Figure 4.27 Record position

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


49
Dobot Scratch User Guide 4 Program Instructions

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.

Figure 4.28 Select block

Figure 4.29 Color matching

Speech Recognition
Table 4.102 Initialize speech recognition module

Instruction

Description Initialize speech recognition module

Parameter None

Return None

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


50
Dobot Scratch User Guide 4 Program Instructions

Table 4.103 Add speech

Instruction

Description Add speech to speech recognition module

Parameter Voice content: Edit voice content

Speech recognition phrase: Select the speech recognition phrase serial number to be
added

Return None

Table 4.104 Detect voice module

Instruction

Description Detect voice module

Parameter Select speech recognition column number

Return True: Voice detected

False: No speech detected

JoyStick
Table 4.105 Get button status

Instruction

Description Get button status

Parameter Select button:

 Red

 Green

 Blue

Return State:

 true: Up

 false: Down

Table 4.106 Set LED state

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


51
Dobot Scratch User Guide 4 Program Instructions

Instruction

Description Set LED state

Parameter Select LED:

 Red

 Green

 Blue

State:

 ON

 OFF

Return None

Table 4.107 Get LED state

Instruction

Description Get LED state

Parameter Select LED

 Red

 Green

 Blue

Return LED state

 True: ON

 False: OFF

Table 4.108 Read Joystick value

Instruction

Description Read Joystick value

Parameter Joystick coordinate

 x

 y

Return Joystick value

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


52
Dobot Scratch User Guide 4 Program Instructions

Table 4.109 Check Joystick state

Instruction

Description Check Joystick state

Parameter None

Return Press state:

 true: Up

 false: Down

AIStarter
AIStarter
Table 4.110 Initialize AI-Starter

Instruction

Description Initialize AI-Starter

Parameter None

Return None

Table 4.111 Initialize switch

Instruction

Description Initialize switch

Parameter None

Return None

Table 4.112 Set LED status

Instruction

Description Set LED state

Parameter Select LED:

 LED1

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


53
Dobot Scratch User Guide 4 Program Instructions

 LED2

Set state:

 ON

 OFF

 BLINK

Return 无

Table 4.113 Set PID

Instruction

Description This program block is used to set the motor parameters

Parameter KP: scale factor. Value range: 0.5 ~ 2.5

KI: integration factor. Value range: 0.05 ~ 0.5

Return None

Motion

Table 4.114 Set direction and speed of AI-Starter

Instruction

Description Set direction and speed of AI-Starter

Parameter Direction:

 Ahead

 Back

 Turn left

 Turn right

Speed: Set Duty ratio. Value range: 0-255

Return None

Table 4.115 Set the movement direction, speed and time of AI-Starter

Instruction

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


54
Dobot Scratch User Guide 4 Program Instructions

Description Set the movement direction, speed and time of AI-Starter

Parameter Direction:

 Ahead

 Back

 Turn left

 Turn right

Speed: Set Duty ratio. Value range: 0-255

Return None

Table 4.116 Set motor speed

Instruction

Description Set motor speed

Parameter Select the motor

 LEFT

 RIGHT

Speed: Set the motor speed. Value range: 0r/m – 100r/m

Return None

Table 4.117 Attach sever

Instruction

Description Make servo attach to make AIStarter unload

Parameter Select servo

Return None

Table 4.118 Detach servo

Instruction

Description Make servo detach to make AIStarter restore

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


55
Dobot Scratch User Guide 4 Program Instructions

Parameter Select servo

Return None

Table 4.119 Set servo angle

Instruction

Description Set servo angle

Parameter Servo:select motor

Angle:set angle

Return None

Sensor
Table 4.120 Start sonar

Instruction

Description Start sonar

Parameter Sonar position:

 Right Front

 Front

 Left Front

Return None

Table 4.121 Detect barrier

Instruction

Description Detect whether a barrier is exist in front of AI-Starter, before calling this module, please start
the corresponding sonar

Parameter Obstacle position:

 Right Front

 Front

Left Front

Return true: There is a barrier

false: There is no barrier

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


56
Dobot Scratch User Guide 4 Program Instructions

Table 4.122 Get sonar data

Instruction

Description Get the detection distance of sonar, which is the distance between AI-Starter and barrier.

Parameter Sonar position:

 Right Front

 Front

Left Front

Return Detection distance

Table 4.123 Get infrared sensor data

Instruction

Description Get infrared sensor data

Parameter IR:

 IR1

 IR2

 IR3

 IR4

 IR5

 IR6

Return false: Black line

true: White line

Table 4.124 Get geomagnetic angle

Instruction

Description Get geomagnetic angle

Parameter None

Return Geomagnetic angle

Table 4.125 Set calibration

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


57
Dobot Scratch User Guide 4 Program Instructions

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

Table 4.126 Set color sensor white balance

Instruction

Description Set color sensor white balance

Parameter Color sensor:

 Right

 Left

Return None

Table 4.127 Set color sensor state

Instruction

Description Set color sensor state

Parameter Color sensor:

 Right

 Left

state:

 ON

 OFF

Return None

Table 4.128 Detect RGB

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


58
Dobot Scratch User Guide 4 Program Instructions

Instruction

Description Get color sensor value

Parameter Color sensor:

 Right

 Left

Color:

 Red

 Green

 Blue

Return True: Detect successfully

False: Detect failed

Table 4.129 Get RGB

Instruction

Description Get color sensor value

Parameter Color sensor:

 Right

 Left

Color:

 Red

 Green

 Blue

Return Color sensor value. Value range: 0~255

Table 4.130 Get Switch state

Instruction

Description Get switch state

Parameter Switch:

 Switch 1

 Switch 2

 Switch 3

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


59
Dobot Scratch User Guide 4 Program Instructions

Return true: Press

false: Release

Table 4.131 get photosensitive value

Instruction

Description get photosensitive value

Parameter None

Return Photosensitive value. Value range: 0 – 4096

Table 4.132 Set sonar threshold

Instruction

Description Set sonar threshold

Parameter Set threshold. Value range: 0~51.2cm

Return None

Table 4.133 Set the position offset

Instruct
ion

Descri Set the position offset corresponding to the sensor


ption

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.

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


60
Dobot Scratch User Guide 4 Program Instructions

Return None

Table 4.134 Get the infrared sensor offset

Instruction

Description Get the infrared sensor offset

Parameter None

Return Return deviation

Table 4.135 Get the infrared sensor offset after PID processing

Instruction

Description Get the infrared sensor offset after PID processing

Parameter None

Return Return deviation

Table 4.136 Get motor pose

Instruction

Description Get motor pose

Parameter Select motor:

 Right

 Left

Return Motor pose (Number of pulses obtained by the encoder)

Xbee
Table 4.137 Get Xbee value

Instruction

Description 该Instruction用于读取Xbee数值

Parameter 无

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


61
Dobot Scratch User Guide 4 Program Instructions

Return Xbee数值

Table 4.138 Send Xbee value

Instruction

Description Send Xbee values

Parameter Value: Set the value to be sent

Return None

Table 4.139 Compare two Xbee value

Instruction

Description Compare two Xbee values

Parameter Value: Set the value to be compared

Return Ture: same

False: different

Table 4.140 Clear Xbee cache

Instruction

Description Clear the Xbee cache

Parameter None

Return None

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.


62
Dobot Scratch User Guide 4 Program Instructions

DOBOT
Shenzhen Yuejiang Technology Co., Ltd
www.dobot.cc

Issue V1.3.1(2020-01-15) User Guide Copyright © Yuejiang Technology Co., Ltd.

You might also like