Happy Pi Day! the Circling Billboard

937

1

Introduction: Happy Pi Day! the Circling Billboard

The purpose of this Instructable is three-fold:

1) demonstrate the use of pi for calculating circumferences and circular movement,

2) celebrate Pi Day (3/14), and

3) continue the instructional sequence on using the 2020 Lego Mindstorm Robot Inventor Kit.

This Instructionable focuses on programming the Robot Inventor’s matrix and calculating values. It also elaborates on the movement commands which were first introduced in the “Lego Robot Inventor Kit - Blast: On His Own” Instructable along with motors and distance sensor.

Supplies

2020 Lego Mindstorm Robot Inventor Kit (51515)

Selected parts including 2 motors, 4 large wheels, and 1 hub.

Mindstorms software.

Step 1: Build the Moving Billboard

Put the Moving Billboard together using parts from the Lego Set 51515.

1) Set up two motors as shown in image 1.

2) Set up the hub as shown in image 2

3) Attach the motors to the hub as shown in image 3.

4) Attach the wheels to the motors as shown in image 4.

Images 5 - 7 show the completed Moving Billboard from various angles.

Step 2: Wire the Motors to the Hub

Facing forward from the back (see image 1).

1) Attach the left motor* to the D port (see images 1 and 2).

2) Attach the right motor* to the F port (see images 1 and 2).

*The rear of the billboard is at the bottom of the screen in image 1.

Step 3: Set Up the Mindstorm Program

1) Open Mindstorms App (see image 1).

2) Click on Projects (bottom of image 1).

3) Scroll down to Other (see image 2).

4) Click on Create new Project (see image 2).

5) Select Word Blocks and click Create (see image 3).

6) Click on the three vertical dots and select Rename Project - type Pi_Hello (see image 4).

7) The new project automatically gets the code line “When Program Starts” (see image 5).

Step 4: Outline the Programming Logic

The code (see image 1) instructs the Moving Billboard to:

  • 1. Move in a circle based on the radius provided.
  • 2. Display the following message: Pi [symbol] 3.14 Happy Pi Day!

Step 5: Create Variables

1) Scroll down to Variables (see image 1).

2) Click on Create Variable (see image 2).

3) Name it pi and click OK (see image 3).

4) Repeat step 4 for the following variables (see image 4 after completion):

circle_radius

wheel_diameter

wheel_difference

wheel_circumference

inside_circum

outside_circum

ratio

Step 6: Initialize Variables (Constants)

The variables set in this section are actually constants that are used throughout the program. Word Blocks does not have a constant command therefore variables is used.

1) Measure the diameter of the wheels (2.25”).

2) Measure the distance between the outsides of the tires on the rear (4.25”).

3) Drag “Set pi to” from Variables Category (see image 1) to under “When program starts” (see image 2)

4) Set the pi variable to 3.14.

5) Repeat for circle_radius, wheel_diameter, and wheel_difference. (see image 3).

6) Set the circle_radius to the radius of the circle that the moving billboard travels (6 for 6 inches).

7) Set wheel_diameter to the wheel diameter measurement (2.25).

8) Set wheel_difference to the difference between the rear tires (4.25).

Step 7: Initialize Variables Using Other Variables

1) Drag “Set wheel_circumference to” under “Set wheel_difference to” (see image 1).

2) Repeat for inside_circum, outside_circum, and ratio (see image 2).

3) Drag multiplication command from under Operators (see image 3) over the white oval (see image 4) in the “set wheel circumference” command.

4) Drag wheel_diameter from under Variables (see image 5) to the first oval (see image 6).

5) Drag pi from under Variables (see image 5) to the second oval (see image 6).

6) Drag subtraction command (see image 7) to an open area in the coding section.

7) Drag circle_radius variable to first oval and wheel_difference to second oval (see image 8)

8) Drag multiplication command (see image 9) to an open area in the coding section.

9) Type the number 2 in the first oval and drag the subtraction command into the second oval (see image 10).

10) Drag another multiplication command to an open area near the first multiplication command. Drag pi variable into the second oval (see image 11)

11) Drag the first multiplication command into the first oval of the second multiplication command and drag the entire command into the oval next to set inside_circum (see image 12).

12) Repeat for outside_circum (see image 13).

13) Create the ratio calculation using a division and a multiplication command (see image 14).

Step 8: Set Up Motors (Movement Category)

This step prepares the motors for programming.

1) Drag "Set movement motors to" (see image 1) from the Movement Category. The Movement Category allows for the programming of two motors simultaneously. Click on the drop down menu (see image 2) and select D and F (see image 3) on the hub. The D should be on the left side and the F on the right side.

2) Drag "Set movement speed to" (see image 1) from the Movement Category to under "Set movement motors to". The speed can be set between 1% and 100% of maximum speed. Type 25 (25%) in the white circle for a slow speed (see image 4). This is the default speed which can be altered during the program using any of a variety of commands under Movement and More Movement.

3) Drag “Set 1 motor rotation to” (see image 1) from the Movement Category to under “Set Movement speed”. Change cm to inches and drag wheel_circumference from Variables to the white oval (see image 5).

Step 9: Set Up Motors (More Movement Category)

Note: The More Movement category is added to the functionality of Mindstorms by clicking on the + symbol (see image 1 - bottom), clicking on Add button under more movements (see image 2), and closing the window by clicking on the x in the upper right hand corner. Now there is an additional category (More Movement) at the bottom of the commands list (see image 3).

1) Drag “Set movement motors to brake at stop” from More Movement Category (see image 3) to under “Set 1 motor rotation to” (see image 4).

2) There are three options in the drop down box:

brake - hard stop

float - allows motors to continue to move due to momentum

hold - hard stop and motor is used to counter any further movement

3) Stay with the brake selection.

Step 10: Display Animation Code

1) Drag “Set orientation to” from Light Category (see image 1) to under “Set movement motors to brake” (see image 2). Select left from the drop down menu (see image 2). Note: “Rotate Orientation” is similar and can be used. However, it is typically reserved for making changes during the running of the program.

2) Click on the Play button next to “Start animation” in the Light Category (see image 1). Click on Animation Editor (see image 3). The Animation Library contains pre-made animations, but we are going to make our own.

3) In the Animation Editor (see image 4). Click on any of the 25 pixels to turn them on and off to create the pi symbol.

4) Click on the + (see image 5) and create another pi symbol (so that it stays on the screen twice as long as the other characters.

5) Continue clicking the + to create an = sign followed by 3.14 (see image 6).

6) Set the FPS (frames per second) to 1 at the bottom of the Animation Editor and leave the loop off (see image 7).

7) Click Save when prompted (see image 8).

8) Drag “Start animation” from Light Category (see image 1) to under “Set orientation” (see image 9).

9) See images 10-14 for the actual display.

Note: “Start animation” starts the animation and then proceeds to the next step. “Play animation until done” is similar except it pauses until the animation is complete.

Step 11: Movement Code

1) Drag “Move for …” from the More Movement Category (see image 1) to the bottom of the code (see image 2).

2) Drag outside_circum from Variables (see image 3) into the first white oval of the “Move for …” command (see image 4).

3) Change drop down box to in (see image 4).

4) Type 100 into second white oval (see image 4).

5) Drag ratio variable into third white oval (see image 4).

Step 12: Display Text Code

1) Drag “Write” command from Light Category (see image 1) to the end of the code (see image 2).

2) Click in the white oval and type “Happy Pi Day!” (see image 3).

Step 13: Finish the Code

1) Drag “Stop all” from the Control Category (see image 1) to the end of the code (see image 2).

2) Click on the drop down menu and select “and exit program” (see image 3).

3) Image 4 contains the full code.

Step 14: Test

1) Turn on hub.

2) Click hub icon in upper right hand corner (see image 1) and follow the on-screen directions to complete the connection sequence.

3) Place the moving billboard on the floor.

4) Click on start icon (see image 2) in the lower right hand corner.

The first video shows the movement of the moving billboard.

The second video shows the entire display. I made it stationary so that it would be easy to see the entire message.

Pi Day Speed Challenge

Participated in the
Pi Day Speed Challenge

Be the First to Share

    Recommendations

    • Make it Real Student Design Challenge #3

      Make it Real Student Design Challenge #3
    • Box Challenge

      Box Challenge
    • Explore Science Challenge

      Explore Science Challenge

    Comments