Blockly Intro-Robotics 061722
Blockly Intro-Robotics 061722
WITH BLOCKLY
INTRODUCTION
THE CURRICULUM
This curriculum was designed to teach high school and college level students the basics of robotics, as used in
industry, using the Dobot Magician, DobotStudio software, and the blockly programming language.
Through these activities, you will also be able to make the robot interact with other devices including, but not
limited to:
• Arduino microcontrollers • Infrared sensors
• Color sensors • Other robots
• Conveyor belts • Other inputs like microswitches and
• Other outputs like motors and LED’s sensors
• VEX Cortex microcontroller
We would like to look at AI from a practical standpoint. How AI helps us in industrial robotics and
automation is what intrigues us the most and what we are most passionate about. In that vein, the
next question to answer then is: “How does this curriculum embody artificial intelligence?”
With the above definition of AI, isn’t a lot of automation & robotics considered artificial intelligence?
Take these instances of what students will be able to do with a dobot and this curriculum:
All of these are possible with only a Dobot Magician, A microcontroller, this curriculum, a little
determination, and a lot of curiosity.
2
INTRODUCTION
Industry 4.0: The 4th industrial revolution where manufacturing facilities employ computers,
machines, and technology, that have inputs and outputs that allow them to wirelessly connect to
ever larger manufacturing systems.
No more is a drill press just a drill press. It may be a CNC machine that has a vision system that
knows where a hole has to go as well as what size it is. Also this machine can be programmed
on the fly to change rapidly if a different order comes in from a different vendor. It’ll even tell
the customer when the part will be done, and in some instances, some factories will even let
customers watch their parts being produced via webcam. The list of tasks above in the definition
of AI are all within reach of high school and college students alike, and aren’t these tasks all a part
of Industry 4.0?
With a Dobot Magician, this curriculum, and a bunch of spare parts, computers, and some
ingenuity, students will definitely be headed in the right direction towards being a part of the future
of Industry; no matter what it’s called when they graduate.
3
CONTENTS
Curriculum Standards......................................................................................................Page 7
4
CONTENTS
5
CONTENTS
6
CURRICULUM STANDARDS
The Standards for Technological and Engineering Literacy (STEL) were developed by the International
Technology and Engineering Educators Association (ITEEA) and are available as a complete download
for free here: https://www.iteea.org/189252.aspx
2W Standard: Select resources that involve tradeoffs between competing values, such as
availability, cost, desirability, and waste while solving problems.
2X Standard: Cite examples of the criteria and constraints of a product or system and how
they affect final design.
7CC Standard: Apply a broad range of design skills to their design process.
7W Standard: Determine the best approach by evaluating the purpose of the design.
8H Standard: Research information from various sources to use and maintain technological
products or systems.
The Next Generation Science Standards is a multi-state effort to create new education standards
that are "rich in content and practice, arranged in a coherent manner across disciplines and grades
to provide all students an internationally benchmarked science education." More information can be
found here: http://www.nextgenscience.org/
7
CURRICULUM STANDARDS
The Standards for Mathematical Practice describe varieties of expertise that mathematics educators
at all levels should seek to develop in their students. These practices rest on important “processes
and proficiencies” with longstanding importance in mathematics education. More information here:
http://www.corestandards.org/Math/Practice/
N.Q.1 Quantities
Use units as a way to understand problems and to guide the solution of multistep
problems; choose and interpret units consistently in formulas; choose and interpret the
scale and the origin in graphs and data displays.
N.Q.3 Quantities
Choose a level of accuracy appropriate to limitations on measurement when reporting
quantities.
8
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
9
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
10
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
11
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
12
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
13
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
14
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
15
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
16
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
17
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
18
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
19
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
20
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
21
Presentation 1:
BLOCKLY & DOBOT - PROGRAMMING COMMANDS
22
Activity 1:
PICK AND PLACE
INTRODUCTION
In this activity you will learn how to make a basic Pick and
Place operation in blockly. Through this activity you will learn
how to program the robot to move and turn on it’s suction cup
in blockly.
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS shutdown
the Dobot before making connections or damage to the robot could occur.
KEY VOCABULARY
Helpful Tips: All blockly commands have been put into a separate document called Blockly
Vocabulary, and can be referred to at any time throughout all of these activities.
ESSENTIAL QUESTIONS
23
Activity 1:
PICK AND PLACE
PROCEDURE
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS turn it off
before making connections or damage to the robot could occur. Be sure to ask your instructor if
you have any questions.
2. Set up the robot with a suction cup and Air pump and place a cube in one of the red squares on
the field diagram provided.
24
Activity 1:
PICK AND PLACE
The Crosshair Icon can be used to reset the zoom level back to default and center your code in
the middle of the field.
25
Activity 1:
PICK AND PLACE
The first step in the Blockly Pick and Place process will be
to define the X, Y, and Z coordinates for each step.
You may also use the lock button, and then look at the
coordinates in this window to see what the XYZ values of
the points are.
26
Activity 1:
PICK AND PLACE
X Y Z
1. Home
2. Above Pick
3. At Pick
5. Above Pick
6. Above Place
7. At Place
9. Above Place
10. Home
27
Activity 1:
PICK AND PLACE
Click on the Question Mark that appears. This will allow you
to name the position.
Helpful Tips: The Text Box that appears can be relocated and resized as needed. Clicking on the
Question Mark again will collapse the call out box.
Helpful Tips: You can also right click on a step and select
Duplicate to create a copy of the step. This may speed up
the process for steps that have similar coordinates.
28
Activity 1:
PICK AND PLACE
29
Activity 1:
PICK AND PLACE
Helpful Tips: When dragging around blocks of code, if you select the top block, it will allow you to
drag around that block and all of the blocks connected below it. If you selected a block of code from
the middle of a string of blocks, it will disconnect that block and all of the blocks below it. Complete
the remaining portion of the program. Remember to add one additional SuctionCup command to
turn off the Vacuum after placing the block down.
You should notice that we have the same issue in Blockly that we
had in Teach and Playback where the suction cup has not fully
engaged as the arm moves away from the ATPick location. We
need to solve this problem in the same manner by adding a pause
in the line of code to allow the vacuum to build up.
Drag and drop the Delaytime block over the programming field.
30
Activity 1:
PICK AND PLACE
If your set up did not work correctly the first time, what did you have to do to make it work?
31
Activity 1:
PICK AND PLACE
CONCLUSION
1. What are the five needed positions for a pick and place operation?
2. Explain in your own words why it was necessary to add delay times into the program in the
space below.
3. What is the purpose of the safe positions that are programmed above the object before it is
picked up.
GOING BEYOND
Finished early? Try some of the actions below. When finished, show your instructor and have them
initial on the line.
1. Reverse the process so that at the end the robot puts the cube/cylinder back in its
original position.
2. Try picking and placing the object on locations that are not directly in front of the
robot. What does this change? Can this be corrected in Blockly as it was in Teach
and Playback?
32
Activity 2:
PNP WITH JUMPS AND LOOPS
INTRODUCTION
In this activity you will learn one way to simplify your code
as well as add different styles of loops to a basic Pick and
Place operation in blockly.
KEY VOCABULARY
Helpful Tips: All blockly commands have been put into a separate document called Blockly
Vocabulary, and can be referred to at any time throughout all of these activities.
ESSENTIAL QUESTIONS
33
Activity 2:
PNP WITH JUMPS AND LOOPS
PROCEDURE
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS turn it off
before making connections or damage to the robot could occur. Be sure to ask your instructor if
you have any questions.
2. Set up the robot with a suction cup and place a cube in one of the red squares on the field
diagram provided.
34
Activity 2:
PNP WITH JUMPS AND LOOPS
35
Activity 2:
PNP WITH JUMPS AND LOOPS
If your set up did not work correctly the first time, what did you have to do to make it work?
Next we are now going to make the program loop, or restart, for
a certain number of times. To do this we will be using the repeat
block and the while loop, both can be found in the Loops
section on the left.
The repeat block is very easy to use. Drag the repeat block
into a program environment. It can be dragged into the empty
space or dragged directly onto the top connection for the
ChooseEndTools. If the Repeat loop is dragged onto the empty
space, grab the top line of the existing program and pull it into
the repeat loop. The repeat loop will automatically expand to
encompass the entire code. The program will now run for the set
number of times specified in the repeat.
36
Activity 2:
PNP WITH JUMPS AND LOOPS
Run the program again. To ensure the Repeat Loop works as designed. You will need to manually
replace the cube or cylinder at the start of each of the loops.
If your set up did not work correctly the first time, what did you have to do to make it work?
In order to do this, first drag the code out of the repeat block and then delete it.
Helpful Tips: If you select the Repeat Loop to be deleted before the program section is pulled out of
the loop, it will delete the loop and everything it contains.
Go to the Loops Section and drag the Repeat While loop over and drag the rest of the program into it.
Repeat While statements are different than Repeat a number of times as a Repeat while requires
a condition to be true or false to determine if they run or not, and the Repeat Times only requires a
number of times to repeat/loop; no conditions must be met.
37
Activity 2:
PNP WITH JUMPS AND LOOPS
In the Logic Section, you will see a True block. Drag this over to
the puzzle link next to the top of the while loop and it should snap
into place. This will cause the loop to run forever as statement
can never be false.
Once again, run the program and you should see that once the program drops off the block and
returns to it’s safe position, it goes back to the start of the program to try to pick up another block and
that this will continue repeating indefinitely until you hit the stop button or the robot is turned off.
If your set up did not work correctly the first time, what did you have to do to make it work?
38
Activity 2:
PNP WITH JUMPS AND LOOPS
CONCLUSION
2. Can a loop be placed inside another loop? Give an example of how you might use this when
programming in Blockly.
3. Describe in your own words how a JumpTo command works. Why is it good programming practice
to use JumpTo’s?
GOING BEYOND
Finished early? Try some of the actions below. When finished, show your instructor and have them
initial on the line.
1. Nesting Loops
Produce 2 different pick and place routines
Routine 1 will repeat three times
Then routine 2 will repeat twice
This process will loop routine 1 and then 2 forever
2. Produce a repeat loop for a dipping operation. Use the JumpTo when appropriate.
39
Activity 3:
PICK AND PLACE WITH INPUTS
INTRODUCTION
KEY VOCABULARY
• Forever Loop
• While Loop
• Placeholder
• Multiplexing
• Inputs
ESSENTIAL QUESTIONS
40
Activity 3:
PICK AND PLACE WITH INPUTS
PROCEDURE
2. Set up the robot with a suction cup and place a cube in one of
the red squares on the field diagram provided.
3. Wire the robot such that the LIMIT SWITCH is plugged into
port GP5.
41
Activity 3:
PICK AND PLACE WITH INPUTS
42
Activity 3:
PICK AND PLACE WITH INPUTS
43
Activity 3:
PICK AND PLACE WITH INPUTS
Caution: Be sure to consult the Dobot Input/Output Guide if you want to use other inputs and
outputs, as damage to your robot or your other equipment may result.
Now run the program. In the running log you should see it printing 0’s or 1’s while the
switch is not pressed and it should swap printing to either a 1 or a 0 while it is pressed.
N.O. - If you see 0’s that change to 1’s, your switch or the Dobot is wired N.O. -
Normally Open. The input will read Low or False until the switch is pressed.
N.C. - If you see 1’s that change to 0’s, your switch or the Dobot is wired N.C. -
Normally Closed. The input will read high or true until the switch is pressed
44
Activity 3:
PICK AND PLACE WITH INPUTS
Helpful Tips: If this is not the case, you may be plugged into the wrong port, have the wrong port
selected for the IO setup, or have the wiring for the switch incorrect. Please refer to the Dobot Input/
Output Guide for your setup and try again. Remember to turn the power off to the robot if you
switch any wires.
If your setup did not work correctly the first time, what did you have to do to make it work?
Now that we are able to see the switch, get rid of the Print block. We are now going to make a while
loop that will run as long as the switch is pressed. Drag another while loop into the Forever loop but
instead of dragging in a True block as we did previously, we are going to go to the Logic section and
drag over a [blank] = [blank] block. This block is how we check if an item is equal, greater, lesser,
or not equal to another item. In the left side of the block, drag in the GetLevelInput block that we just
used. We then are going to go to the Math Section and grab a number block, and drag that into the
right side of the block and change it into a 1.
Create the Nested Loop as seen above (steps provided below). A nested loop is a loop within another
loop. We will place the robot’s pick and place movement commands inside the second loop that is
only called to start if the robot sees a change in the input value on input EIO05. Refer to your testing to
whether the robot should start the movement on a 1 or a 0.
45
Activity 3:
PICK AND PLACE WITH INPUTS
Helpful Tips: Once a loop has started, it will continue to finish ALL of the steps in the loop even if the
condition that started the loop becomes false. The condition to start the loop is only evaluated at the
beginning of each loop
Now that the nested loop is setup, we want to re-enable our previous code for the pick and place
routine. To do this, right click on the loop again and click enable. Once it is enabled, drag the
movement code from the old loop into the new loop and then delete or disable the old loop. In the end
it should like this but with real values instead of placeholders.
46
Activity 3:
PICK AND PLACE WITH INPUTS
Once the program is written, run it and see if it works correctly. If it does not work, troubleshoot it until
it does.
If your set up did not work correctly the first time, what did you have to do to make it work?
47
Activity 3:
PICK AND PLACE WITH INPUTS
CONCLUSION
1. What would happen if the loop detecting the switch wasn’t in a forever loop? Try it and describe
what happens. (Hint: Make sure to be holding the switch when you start the program.)
2. What happens to the Pick and Place process when the switch is released (the loop condition
becomes false)?
GOING BEYOND
Finished early? Try some of the actions below. When finished, show your instructor and have them
initial on the line.
1. Break the pick and place activity into multiple sections that will wait for the limit switch
before performing each step.
48
Activity 4:
DEVELOPING A CUBE MATRIX
INTRODUCTION
KEY VOCABULARY
ESSENTIAL QUESTIONS
49
Activity 4:
DEVELOPING A CUBE MATRIX
PROCEDURE
2. Set up the robot with a suction cup and place a cube on all of the empty
squares on the field diagram provided. (Cube color does not matter for
this Activity.)
50
Activity 4:
DEVELOPING A CUBE MATRIX
Functions:
• Group of Code: Can be several lines of code that is needed to complete a single task or
operation. Allows a programmer to group thoughts or actions.
• Use Multiple Times: Functions can be called to run multiple times throughout a program.
• Simplifies Editing: Code that repeats itself multiple times throughout a program now only needs
to be edited once.
51
Activity 4:
DEVELOPING A CUBE MATRIX
• HOME X Value
• HOME Y Value
• HOME Z Value
• PICK X Value
• PICK Y Value
• PLACE X Value
• PLACE Y Value
• COMMON Z ABOVE Value
• COMMON Z AT Value
52
Activity 4:
DEVELOPING A CUBE MATRIX
Using either the Jog Controls, or the Lock Button find the
values for the table below.
Helpful Tips:
• Use Cube ‘0’, from the diagram on page 1, as the X
and Y location for the Pick Location.
• Round all values to the nearest whole number.
• Align the center of the vacuum gripper to the center of
the cube.
• Use the location of dip dank 2 for the common drop
off point.
• Ensure the CommonZAbove positions is high enough
to clear the other blocks.
• Write the values in the table below or in your notebook
for future reference.
HomeX
HomeY
HomeZ
PickX
PickY
PlaceX
PlaceY
CommonZAt
CommonZAbove
53
Activity 4:
DEVELOPING A CUBE MATRIX
Left Click on the next variable name and select New Variable.
Create New Variables for each block and fill in their values.
The order in which we set the variables does not matter in this
program.
54
Activity 4:
DEVELOPING A CUBE MATRIX
From the Variable section, you can now see that all of the
variables that we have created are now options to use.
55
Activity 4:
DEVELOPING A CUBE MATRIX
Helpful Tips: Assigning variables really helps when XYZ coordinates in a program are going to have
to change multiple times or is going to be used as a template for multiple programs. The can be altered
once at the beginning of the program and that will update everywhere they were used in the program. It
also makes reading the program easier as the user now sees words in place of number values.
56
Activity 4:
DEVELOPING A CUBE MATRIX
Once the program is written, run it and see if it works correctly. If it does not work, troubleshoot it until
it does.
Helpful Tips: Remember, if you hit a limit with the robot at any time, or you hear a clicking or a
grinding noise, it's always a good idea to home the robot again. Also, if the robot does not return to the
same position, just re-home it.
If your set up did not work correctly the first time, what did you have to do to make it work?
57
Activity 4:
DEVELOPING A CUBE MATRIX
58
Activity 4:
DEVELOPING A CUBE MATRIX
Now that the PickX value has been adjusted, repeat the
entire process of picking up the second and third cubes
and dropping them off at the place location.
Helpful Tips: If a loop is deleted before pulling the group of code out of the loop, it will delete the
loop and its content.
59
Activity 4:
DEVELOPING A CUBE MATRIX
Since one full column of blocks is completed, just repeat this again for the next two columns.
This can be done by resetting the X value to what it was in the code before and move the Y value over
to the next column.
Repeat this block of code with those two changes two more times to complete the entire matrix.
60
Activity 4:
DEVELOPING A CUBE MATRIX
Part 3: Simplification
2. Pick up the first object using predefined location points from the list of variables. Add or subtract
whatever value is needed to go from the center of the start object to the center of the next object
and repeat this process in a loop for however many objects are in that specific column.
3. Reassign the start value that was altered in section 2 back to the original value. Add or subtract
whatever value is needed to go from the center of the start object in column one to the center of
the next object in column 2.
61
Activity 4:
DEVELOPING A CUBE MATRIX
62
Activity 4:
DEVELOPING A CUBE MATRIX
The program is still very long even though variables were used to make it shorter and simpler.
The next step is to simplify it even further with a block of code called a function. A function is a
named section of a program that performs a task. It can also be considered a procedure or a routine
and greatly simplifies otherwise complicated programs.
When a program calls a function to run, the program pauses, runs the function, and then returns to the
program where it left off.
63
Activity 4:
DEVELOPING A CUBE MATRIX
64
Activity 4:
DEVELOPING A CUBE MATRIX
Once the program is written, run it and see if it works correctly. If it does not work, troubleshoot it until
it does.
If your set up did not work correctly the first time, what did you have to do to make it work?
CONCLUSION
3. Explain what would have to be done to palletize two layers using bullet points or a step by step list
below.
65
Activity 4:
DEVELOPING A CUBE MATRIX
GOING BEYOND
Finished early? Try some of the actions below. When finished, show your instructor and have them
initial on the line.
1. Use a switch as an input to make the robot wait until you move the block from the
Place position and hit the switch.
3. Develop a program that will run the entire process in reverse. Take a block from a
common location and distribute them into a 3x3 matrix. This process is referred to as
palletizing.
66
Activity 5:
USING THE COLOR SENSOR
INTRODUCTION
In this activity you will learn how to use and program the
color sensor in blocky.
The dobot will pick up a part and move it above the color
sensor. The dobot will then check the part’s color and
place it in a specific location for that specific color part.
The robot will repeat the process each time a limit switch
is pressed.
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS shutdown
the Dobot before making connections or damage to the robot could occur.
KEY VOCABULARY
ESSENTIAL QUESTIONS
67
Activity 5:
USING THE COLOR SENSOR
PROCEDURE
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS turn it off
before making connections or damage to the robot could occur. Be sure to ask your instructor if
you have any questions.
2. Wire the robot with the Color Sensor plugged into port GP2
3. Wire the robot with the Limit Switch plugged into port GP5 - EI05
Set up the robot, conveyor, and color sensor as shown in the diagram below:
68
Activity 5:
USING THE COLOR SENSOR
Order of Operations
• Start with the robot a safe/home position.
• Place a single cube, one at a time for the robot to pick up from a common location.
• A limit switch will be used to call for the robot to come and get the block for evaluation.
• After determining its color, drop the cube off at a specific location for that color.
• Manually remove the cube once it has been placed and send the robot to its home position.
69
Activity 5:
USING THE COLOR SENSOR
The next set of commands are needed to get the values from the color sensor to report the correct
values to our program.
Step 1
70
Activity 5:
USING THE COLOR SENSOR
Step 2
71
Activity 5:
USING THE COLOR SENSOR
Step 3
Group or consolidate all three color possibilities into one variable that can be used in the program.
Step 4
72
Activity 5:
USING THE COLOR SENSOR
73
Activity 5:
USING THE COLOR SENSOR
The last step is to attach the LIST and the RETURN DATA block to
the variable COLORFOUND.
Final Variable - Max Value from the List - Individual Color Variables
We can now link all of our variables together in one grouping as seen below:
74
Activity 5:
USING THE COLOR SENSOR
Now that the sensor is setup, it needs to be tested to make sure everything is reading correctly. The
color sensor needs to report what color it is currently reading and is setup in Blockly to only read RED,
BLUE, and GREEN.
A loop needs to be created that will show in the Running Log the
following information:
There are two new commands that will be needed to check the
cube’s color and decide which location to take the cube to.
“If” statements are used when 2 or more conditions need to be evaluated. A three part “If” statement
needs to be set up.
ELSE do this (Else will be read as anything other than the RED or GREEN cube which will include
our BLUE cube.
Helpful Tips: The If structure used in this example will allow a NO CUBE or INVALID COLOR to be
read as BLUE since BLUE is setup as the else condition. If your program is only reading BLUE, it may
not be reading a color at all.
75
Activity 5:
USING THE COLOR SENSOR
76
Activity 5:
USING THE COLOR SENSOR
77
Activity 5:
USING THE COLOR SENSOR
2. Setting Up Variables
3. If Structure
78
Activity 5:
USING THE COLOR SENSOR
Once the program is completed, run it and see if it works correctly. Every time you put a colored block
in front of the sensor, you should see the correct color reported in the running log. If it does not work,
troubleshoot it until it does.
What does the sensor reads when there is no cube placed on the sensor?
What type of reading do you get as you raise the cube up and away from the sensor?
Sometimes you will get a single missed, or incorrect reading as it changes between colors. Why?
If your set up did not work correctly the first time, what did you have to do to make it work?
79
Activity 5:
USING THE COLOR SENSOR
TROUBLESHOOTING
Helpful Tips: The color sensor works best if the object is held at a consistent distance from the
sensor Dobot suggested distance = (5mm to 10mm) or (1/4 to 3/8).
Helpful Tips: The different versions of the color sensors can come with different shades of colored
cubes. The V1 sensors tend to come with a lighter green and blue than the V2 sensors. This can cause
an issue with the sensors reading correctly. The V2 sensor tend to be more forgiving when it comes to
shades of colors. Remember that the color sensor is an analog sensor that reports a range of variable
values as it detects colors to the program. Since we cannot see or adjust this number, you may need to
play around with different colors and distances.
80
Activity 5:
USING THE COLOR SENSOR
Helpful Tips: The Z values can be shared for both the pick and place positions.
The Lower Z Value for the Color Sensor needs to be about 10mm above the sensor face. This height
allows the sensor to catch the reflection off the block to determine its color.
81
Activity 5:
USING THE COLOR SENSOR
3. Delay - 1 Second
4. Move up
c. Move to home
82
Activity 5:
USING THE COLOR SENSOR
All of the separate sections of the program should look like this.
Helpful Tips: Be sure to consult the Dobot Input/Output Guide if you want to use other inputs and
outputs, as damage to your robot or your other equipment may result.
Once the program is completed, run it and see if it works correctly. If it does not work, troubleshoot it
until it does. Issues with the colors? See a simple color checking program below the “Going Beyond
Section.”
If your set up did not work correctly the first time, wait did you have to do to make it work?
83
Activity 5:
USING THE COLOR SENSOR
CONCLUSION
1. What happens if a block isn’t there when the color sensor is told to get a color with the current
program? Give a reason why.
2. How might you keep track of how many blocks there are of each color?
GOING BEYOND
Finished early? Try some of the actions below. When finished, show your instructor and have them
initial on the line.
1. Randomly arrange cubes in a 3x3 palletized matrix for the robot to pick from. After
determining its color, drop the cube off at a specific color location. Manually remove
the cube once it has been placed.
3. Color the 9 squares on the Dobot field diagram either red, blue, or green. You will then
write a program that takes cubes from a cube matrix and puts the respective color
cubes on the colored squares.
84
Activity 6:
START & STOP CONVEYOR
INTRODUCTION
Helpful Tips: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS shutdown
the Dobot before making connections or damage to the robot could occur.
KEY VOCABULARY
ESSENTIAL QUESTIONS
85
Activity 6:
START & STOP CONVEYOR
PROCEDURE
Order of Operations
• The Robot will pick up a cube from a known location and place it on the conveyor belt.
• The Robot will return home and then start the conveyor belt.
• The conveyor belt will run until the block arrives at the IR Sensor for inspection.
• The block will be manually removed from the belt, inspected and then returned to the belt.
• Once the block is returned to the belt, the belt will run again until the parts runs off the belt and into
storage.
• The process will loop forever.
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS turn it off
before making connections or damage to the robot could occur. Be sure to ask your instructor if
you have any questions.
2. Plug the Conveyor Belt into STEPPER2 of Robot and plug the IR sensor into GP5 of the Robot.
86
Activity 6:
START & STOP CONVEYOR
87
Activity 6:
START & STOP CONVEYOR
If your set up did not work correctly the first time, what did you have to do to make it work?
88
Activity 6:
START & STOP CONVEYOR
89
Activity 6:
START & STOP CONVEYOR
If your set up did not work correctly the first time, what did you have to do to make it work?
90
Activity 6:
START & STOP CONVEYOR
91
Activity 6:
START & STOP CONVEYOR
92
Activity 6:
START & STOP CONVEYOR
Once the program is completed, run it and see if it works correctly. If it does not work, troubleshoot it
until it does.
If your set up did not work correctly the first time, what did you have to do to make it work?
Reminder:
The next step is to create a loop that will allow the block to be removed and then wait for it to be
returned. The issue is that we have no idea when the block has been removed, how long it will take for
the inspection, or when it will be returned.
We need to create a closed loop system that will look for the following conditions without respect to
time.
93
Activity 6:
START & STOP CONVEYOR
One that will wait for a ‘0’ and one that will wait for
a ‘1’
94
Activity 6:
START & STOP CONVEYOR
95
Activity 6:
START & STOP CONVEYOR
Once the program is written, try it and make sure that it works as expected. If it does not work
correctly, troubleshoot until it does.
If your set up did not work correctly the first time, what did you have to do to make it work?
96
Activity 6:
START & STOP CONVEYOR
CONCLUSION
1. Why is it better to have the infrared sensor stopping the conveyor belt rather than just running it for
time?
2. How would the program be different if the conveyor belt could not be run as a linear rail?
3. What’s one way to determine where the robot is at any given time in the program?
GOING BEYOND
Finished early? Try some of the actions below. When finished, show your instructor and have them
initial on the line.
2. Use the color sensor and make the robot report what color block is being sent down
the conveyor.
97
Presentation 2:
BLOCKLY & DOBOT - HARDWARE CONNECTIONS
98
Presentation 2:
BLOCKLY & DOBOT - HARDWARE CONNECTIONS
99
Presentation 2:
BLOCKLY & DOBOT - HARDWARE CONNECTIONS
100
Presentation 2:
BLOCKLY & DOBOT - HARDWARE CONNECTIONS
101
Presentation 2:
BLOCKLY & DOBOT - HARDWARE CONNECTIONS
102
Presentation 2:
BLOCKLY & DOBOT - HARDWARE CONNECTIONS
103
Presentation 2:
BLOCKLY & DOBOT - HARDWARE CONNECTIONS
104
Activity 7:
DOBOT TO DOBOT HANDSHAKING
INTRODUCTION
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS shutdown
the Dobot before making connections or damage to the robot could occur.
KEY VOCABULARY
ESSENTIAL QUESTIONS
105
Activity 7:
DOBOT TO DOBOT HANDSHAKING
PROCEDURE
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS turn it off
before making connections or damage to the robot could occur. Be sure to ask your instructor if
you have any questions.
1. Set up both Robots with a suction cups - GP1 & SW1 and place
2. Dobot field diagrams, taped to the work surface, between the two robots.
Open Loop System Block Diagram: Robot #1 acts as the input for robot #2. Robot #2 does not
communicate back to robot #1 so there is no feedback. The Handshake Module acts as the device
that helps make the handshake happen safely.
Order Of Operations
ROBOT 1 - OUTPUT SIGNAL ROBOT 2 - INPUT SIGNAL
• Move - Home • Move - Home
• Move - ABPick • Move - ABPick
• Move - ATPick • Move - ATPick
• Jump - ATPlace • Jump - ATPlace
• Move - ABPlace • Move - ABPlace
• Move - Home • Move - Home
• Send Output Signal • Wait for INPUT Signal
106
Activity 7:
DOBOT TO DOBOT HANDSHAKING
107
Activity 7:
DOBOT TO DOBOT HANDSHAKING
108
Activity 7:
DOBOT TO DOBOT HANDSHAKING
Set Enabled to ON
109
Activity 7:
DOBOT TO DOBOT HANDSHAKING
Once this portion of the program is completed, run it and see if it works correctly. The LED on the
handshake module should light up whenever EIO13 is enabled ON. If it does not work, troubleshoot it
until it does.
If your set up did not work correctly the first time, what did you have to do to make it work?
Helpful Tips: The LED helps us determine if the signal is actually being sent by the first robot. We
can write a simple Blockly program to see if the second robot is getting the signal. The issue is if the
second robot is not getting the signal….. WHY is it not getting the signal? It could be a damaged
optical isolator.
An easy way to check is to use a voltage meter set to check RESISTANCE. When no signal is present,
the voltmeter should read “O.L” or “---”. When a signal is present it should read near the resistance
value of the resistor used.
110
Activity 7:
DOBOT TO DOBOT HANDSHAKING
Throughout the remainder of this activity, we will use many of the skills that you have developed in
previous activities. If you need clarification at any point, you can go back to the other activities for
more information.
111
Activity 7:
DOBOT TO DOBOT HANDSHAKING
Throughout the remainder of this activity, we will make assumptions that you have already learned
several concepts in previous activities.
112
Activity 7:
DOBOT TO DOBOT HANDSHAKING
If your set up did not work correctly the first time, what did you have to do to make it work?
Now that both programs are created AND tested, it is time to put it all together.
Finish the Handshake Module and replace the manual limit switch on ROBOT 2 with the breadboard
connection.
113
Activity 7:
DOBOT TO DOBOT HANDSHAKING
Caution: Be sure to consult the Dobot Input/Output Guide if you want to use other inputs and
outputs, as damage to your robot or your other equipment may result.
Once the program is completed, run it and see if it works correctly. If it does not work, troubleshoot it
until it does.
If your set up did not work correctly the first time, what did you have to do to make it work?
114
Activity 7:
DOBOT TO DOBOT HANDSHAKING
CONCLUSION
1. What would you have to do to make this program run five times without any human intervention?
Explain fully below.
2. What other inputs could you use on your robot to start this process? Use the Dobot Input/Output
Guide to answer this question, and do not attempt to try it without your instructor’s permission.
3. What other outputs could you use on your robot to start this process? Use the Dobot Input/Output
Guide to answer this question, and do not attempt to try it without your instructor’s permission.
GOING BEYOND
Finished early? Try some of the actions below. When finished, show your instructor and have them
initial on the line.
1. Change the LEDs to Motors. Be sure to get your instructor’s permission, and be sure
to use the correct outputs for the motor chosen.
Caution: Be sure to consult the Dobot Input/Output Guide if you want to use other inputs and
outputs, as damage to your robot or your other equipment may result.
115
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
INTRODUCTION
The limit switch attached to each microcontroller will control the on and off function of the other
controller’s motor.
Helpful Tips: This activity was written for arduino uno microcontrollers, but the principles taught in this
activity could be applied to any other microcontroller as well. The principles of communication between
devices are the same, but the hardware and software setup may be different. Even when using different
“brands” of arduinos, the programming may be a bit different. If you try something as presented here,
and it does not work with your microcontroller, you may have to do some troubleshooting to get it to
work. It is also advisable to check the documentation for microcontrollers, as well as any user forums
on line as well.
KEY VOCABULARY
• Limit Switch
• If/Else Statement
• Loop
• Void/Function
• Handshaking
116
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
ESSENTIAL QUESTIONS
PROCEDURE
Each Arduino will be able to control the ON/OFF of the LED on the other Arduino.
1. The digital output of each Arduino will be attached to a digital input of the other Arduino
2. A SPST Normally Open (N.O.) limit switch will be connected to each Arduino
4. Build and wire 2 handshake modules. One as seen below and one mirrored.
117
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
118
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
119
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
120
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
OR
121
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
122
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
123
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
Once this portion of the program is completed, run it and see if it works correctly. If it does not work,
troubleshoot it until it does.
If your set up did not work correctly the first time, what did you have to do to make it work?
Helpful Tips: When the digital Output is turned on / high, the LED on the handshake module
should turn on.
If the Debugger window reads correctly, the LED turns on, but no signal is being seen by the other
Arduino, check your wiring. As a last resort, the Optical Isolator could be damaged. Ask your instructor
to help you evaluate the signal side of the Isolator using a voltmeter and the images below. Voltmeter
should be set to OHMS. The meter should read zero when no signal is present and approximately the
value of the resistor used on the signal side when a signal is present.
124
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
CONCLUSION
1. What are some similarities of microcontroller programming and blockly? List at least two and
explain how they are similar.
2. What are some differences between microcontroller programming and blockly? List at least two
and explain how they are different.
3. Why is it important to use the optical isolator when communicating? Explain in your own words.
125
Activity 8:
HANDSHAKING - ARDUINO TO ARDUINO
GOING BEYOND
Finished early? Try the action below. When finished, show your instructor and have them initial on the
line.
1. Use a motor instead of an LED. Be sure to consider what type of motor you are using,
and be sure to check with your teacher before attempting this; especially if you switch
outputs on the microcontroller.
126
Activity 9:
HANDSHAKING - VEX TO VEX
INTRODUCTION
KEY VOCABULARY
• Limit Switch
• If/Else Statement
• While True Loop (Forever Loop)
• Handshaking
127
Activity 9:
HANDSHAKING - VEX TO VEX
ESSENTIAL QUESTIONS
PROCEDURE
1. The digital output of each Cortex (dgtl1) will be attached to a touch input (dgtl2) of the other
Cortex.
2. Build and wire 2 handshake modules. One as seen below and one mirrored.
128
Activity 9:
HANDSHAKING - VEX TO VEX
129
Activity 9:
HANDSHAKING - VEX TO VEX
130
Activity 9:
HANDSHAKING - VEX TO VEX
131
Activity 9:
HANDSHAKING - VEX TO VEX
132
Activity 9:
HANDSHAKING - VEX TO VEX
Once this portion of the program is completed, run it and see if it works correctly. If it does not work,
troubleshoot it until it does.
If your set up did not work correctly the first time, what did you have to do to make it work?
133
Activity 9:
HANDSHAKING - VEX TO VEX
Helpful Tips: Use the Debugger window to troubleshoot your program. When the Limit Switch is
pressed, both the dgtl1 (Send Signal) and dgtl3 (Limit Switch) should read true.
When the digital Output is turned on / high, the LED on the handshake module should turn on.
Helpful Tips: If the Debugger window reads correctly, the LED turns on, but no signal is being seen
by the other cortex, check your wiring. As a last resort, the Optical Isolator could be damaged. Ask
your instructor to help you evaluate the signal side of the Isolator using a voltmeter and the images
below. Voltmeter should be set to OHMS. The meter should read zero when no signal is present and
approximately the value of the resistor used on the signal side when a signal is present.
134
Activity 9:
HANDSHAKING - VEX TO VEX
CONCLUSION
1. What would you have to do to make this program run five times without any human intervention?
Explain fully below.
2. What other inputs could you use on your VEX Cortex to start this process? Use the Dobot Input/
Output Guide to answer this question, and do not attempt to try it without your instructor’s
permission.
3. What other outputs could you use on your VEX Cortex? Be sure to check with your instructor first!
GOING BEYOND
Finished early? Try some of the actions below. When finished, show your instructor and have them
initial on the line.
1. Change the Motors to servos. Be sure to get your instructor’s permission, and be sure
to use the correct inputs and outputs in RobotC.
135
Activity 10:
HANDSHAKING - DOBOT TO VEX
INTRODUCTION
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS shutdown
the Dobot before making connections or damage to the robot could occur.
KEY VOCABULARY
ESSENTIAL QUESTIONS
136
Activity 10:
HANDSHAKING - DOBOT TO VEX
PROCEDURE
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS turn it off
before making connections or damage to the robot could occur. Be sure to ask your instructor if
you have any questions.
4. Wire the Microcontroller Digital Output (sendSig) to dgtl1 and the Touch (receiveSig) to dgtl2.
5. Wire both the Robot and the Microcontroller to the handshake modules as shown on the next
pages.
Order of Operations
ROBOT VEX - Microcontroller
• Move - Home • Wait for INPUT Signal
• Move - ABPick • Turn on Grinding Station
• Move - ATPick • Run the station for 3 seconds
• Pick Up Cube • Send OUTPUT signal to Dobot
• Jump - ATMachine
• Send OUTPUT signal to VEX
• Wait for INPUT Signal
• Jump- ATPick
• Release Cube
• Move - ABPick
• Move - Home
137
Activity 10:
HANDSHAKING - DOBOT TO VEX
DOBOT SETUP
138
Activity 10:
HANDSHAKING - DOBOT TO VEX
139
Activity 10:
HANDSHAKING - DOBOT TO VEX
Caution: Be sure to consult the Input/Output Guide if you want to use other inputs and outputs,
as damage to your robot or your other equipment may result.
…Where’s the rest of the activity? If you need additional assistance, please refer to the previous
activities. All concepts were taught, and this one was left open ended so that you may apply what
you’ve learned.
Once the program is completed, run it and see if it works correctly. If it does not work, troubleshoot it
until it does.
If your set up did not work correctly the first time, what did you have to do to make it work?
140
Activity 10:
HANDSHAKING - DOBOT TO VEX
GOING BEYOND
Finished early? Try some of the actions below. When finished, show your instructor and have them
initial on the line.
1. Have the robot take blocks from a matrix, machine them, and drop them off at a
finished location (example: dropped into a bin).
2. Make another machine out of VEX parts and make the robot perform two operations.
3. Have the robot pick them up when a switch is hit, and then palletize them after
grinding.
141
Activity 11:
WORKCELL DESIGN
INTRODUCTION
KEY VOCABULARY
142
Activity 11:
WORKCELL DESIGN
ESSENTIAL QUESTIONS
PROCEDURE
Caution: NEVER wire anything to the Dobot Magician while it has power on. ALWAYS turn it off
before making connections or damage to the robot could occur. Be sure to ask your instructor if
you have any questions.
1. You and your team will design, organize, create, program and test a full work cell. Your instructor
will have you pick from the list below the items that must be included in your work cell.
Machine Examples
• Pneumatic Stamping Press • Painting Station
• Rotary or Reciprocating Saw • Drying Station
• Welder • Drilling Station
• Quality Control Station • ???
143
Activity 11:
WORKCELL DESIGN
2. Be sure to note any additional parameters that are given to you by your instructor (due date, size
or storage requirements, and additional items from home. Take notes in the space below.
3. In the time allotted for this project design a workcell that includes the following:
Caution: Be sure to consult the Dobot Input/Output Guide if you want to use other inputs and
outputs, as damage to your robot or your other equipment may result.
144
Activity 11:
WORKCELL DESIGN
CONCLUSION
1. Make a flowchart/Process flowchart of your workcell as indicated by your instructor in the space
below.
2. What’s the pseudocode that you used for your microcontroller program? Copy and paste it here.
GOING BEYOND
Finished early? Try some of the actions below. When finished, show your instructor and have them
initial on the line.
1. Make your workcell communicate with someone else’s workcell in your class. When
your process ends, theirs begins.
2. Same as number one, but use the same part in both cells. In other words, perform 2
operations in two separate cells, on the same part.
145
BLOCKLY GLOSSARY
TYPE OF
VOCABULARY COMMAND DEFINITION
(if applicable)
Blockly A programming language used to program a Dobot
Magician. Lines of complex code are represented as
simple “blocks” that fit together to form programs. A
graphical programming method rather than text based.
ChooseEndTools Config A blockly config command that allows you to set the end
effector to be used in the program.
GetCurrentCoordinate Motion A blockly motion command that returns the XYZ values
of the robot’s current position.
GetPhotoelectricSensor Additional A blockly additional command that returns the value of the
sensor plugged into a given port.
146
BLOCKLY GLOSSARY
JumpTo Motion A blockly motion command that will move from one point
to another, while increasing the Z height, causing the
robot to “jump” to the next position. The default is set to
20 mm.
Laser Additional A blockly additional command that turns the laser on and
off and allows you to set the power.
MoveTo Motion A blockly motion command that allows you to move the
robot’s end effector to a given XYZ coordinate within the
robot’s work envelope.
147
BLOCKLY GLOSSARY
Repeat Loop A blockly loop command that allows you to make a set of
instructions repeat a given number of times.
SetConveyor Additional A blockly additional command that allows you tell the
program where it is plugged in, and what speed you want
it to move at n mm per second.
SetEndEffectorParams Config A blockly config command that allows you to offset the
XYZ position of an end effector.
SetJumpHeight Config A blockly config command that allows you to set the
jump height in a program.
SetLinearRailSpeed Config A blockly config command that allows you to set the
velocity and acceleration of the attached linear rail.
SetLinearSlideRail Additional A blockly additional command that allows you to tell the
program what version of the slide rail you are using, and
whether you want it on or off.
SetPhotoelectricSensor Additional A blockly additional command that allows you to turn the
photoelectric sensor on or off, tell it what version it is that
is plugged in, and what port it is plugged into.
SetItem Variable A blockly command that allows you to set a new variable
or change a variable within a program.
148
BLOCKLY GLOSSARY
SuctionCup{ON/OFF] Motion A blockly motion command that turns the suction cup on
or off.
149
FIELD DIAGRAMS
150
FIELD DIAGRAMS
151