How to use the LEGO Mindstorms NXT Light sensor with EV3-G Software Pro Preview

After several questions about the use of the LEGO Mindstorms NXT Light Sensor with the EV3 software, we have decided to go through this problem in this video tutorial and pay special attention to the Raw Sensor Value Block.

  • #48
  • 27 Nov 2013
  • 6:57

We expand on robotics lesson 45 and show a way to use the Mindstorms NXT Light Sensor with the Mindstorms NXT brick and the EV3-G software. Then we see that the EV3 Color sensor does not work with the NXT brick.

Next we focus on the use of the three sensors with the EV3 brick and we create a program that simultaneously displays the values from the Color Sensor block and the Raw Sensor Value block of the NXT Light and Color sensors and the EV3 Color sensor.

The project created in this tutorial

- Download the project created in this episode, including the program compating the 3 sensors - the NXT Light Sensor, the NXT Color Sensor and the EV3 Color Sensor and the a program, that displays the raw sensor value.

English

Recently, we have received several questions on how we could use the EV3 brick with the NXT light sensor and the NXT color sensor. In today's tutorial I'll show you how you could do this and also expand on the topic of how to use the NXT brick with the EV3 software and the two sensors. Finally, I'll show you the differences between using the NXT light or color sensor and the EV3 color sensor.

As you can see, I have already connected the NXT brick to the computer. If we go to Port View, we won't see any information about the sensors but this is normal for the NXT series. Still, I have connected the NXT light sensor to Port 1. As we saw in Episode 45, if I take an EV3 color sensor block and use it with the NXT light sensor, I won't see anything - the value will be 1 and it won't change no matter what I do with the sensor. Still, there is a way to use the NXT light sensor with the EV3 software. To do so, you should go to the advance tab and take the raw sensor value block. We set it to Port 1 and I will connect the result to a display block which will show text. The text would be wired; connect to blocks. OK. Now I'll use a loop and put the two blocks in a loop, so that could constantly see the change in the sensor. Now, let's download the program and see the result. As you can see, the value on the display is constantly changing while I'm moving the NXT light sensor. Still, the red lamp of the sensor is not turned on. This means that the sensor currently detects only ambient light. Let's go back to the program to see how we can make it detect reflected light. To make our sensor detect reflected light, we should add a parallel thread with the color sensor block in order to turn on the lamp. So, I select reflected light and I will adjust the threshold to 100 so that it could never be reached and the lamp would be turned on. Then, I set the port to First and we are ready to see how our program works. So, this is the way to use the NXT light sensor within the EV3 software. Now, let's see how we could use the NXT light and color sensor with the EV3 brick. So, basically, if you want to use the NXT light sensor with the NXT brick and the EV3 software, you should use the raw sensor value block. If you want to use the NXT color sensor in the same situation, things are much easier because you just have to use the color sensor block. Finally, if you want to use the EV3 color sensor with the NXT brick, I should admit I don't now a way to do this with the regular software - no matter whether this is the EV3 or NXT software. So, I'll be glad if you share a solution. Now, let's see a few examples of using this program with different sensors. So, we run our program and, as you can see, the results are similar to the ones we already had. Now I will replace the NXT light sensor with the EV3 color sensor and, as you can see, it detects no value, it is zero and it does not change. Still, this program presents a way to use different sensors. For instance, the HiTechnic gyro sensor. When we attach it to the brick, it detects its value and the different changes, etc. I have connected the EV3 brick to the computer and it detects three color sensors. Actually, I have connected the NXT light sensor to Port 1, the NXT color sensor to Port 2, and the EV3 color sensor to port 3.

If you want to use the NXT light sensor with the EV3 brick, you should use the color sensor block. If you put the color sensor block, set it to reflected light, set it to Port 1, delete the raw sensor value block and connect the two blocks, you will have a working program. Still, you may receive some strange results when using the NXT light sensor with the EV3 brick. As you can see, the light sensor detects the difference between white space and black line, so it can be used to follow a line or align to a black line with the EV3 brick. Here I have built the program that displays the values of the three sensors - the NXT light sensor, the NXT color sensor and the EV3 color sensor - on the EV3 display. So, we have three parallel threads. First, we clear the screen, then we write on the screen which the sensor is, then the value of the color sensor block from the sensor and the raw sensor value. You can download this program from the materials tab below this video as well as some results we have achieved with this program. Now, let's see how it works. I have aligned the three sensors, so that there's no difference between them and their values are shown on the screen. You can download this program from the materials tab below this video as well as a sheet with the results achieved with this program in different situations.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for FIRST LEGO League Competition. Constructing and Programming a Robot Base
  • 42
  • 249:53
  • 10
Image for Simple following and aligning to lines and borders
  • 11
  • 5
  • 1
  • 3d_rotation 0