Inspiring Mindstorms EV3 Programming for FLL Part 1: Reusable EV3 Move Straight My Block

In this post, we will explain the importance of creating a reusable EV3 Move Straight My Block and provide step-by-step instructions on how to make one. Our approach is based on what we learned during our first year of EV3 programming, drawing from various resources such as ev3lessons and the Winning Design book.

During the 2019 CITY SHAPER season, we relied heavily on the EV3 Move Straight Inches My Block to drive our robot short distances. We hope this post will be useful in helping you create your own reusable My Block in EV3 MindStorms.

If you prefer to use centimeters or millimeters as your distance unit, you can create the EV3 Move Straight Centimeters My Block or Move Straight Millimeters My Block instead.

If you’re interested in FLL robot design, please check out our posts on robot design principles. We welcome your feedback and suggestions.

If you’re interested in SPIKE Prime programming, please check out our posts.

Moving a robot straight forward or backward for a specified distance is a fundamental function in robotics. There are various ways to accomplish this, such as using the Move Steering block or Move Tank block. For most cases, the Move Steering block is suitable. This block has five different modes, which are illustrated in the screenshot below.

Move Steering Block
Move Steering Block "On for Degrees" Mode

The ‘On for Degrees’ mode activates both large motors (port B and C), waits until one of them has turned for the specified number of degrees of rotation in the ‘Degrees’ input, and then turns both motors off. This mode is useful for making a robot travel a specific distance, where 360 degrees of rotation corresponds to one full turn of a motor.

However, the question remains: how many degrees are required to travel a certain distance, such as 10 inches? Unfortunately, using the ‘Degrees’ input for motor rotation is not always intuitive.

To answer this question, we need to understand the concept of Wheel Circumference.

Wheel Circumference

The wheel circumference is the distance that a wheel travels in one complete rotation. It can be calculated as the product of the wheel diameter and pi (3.14). For example, the circumference of a wheel with a diameter of 68.8 millimeters or 2.71 inches can be calculated as follows:

 PI * Diameter = 3.14 * 68.8 = 216 millimeters or 8.5 inches.

Wheel Cirumference
Wheel Circumference Illustration

Distance to Travel vs Motor Degree Ratio

The distance to travel vs motor degree ratio is defined as:

Ratio = 360 / circumference = 360 / (PI * Diameter)

The unit of the distance to travel is the same as the unit for diameter. For example, if a wheel has a diameter of 68.8 mm or 2.71 in, the ratio would be:

360 / 216 = 1.67 degrees per mm or 360 / 8.5 = 42.3 degrees per inch.

So, to travel 1 mm, we would need to enter 1.67 motor degrees, and to travel 1 inch, we would need to enter 42.3 motor degrees.

Multiplying the distance to travel by the distance to travel versus motor degree ratio gives us the motor degrees input for the Move Steering block.

To make this easier, we’ve created tables that list the distance to travel versus motor degree ratios for three types of LEGO wheels that come with the Education set. The ratios are calculated in different distance units (millimeters, centimeters, and inches).

Check this section to find out a wheel’s diameter.

Distance to travel vs motor degree ratio in unit of degree/mm

Wheel Size Diameter (mm) Circumference (mm) Ratio (degree/mm)
88 x 14.34
88
276
1.3
68.8 x 36
68.8
216
1.67
56 x 28
56
175.84
2.05
43.2 x 22
43.2
135.65
2.65

Distance to travel vs motor degree ratio in unit of degree/cm

Wheel Size Diameter (cm) Circumference (cm) Ratio (degree/cm)
88 x 14.34
8.8
27.6
13
68.8 x 36
6.88
21.6
16.7
56 x 28
5.6
17.58
20.5
43.2 x 22
4.32
13.57
26.5

Distance to travel vs motor degree ratio in unit of degree/inch

Wheel Size Diameter (in) Circumference (in) Ratio (degree/in)
88 x 14.34
3.46
10.86
33.1
68.8 x 36
2.71
8.5
42.3
56 x 28
2.2
6.9
52.1
43.2 x 22
1.7
5.3
67.4

Move Straight Using the Distance to Travel vs Motor Degree Ratio

Once we have the distance travel vs motor degree ratio, we can calculate motor degrees needed if we want our robot to travel certain millimeters or inches. The following screenshot shows how to program using Move Steering block.

EV3 Move Straight in Millimeters
EV3 Move Straight in Millimeters

We use a math multiplication block to calculate the needed motor degrees based on distance to travel and the ratio. We use data wire to send the calculated result of motor degrees to Move Steering’s Degrees input.

If you prefer to use inch as the distance unit, the program is shown as following:

EV3 Move Straight in Inches
EV3 Move Straight in Inches

Reusable EV3 Move Straight My Block

Now, let’s make a My Block so our program will be reusable. First, we select the math block, the move steering block, and the comment. Then we select My Block Builder from the Tools menu.

Move Straight Inches My Block
Move Straight Inches My Block Step 1

Next, let’s enter the My Block name and select an icon as shown below.

Move Straight Inches My Block
Move Straight Inches My Block Step 2

Next, we add a parameter called Inches to specify the distance of our robot to travel.

Move Straight Inches My Block
Move Straight Inches My Block Step 3

We select the “inches” icon for the inches parameter.

Move Straight Inches My Block
Move Straight Inches My Block Step 4

Repeat step 3 and 4 to create another parameter called power.

Move Straight Inches My Block
Move Straight Inches My Block Step 5

At last, we use data wire to connect the input parameters.

Move Straight Inches My Block
Move Straight Inches My Block Step 6

How to Use Move Straight My Block

After creating the reusable Move Straight Inches My Block, we can easily use it whenever we need to drive the robot forward or backward for a specified distance. The following image demonstrates how to use the My Block in a program. This example also uses another reusable My Block, called MyPivotTurn, which we will discuss in a future post.

Move Straight Inches My Block
Move Straight Inches My Block Example

Where to Find out the Diameter of an EV3 Wheel

LEGO wheels size including the diameter can be found on the tire’s rim as shown below. The size is specified as two numbers. The first number is diameter in millimeters. The second is the width in millimeter.

For example the large EV3 wheel’s size is 68.8 x 36. It means the diameter is 68.8 millimeters or 2.71 inches.

LEGO Wheel Size
LEGO Wheel Size

To find out a list of LEGO Wheels & their sizes, please refer to this website though it is not complete.

This Post Has One Comment

  1. Terry dundcjdncdnc

    This really helps me on how to make a my block and tells me how to do it

Comments are closed.