In this course, we will construct different military vehicles and constructions. In today's' lesson we will build an Ammo Truck. We will attach to it a new sensor - color sensor. We will learn more about it, how it works and how to program it. Later, we will use it to give different commands to the truck.
In this course you will be working with other students in the group. These might be your classmates, teammates or students you know from other activities. It is important to know your group so that you could work together with them in the best possible way.
Know your teacher
Your teacher will tell you something about himself/herself and then you will acquaint with the students in the group.
Remember the name of the teacher and address him/her by name!
Listen to others
Make sure you listen to the rest of the group and pay attention to details about them, the same way you wish they would listen to you.
Details that you all should share are:
- your name;
- your age;
- your grade;
- which school you are attending;
- your favorite sport, extracurricular activity, hobby.
Share a story
Also, if the teacher considers it appropriate, you could share a short story or an achievement along the lines of "I've done something you haven't done, which is".
Build the robot using the instructions below. Pay attention to the way the truck is driven and how it steers. What are the differences with the robots we have built so far?
Once you have finished with the construction of the robot, please attach a color sensor to it.
Most probably you have not built a robot before. So not only you will build a robot for the first time, you will also have to work with another student. In order to make those first steps as smooth and pleasant as possible, we will point out some key things in the process of constructing a robot in pairs.
How to construct a robot in pairs
The robot should be constructed on the transparent lid of the box. The lid should be placed on your working desk, in front of the computer. That way the robot will be in a place convinient for both of you. Moreover, the lid will stop parts from falling on the floor or spreading over the whole desk.
In order to be fair, you should take turns every few steps. One of you should construct and the other should pass him the necessary parts. It is best if you change your roles every 10 to 20 steps. Changing the roles every 5 steps will be too often while changing them in the middle of the instructions will be too far in time and the one passing the parts will get bored.
Tell your teacher which one of you will initially be Building and which one of you will be Passing parts.
Try not to compete with the other pairs in the room while constructing. Being fast is not important, only how precisely you follow the instructions so that you have successfully build your robot.
Building instructions for a LEGO Truck. The robot is presented as an Ammo Truck but it can be used for transporting various other objects, too. The construction has a rear drive with each of the rear wheels driven by a Large Lego Motor. The front wheels steer using a Medium Lego Motor. The Brick is placed at the front of the construction which gives the opportunity to easily attach different sensors, based on the task.
- Collect all parts from the desk and put them back in their places in the box.
- Close the box and move it to the side so it's not in your way.
Before we dive into the color sensor theory and programming, let us start with a few simple robot movement exercises. After we are sure we can easily program the robot to move around, we will continue.
What is color?
If I ask you what the color of the ball on the picture below is, you will surely answer red without hesitation. All of you know what is meant when we talk about the color of an object, but what is actually color? This is one of the most natural concepts whose meaning and origin people often fail to realize.
Two things are responsible for the colors as we know them - light and our eyes.
For instance the sunlight, which we call white, actually combines all colors. This can be observed using glass triangular prism, as shown below:
Simplified, the difference between the different colors is the amount of energy, the corresponding light ray has. On the table below are shown the different types of light.
The so-called gamma rays "have" the greatest amount of energy, while the radio waves - the least. In the middle, where there are multiple color stripes, we have the light we can see and hence it is called visible light. From the visible light spectrum, the violet light has the greatest amount of energy and the red has the lowest.
We see different objects in different color, depending on what light they absorb and what they reflect. For example, the objects we call black actually absorb all of the light and therefore they absorb a lot of energy. On the other hand, white objects reflect all of the light and absorb far less energy. That is why in the summer we feel hotter wearing black clothes, than wearing white ones.
How do we see colors?
So far we have learned what different colors are. But how do we differentiate them? There are three types of cone cells in our eyes. Each type is sensitive to either red, green or blue light. Each cell sends signals to the brain about the intensity of the light it has detected. Having the information about the amount of red, green and blue in each light ray, our brain is able to "see" different colors.
And how do robots see colors?
Instead of eyes, robots have sensors. Just like people, robots use three types of sensors. Each type detects the intensity of red, green and blue light. Combining the information from the three sensors, the robot can conclude what color it "sees".
LEGO EV3 Color Sensor
The LEGO Color sensor consists of two main parts - a diode which emits light and color sensors which measure the intensity of the reflected light.
As with the two sensors we have covered so far, the color sensor can be used as a condition for the wait block, the switch block or the loop block. The color sensor, as well as the ultrasonic sensor, has several modes, but today we will be looking at the color mode.
If you put a wait block on the canvas, then from the drop-down menu select color sensor and then "Compare", you will see the three available modes:
Color - If you choose that mode, the sensor will evaluate the color of an object. We use that mode for solving the Rubik's cube, for sorting balls, for programming color code etc. The diode of the sensor emits red, green and blue light. Depending on the intensity of the reflected light in each of the three light spectrums, the robot can differentiate 8 colors. Each color is encoded as a number:
0= No color;
As with every other sensor, we start with the port number the sensor is connected to. This is shown by the number in the upper right corner of the block. Afterwards, from the first (and only) field we choose upon which color to wait. Note that you can choose more than one color, hence wait for more than one color. So, for instance, if we want to go forward until we detect a red or black line, we just need to select 1 and 5.
Now it's time to put all we have learned about the new sensor into practice. We will control the truck using a color code. This means that we will "show" it different colors and, depending on the color, it will execute a different command. For that purpose you will need to construct the same or similar model:
You can use the brick to check the color the color sensor detects in the following way:
Similarly, you can check the value in reflected light mode:
- 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.
- Put the robot cables next to the electronics.
- 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.