Tickle for Studuino
Guide (Part 02) [DC Motors and Servomotors]
2017/10/20
2
Version History
Date Content
2017/10/20 First version
3
Index
1. Getting Started ....................................................................................................... 1
2. DC Motors .............................................................................................................. 2
2.1. Controlling DC Motors ............................................................................................. 2
2.1.1. Connecting a DC Motor to Studuino ............................................................... 2
2.1.2. Port Settings .................................................................................................... 3
2.1.3. Programming ................................................................................................... 4
2.2. Controlling a Car ................................................................................................... 10
2.2.1. Programming ................................................................................................. 10
2.3. Controlling a Car Using an Accelerometer ........................................................... 23
2.3.1. Connecting an Accelerometer to Studuino .................................................... 24
2.3.2. Port Settings .................................................................................................. 24
2.3.3. Accelerometer Values ................................................................................... 25
2.3.4. Programming ................................................................................................. 26
2.3.5. Using the iOS Device’s Accelerometer ......................................................... 38
3. Servomotors......................................................................................................... 39
3.1. Controlling Servomotors ........................................................................................ 39
3.1.1. Adjusting the Driveshaft Angle ...................................................................... 39
3.1.2. Connecting a Servomotor to Studuino .......................................................... 40
3.1.3. Port Settings .................................................................................................. 40
3.1.4. Programming ................................................................................................. 41
3.2. Making a Robotic Arm that Uses Three Servomotors .......................................... 45
3.2.1. Building the Robot ......................................................................................... 45
3.2.2. Port Settings .................................................................................................. 47
3.2.3. Programming ................................................................................................. 48
1
1. Getting Started
This manual explains how to use Studuino and the following electronic parts with Tickle, a
visual programming environment developed by Tickle Labs, Inc.:
・DC Motors
・Servomotors
Learn the basics of getting your Studuino working with Tickle by reading our Tickle for
Studuino Instruction Manual. Follow the steps below to download it:
1) Head to our Tickle for Studuino page at http://www.artec-kk.co.jp/studuino/en/tickle.php.
2)Go to the Instruction Manuals section and tap Tickle for Studuino.
The information in this manual is subject to revision at any time.
2
2. DC Motors
Follow along below to create a program using DC Motors.
2.1. Controlling DC Motors
In this section we’ll try getting your DC Motors moving by making a simple program.
2.1.1. Connecting a DC Motor to Studuino
Follow the instructions below to assemble your car:
(3) Use blocks to make the rear wheel.
(4) Now plug your DC Motors and Battery Box into your Studuino.
M1: Right DC motor
M2: Left DC motor
POWER: Battery Box
(1) Attach wheels to the DC Motors as shown below.
★ Make a symmetrical pair.
(2) Attach both DC Motors to the bottom of the Studuino
3
2.1.2. Port Settings
Open Port Settings and tap M1 and M2 under DC Motor.
★ See 3.2. Port Settings in Part 01 for more details.
(5) Set your Battery Box in your Studuino mount to keep it in place.
① Tap to select
② Tap
4
2.1.3. Programming
Now we're going to create a program that controls the DC Motor connected to M1, changing
the settings in real time to see how the motor responds.
① Drag , , and
from the Motion Palette and connect them.
Drag and drop
5
② Drag from the Control Palette and insert it between
and .
Now you’ve programmed DC Motor M1 to rotate.
Tap the button at the top left corner of your Project Screen to run your program. The
DC Motor connected to M1 will rotate for one second and then stop.
The button will change to while the program is running. Tap the button to
stop your program.
Drag and drop
Set the speed of the DC Motor to 100
Start rotating DC Motor
Wait 1 second
Stop rotating DC Motor
6
③ Set the value in to 50 and tap .
The DC Motor will rotate more slowly.
★ 100 is the maximum speed of your DC Motor. Typing a number higher than 100 will result
in an error message.
★ You may find that your DC Motor won’t rotate when the speed is set to 10 or lower, but
this may be caused by the batteries or the motor itself.
Try increasing the value a bit if this happens to you.
7
④ Change the value of back to 100 and set
to counter-clockwise. Now tap the button.
The DC Motor will rotate in the opposite direction.
8
⑤ Set back to clockwise. Now drag
back to the Command Palette to delete it.
9
⑥ Drag from the Motion Palette and connect it to
.
Press the button and your DC Motors will rotate for one second before
coasting to a stop.
Stop vs. Slow Down
Stops the command that tells the DC Motor to rotate
and sends a command to stop the motor,
just like applying brakes on a car.
Stops the command that tells the DC Motor to rotate
but doesn’t send a command to stop it,
allowing the car to stop using inertia without applying
the brakes.
Drag and drop
10
2.2. Controlling a Car
Now we're going to create a program that uses two DC Motors to make a car go forward,
backward, and spin.
2.2.1. Programming
First, we'll create a program that makes the car go forward.
① Drag from the Events Palette to the Script Field.
② Tap Event 1 and name the Event Forward.
Drag and drop
11
③ Drag two each of ,
, and from the Motion
Palette and connect them to .
Drag and drop
12
④ Drag from the Control Palette and insert it between
and .
Drag and drop
13
⑤ Change M1 to M2 in the second ,
, and blocks.
14
⑥ Drag from the Events Palette and connect it to
.
⑦ Tap Event and name the Event Forward.
Drag and drop
② Tap
① Tap
15
Now the program is finished.
Tap the button at the top left corner of your Project Screen to run your program and see
if your car drives forward for one second.
The button will change to while the program is running. Tap the button
to stop the program.
Now we’re going to program your car to reverse.
⑧ Tap and hold to bring up the Menu.
・Set speed for
DC Motors M1 and M2
Wait 1 second
・Stop rotating
DC Motors M1 and M2
・Start rotating
DC Motors M1 and M2
Hold
16
Keep your finger pressed to the screen and drag it to the icon. You’ll see a green line
appear as shown below. Keep your finger there and the blocks will be duplicated once the
circle is complete.
⑨ Give your duplicated blocks the Event name Backward.
17
⑩ Set the and blocks
in your Backward Event to counter-clockwise.
⑪ Tap the Event name in and choose Backward from the list.
① Tap
② Tap
18
And now you’ve programmed your car to reverse.
Now tap the button at the top left corner of the Project Screen to start your program and
see if your car reverses for one second.
The button will change to while the program is running. Tap the button to
stop your program.
19
Now we’re going to program your car to turn right.
⑫ You’ll need to duplicate your Forward Event, just like you did for your Backward Event.
Duplicate
20
⑬ Change the Event name to RotationRight. Now change the top
to counter-clockwise.
And now you’ve programmed your car to turn right.
Now tap the button at the top left corner of the Project Screen to start your program and
see if your car turns right for one second.
The button will change to while the program is running. Tap the button to
stop your program.
① Change to RotationRight
② Change to counter-clockwise
21
Now we’re going to program your car to turn left.
⑭ You’ll need to duplicate your Forward Event, just like you did for your
RotationRight Event.
Duplicate
22
⑮ Change the Event name to RotationLeft. Now change the
to counter-clockwise.
And now you’ve programmed your car to turn left.
Now tap the button at the top left corner of the Project Screen to start your program and
see if your car turns left for one second.
The button will change to while the program is running. Tap the button to
stop your program.
① Change to RotationLeft
② Change to counter-clockwise
23
2.3. Controlling a Car Using an Accelerometer
Now we’re going to use your program from 2.2. Controlling a Car to program your car to
respond when you tilt your Accelerometer.
An Accelerometer is a sensor that measures acceleration (changes in speed over a fixed
period of time), reading directional acceleration from the X, Y, and Z axes.
X Y
Z
24
2.3.1. Connecting an Accelerometer to Studuino
Connect your Accelerometer to Sensor/LED/Buzzer connector A4 and A5 on your Studuino.
2.3.2. Port Settings
Open Port Settings and tap A4 and A5 under Sensor/LED/Buzzer. Now choose
Accelerometer.
★ See 3.2. Port Settings in Part 01 for more details.
The Accelerometer requires two
connectors because it has four
wires.
Accelerometer
A4-A5
Keep an eye on your cables!
The gray wire should be on the inside.
Gray Black Black
① Tap to select
② Tap
25
2.3.3. Accelerometer Values
Accelerometer values have a range of -2 to +2.
The X, Y, and Z values will be 0 when the Accelerometer is level and move towards -1 or +1
when you tilt it. Shake the sensor and they’ll move towards -2 or +2.
Look below to see the values for your sensor’s X, Y, and Z axes.
Looking up the X, Y, and Z values of your Accelerometer allows you to tell which direction
the sensor is being tilted or shaken in.
X
Z
Y
0 +1 -1 -2 +2
Level (horizontal) Down
Vertical
X/Y/Z Value
Shaken Shaken
Up
Vertical
Tilted Tilted
26
2.3.4. Programming
We’ll be using your car’s forward, backwards, and turn programs from 2.2.1. Programming.
27
① Change the value of to 0.1.
28
② Change the blocks that stop your DC Motor from
to .
29
③ Remove and delete the in every Event.
Delete
30
④ Drag two from the Motion Palette and connect them
to . Now set the second one to M2.
Drag and drop
31
⑤ Drag from the Control Palette and connect it to
.
Drag and drop
32
⑥ Drag from the Operators Palette and insert it into .
Drag and drop
33
⑦ Drag from the Devices Palette into the left side of
and choose Studuino.
Drag and drop
34
⑧ Set the right value of to -0.4. Drag from the Motion
Palette into the opening of . Now select Forward.
② Drag and drop
① Type -0.4
③ Select Forward
35
⑨ ⑤Repeat steps ⑤ through ⑧ to make the Events for your X and Y axes shown
below.
If Y value is
smaller than -0.4
send RotationLeft.
If Y value is
bigger than 0.4
send RotationRight.
If X value is
smaller than -0.4
send Forward.
If X value is
bigger than 0.4
send Backward.
36
⑩ Insert every set of blocks you’ve made up to step ⑨ into . Now connect them to
.
37
And now you’ve programmed your car to respond to your Accelerometer.
Tap the button at the top left corner of the Project Screen to run your program. Your car
should move when you tilt your Accelerometer in any direction.
The button will change to while the program is running. Tap the button to
stop your program.
Move your Accelerometer and your car will move in the following directions:
・If Accelerometer is tilted forward
Run Forward
Set DC Motors M1 and M2
to 100
If Accelerometer is tilted backward
Run Backward
If Accelerometer is tilted left
Run RotationLeft
If Accelerometer is tilted right
Run RotationRight
Go forward
Reverse
Left turn
Right turn
Go forward
Reverse
Right turn
Left turn
38
2.3.5. Using the iOS Device’s Accelerometer
You can also control your car using your iOS device’s accelerometer instead of your
Studuino’s. Your device’s accelerometer is based on the orientation of its screen. This
means that the X-axis will always be to the left, the Y-axis at the bottom, and the Z-axis to
the back of the device.
Make the program shown below in order to use your device’s accelerometer to control your
car:
Y
X
X
Y
Z
Z
If X value is
smaller than -0.4,
send RotationLeft.
If X value is
bigger than 0.4,
send RotationRight.
If Y value is
bigger than 0.4,
send Forward.
If Y value is
smaller than -0.4,
send Backward.
39
3. Servomotors
3.1. Controlling Servomotors
Now let’s try getting a Servomotor moving using variable and operator blocks.
3.1.1. Adjusting the Driveshaft Angle
Before you add your Servomotors to your car, using the following method to check if
your driveshaft is connected properly: Try turning the driveshaft left or right. If the
angles are too far off from the default position, this means that the block portion of
the driveshaft has slipped.
This block is designed to slip in order to keep from damaging the internal gear when there’s
too much pressure on the driveshaft.
Use your fingers to rotate the block in the opposite direction of the slip. You’ll hear click that
tells you that it’s back in the default position.
Default
Normal
Slipped
Drive
Shaft
Body
Cable
★ Don’t slip your motor on purpose!
This can damage your Servomotor!
40
3.1.2. Connecting a Servomotor to Studuino
Connect your Servomotor to D9 on your Studuino.
3.1.3. Port Settings
Open Port Settings and tap D9 under Servomotor.
★ See 3.2. Port Settings in Part 01 for more details.
① Tap to select
② Tap
DC Motor D9
Gra
y B
lack
Bla
ck
Keep an eye on your cables! The gray
wire should be on the inside.
41
3.1.4. Programming
① Take from the Motion Palette and connect it to
.
Drag and drop
42
② Replace the 90 in with 0.
Tap the button at the top left corner of the Project Screen. Your Servomotor should turn
to 0 degrees.
③ Repeat this process by replacing the 0 with 180 and your Servomotor will rotate to 180
degrees when you tap the button.
The button will change to while the program is running. Tap the button
to stop your program.
43
④ Remove from . Now drag
from the Control Palette and connect it to .
① Drag and drop
② Drag and drop
44
⑤ Insert into .
⑥ Replace the 180 in with 0 and your Servomotor will
slowly rotate to 0 degrees when you tap the button.
You can use to enclose multiple Servomotor blocks.
Any Servomotors inside this block will rotate at the same speed to the angle you set.
The button will change to while the program is running. Tap the button
to stop your program.
Drag and drop
45
3.2. Making a Robotic Arm that Uses Three Servomotors
It’s time to make an Arm Robot using three Servomotors and your Studuino’s buttons.
3.2.1. Building the Robot
Follow the instructions below to assemble your robot:
Part 1 D10
Part 2
D11 ★ It should be the same shape
as Part 1.
Part 3 D9
Finished!
Finished!
Finished!
46
Building the Arm
(1) Put together parts 1-3 as shown.
(2) Add your Battery Box to your Studuino
and plug it into the POWER connector as shown.
POWER
(3) Add your arm and plug your Servomotors into the connectors as shown.
Gra
y
Bla
ck
Bla
ck
Keep an eye on your cables! The gray
wire should be on the inside.
D10
D11
D9
Part 3 Part 1
Part 2
47
3.2.2. Port Settings
Open Port Settings and tap D9, D10, and D11 under Servomotors. Now tap A0, A1, and A2
under Button.
★ See 3.2. Port Settings in Part 01 for more details.
① Tap to select
② Tap to select
③ Tap
48
3.2.3. Programming
We’ll need to program button A0 to move D9, A1 to move D10, and A2 to move D11.
Look at the table below to see the angle combinations you’ll need to use for each button:
Push-button Servomotor Variable Angle 1 Angle 2
A0 D9 D9 115 90
A1 D10 D10 115 90
A2 D11 D11 50 150
① Tap + Add a Variable button at the bottom of the screen. Now tap [x] Variable and name
it D9.
① Tap
② Tap
③ Name it D9
49
② Drag from the Events Palette to the Script Field.
Drag and drop
50
③ We’ll need to make a process that changes D9’s angle every time you press A0. Drag
from the Control Palette and connect it to
.
Drag and drop
51
④ Drag from the Operators Palette and insert it into .
Drag and drop
52
⑤ Drag from the Data Palette into the left side of . Now set the right
side to 115.
Drag and drop
53
⑥ Drag two from the Data Palette into the opening of .
Type 90 into the top and 115 into the bottom .
① Drag and drop
② Tap here and type
54
⑦ Drag from the Motion Palette to the Script Field.
Drag and drop
55
⑧ Drag from the Data Palette and insert it into .
Drag and drop
56
⑨ Drag from the Data Palette and connect it to .
Now you've programmed Servomotor D9 to rotate from 90 to 115 degrees and back every
time you press button A0.
Tap the button at the top left corner of your Project Screen to run your program and see
how it works.
The button will change to while the program is running. Tap the button to
stop your program.
Drag and drop
57
⑩ ①Now repeat steps ① through ⑨ to program your remaining two Servomotors.
58
Now you’ve programmed your robot’s arm to change the angles of D9, D10, and D11 when
you press A0, A1, and A2.
Tap the button at the top left corner of the Project Screen. Your robot’s arm should
move when you press A0, A1, and A2.
The button will change to while the program is running. Tap the button to
stop your program.
59