Introduction
Today, we will focus on an interesting effect caused by the Moon: tidal waves.
You may know that massive bodies have an attractive force - gravity. The Moon's gravity pulls the water in the oceans, which causes the sea level along the ocean coasts to temporarily rise or fall. The increased level is called high tide, and the decreased level is called low tide.
How much, do you think, can the difference between high and low tide be in the world?
The distance between high tide and low tide sea levels can reach up to 16 meters in the Bay of Fundy in Canada, and the lowest differences are in the Mediterranean, Baltic, and Black Seas, where they are only a few centimeters. We will use 50 cm as an average value as it is convenient for the task.
Introduction to the LEGO set
Regarding the parts of our robots
This is what one of our easiest robots looks like:
EasyBot
Before we begin construction, we will take a look at some of the parts of the robot.
Motors
Motors
These are the "legs" or "muscles" of the robot.
Microcontroller (Brick)
LEGO SPIKE Brick
LEGO calls that part "the intelligent brick". You can think of it as the "brain" of the robot. However, it is a microcontroller or a small computer where you can upload the programs you have created from a regular computer. Then, based on the programs, the brick can read data from the sensors and operate the motors.
LEGO Technic parts
Some of the main LEGO Technic parts in the LEGO Mindstorms SPIKE set
There are several parts in the image above. Can you match the names to the parts?
- Tire
- Rim
- Double Black Pin
- Triple Long pin
- Bush
- Gear
- Beam
- Axle
- Axle pin
Names of some of the important and common pieces in LEGO Mindstorms set
We will cover the names and the basic usage of the parts in our typical robot.
Let's make sure we all use the same names for the same parts
Names for Pins
- black pin, double pin
- blue pin, long pin, triple pin
- blue axle pin (axle and pin transition)
- torch pin (pin with cross hole)
Names for Beams
- "5 holer" or "15 beam"
- big and small L-beams
- double angular beam
Parts for movement
- Rims (thin rim, wide rim)
- Pulleys
- Tires and Rims form Wheels
Parts for spatial rotation
- Beam with pins
- Angular beam with Pins
Learn the names of LEGO parts in a fun way
Let’s play a game:
The teacher will tell you the name of a LEGO part, and you will have to take it from the set and show it to the teacher. When all students have shown the correct part, you can move to the next one.
Let’s start. Show me:
- short pin
- triple pin
- pin with cross hole
- axle (x6 LEGO units)
- axle (x5 LEGO units)
- axle pin
- gearwheel
- bush
- half bush
- beam 7
- large L beam
- small L beam
- angular beam (there are three types of angular beams)
- T-shaped beam
- beam frame
- tire
- rim
- wheel (the tire and the rim together make the wheel)
- "Н"-beam with pins;
- angular beam with pins
Construction and Theory
The robot today moves similarly to the one from the first lesson but looks very different. The goal of today's robot is to mimic the motion of waves. What is it?
Allunaggio - LEGO SPIKE Prime moon landing robot
Allunagio in Italian means to arrive or touch the Moon.
This simple robot is designed to be constructed in a short lesson. It has two motors for movement and a controller hub.
After building the robot, close the box to keep the desk clear.
- Gather all the parts from the desk and put them back in the box.
- Close the box and move it aside so it's out of your way.
Programming and Theory
Today, we will program a robot to show how high the water has risen by simulating three rising waves. We will learn how to give a series of commands to the robot to execute.
The task for today's lesson
Today, you will program the robot to simulate the sea waves. The robot will move back and forth, gradually reducing the distance it travels as if sensing an incoming tide. The following four tasks build on and will help you create a program for this purpose. Make sure you complete each task before moving on to the next one.
Executing more than one command with LEGO SPIKE Prime Word Blocks
Most programs we write require several commands for the robot to execute to complete its task. Here's how to do it with SPIKE Prime Word Blocks software!
To make a program of multiple blocks, we first need to place one block with a command, for example, move 50 cm forward. Then, in the same way, we take another block and place it directly under the previous one.
When we add blocks this way, they are executed one after the other from top to bottom. That means the program in the picture would move the robot forward 50 cm and then back 50 cm. We can then place as many blocks as we need for the robot to complete the task correctly.
Best practices for creating long programs by trial and error
Now that you have tried and solved a challenge involving a series of instructions, we would like to share a few best practices.
Try blocks one by one
It is a bad practice to place several blocks before testing your program. The problem is that when there is an error, you can't pinpoint which block causes the problem.
Understand the challenge
To solve a task correctly, you must understand what is expected from you. So, you should articulate how you understood the challenge and ask your teacher if that understanding is correct.
You can also ask us in the comments section below.
Test each step of the program with the robot
This is the most important message we have here! Follow this algorithm:
- Place one or two blocks in your program and adjust them;
- Download the program from the computer to the robot;
- Place the robot on the floor and place it at the marked starting position;
- Select the program from the brick menu and start it;
- Observe the results and assess if the robot behaves as desired:
- If the robot's behavior is "correct" as desired, carry on.
- Add new blocks to the program to extend it.
- If there is an error, it is in the new blocks you just added.
- Correct the error and test it again.
- Correct the error and test it again.
- If the robot's behavior is "correct" as desired, carry on.
Use the download option of the software
Thus, you can control where and when you start the robot. If necessary, you can start the program from the brick several times.
Deleting, Returning and Moving Blocks in LEGO SPIKE Prime Word Blocks software
Have you had a block you want to delete? Or one you want to restore after deletion? Now you will find out how!
To delete a block, we have two options:
- With the Del button.
- By moving the block in the palette to the side.
To delete a block with the Del or Delete button, we need to click on it and press the button on the keyboard. This button will always work on the last block you clicked on.
To delete a block with a move, we need to grab it and move it back to the side in the palette, no matter where. Be careful! When we drag a block followed by other blocks, we also drag all the blocks below it and risk deleting a large part of our program.
Another way to delete a block in the middle of several blocks is to move it along with the blocks below it, then grab the blocks below it and return them to the original program. Now, we have isolated the block we want to delete, and we can move it to the side in the palette. We can also use this trick if we want to just move a block instead of deleting it, and it looks like this:
Sometimes, we delete a large part of our program without wanting to or move it and don't remember how it was originally. The tool that fixes such situations is Ctrl+Z, also called "Undo". If you need to undo something, click the Ctrl button and then Z. That undoes an action we did. Pressing it again returns a second action, and we can go on like this probably longer than we ever need to.
Stopping an incorrect program with SPIKE Prime hub
Sometimes, we make a mistake in starting the robot, and we should stop it before its program runs out. Here's how to do it with a SPIKE Prime controller.
Common errors that may lead to the need to stop the robot are:
- Launching the robot in the wrong direction. Robots can move in any direction, so figure out which direction yours needs to move in and release it so it can do so without a problem. Usually, this direction is away from you.
- Wrong program launched or problem launching the program. Sometimes, we run the wrong program or a program with an error, and then the robot goes somewhere, and we don't know what's going on. Someone might also push it, and that's where the error comes from.
In all these cases, you should always pick up the robot before it breaks down or gets in the way of others. Then, to stop the program, we press the Middle button on the controller.
How to set motor ports in LEGO SPIKE Prime Word Blocks software
By default, the motors of the LEGO SPIKE Prime controller connect to ports A and B. What if we want to connect them to other ports? Here's how to change ports in the software.
The block we use to change the ports of the movement motors in the software is in the second-to-last place in the Movement palette. It is called set movement motors to.
The block has one parameter which sets the ports of the two drive motors.
Once we have set the correct ports, our robot will use the new ports as drive motors. Thus, all blocks from the Movement palette will move these two motors.
That block can also be used to reverse the ports, which can be useful if you program the robot to move forward but it still moves backward.
Bonus Tasks
These tasks are optional and can only be solved by students who have completed all the main tasks and received confirmation from their teacher.
Now that you've learned about tidal waves, it's time to learn about two more types of waves: a Tsunami, which is a one-time huge wave in the ocean, and the Mexican Wave, which is synchronization between many people in a stadium or sporting event.
To make a tsunami with the robots, we will place them next to each other and release them simultaneously to make it look like one huge wave.
Creating a Mexican wave is a bit more complicated task. We have to arrange the robots one behind the other. Then, we will release them one after the other so that when the first one reaches the second one, the second one can go.
Complete the Tsunami Wave as described in the "Bonus Tasks" section above this task.
Start all robots from the class at the same time;
Make sure there is enough distance between the robots. If a robot goes astray, there will be a chance of crashing into the nearby robots.
Photograph the robots and their version of a Tsunami Wave.
Complete the Mexican Wave as described in the "Bonus Tasks" section above this task.
Start all robots from the class at the same time;
Make sure there is enough distance between the robots. If a robot goes astray, there will be a chance of crashing into the nearby robots.
Photograph the robots and their version of a Mexican Wave.
Tasks to finish a class
- Take pictures and make videos of your robots.
- Disassemble and arrange the robot .
- Arrange your workplace :
- It is important to arrange the electronics of the robots on the cover of the box.
- Wind up the programming cable so that it is assembled.
- Wind up the mouse cable around the mouse.
- Wind up the cable of the laptop charger in a way that your teacher will show you.
- When you turn off the computer, leave it next to the robot box.
- Turn off all programs on your computer.
- Exit FLLCasts.
- Shut down your computer.
- Put your chair under the desk.