1. Lesson 1 - Color Sensor


In this course, we will construct different military vehicles and constructions.

Have you seen, probably in movies, how people use small light sticks to help airplanes land. These sticks are use to help drivers of heavy vehicles navigate in traffic without accidents. 

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.


picture of a military base for FLLCasts robotics course for military technologies

Getting to know the teacher and the rest of the students

In this course, you will work 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 can work together with them in the best possible way.

Know your teacher

Your teacher will tell you something about themselves, and then you will acquaint yourself with the students in the group.
Remember the name of the teacher and address them 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.

How to build a robot when working in pairs

Most probably, you have not built a robot before. So not only will you build a robot for the first time, but you will also have to work with another student. 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 convenient for both of you. Moreover, the lid will stop parts from falling on the floor or spreading over the whole desk.

content picture

To be fair, you should take turns every few steps. One of you should construct, and the other should pass the necessary parts. It is best if you change your roles every 10 to 20 steps. Changing the roles every five 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 built your robot.

How to build a robot when working in pairs: High efficiency method

As you have experience building robots it is time to learn how to build robot super-fast. This is not done by hurring up and skipping important steps. 

The trick is to simulate an assembly line. A constantly loaded one.

How are robot is normally assembled

  • the Builder looks at the step in the assembly instructions;
  • the Partner looks for the next part and is passing it. The Builder is waiting;
  • the Builder assembles the part on this step. The Partner is waiting;
  • the Builder moves to the next step;
  • the Partner looks for the next part and is passing it. The Builder is waiting;
  • the Builder assembles the part on this step. The Partner is waiting;
  • and so on...

How to build and assemble the robot fast

As you can see from the description there are a lot of moments, in which both the builder and the partner are waiting. How can we reduce this time?

  • while the Builder is assembling, the partner could look and check what the next required part is and find it;
  • after that just in case the partner returns to the current step;
  • the Builder moves to the next step and the part that are required are already prepared. He is not waiting for the Partner and he starts assembling; 
  • the Partner is again looking for the next require part for the next step. Finds it and prepares it for the Builder;
  • the Builder moves to the next step.

In this way, by simulating and assembly line you can build the robot before all the other students with at least 15 steps heads up. 

We usually do not compete when assembling and we should not. We are giving this example for you to understand how much faster this approach is. 


Clank - LEGO EV3 Ammo Truck

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. 

Now, after the robot is built, close the box so that it's out of your way and the desk is clear.

  1. Collect all parts from the desk and put them back in their places in the box.
  2. 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.

How does the color sensor work?

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.

How to program the EV3 color sensor

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;
    1 = Black;
    2 = Blue;
    3 = Green;
    4 = Yellow;
    5 = Red;
    6 = White;
    7 = Brown;


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 and by default the port is 3. 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.

Programming color code

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:

Model to be used for color code

Building instructions for constructing a simple LEGO Model that has red, green, blue and yellow beams. This makes it perfect for operating robots through color code.

How to check what value the LEGO EV3 color sensor reads?

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:

Tasks to finish a class

  1. Take pictures and make videos of your robots
  2. Disassemble and arrange the robot
  3. 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.
  4. Turn off all programs on your computer
  5. Exit FLLCasts  
  6. Shut down your computer
  7. Put your chair under the desk.