"What is the light in the room?" - should it even matter. You can use one program for all lighting conditions by calibrating the color/light sensor of the LEGO Mindstorms EV3/NXT robots.
- 03 May 2015
The problem is simple - you build a robot for a specific task. For solving a specific problem and this robot uses a light/color sensors. It probably works every time until you change the lights in the rooms or you switch to a different room.
This is where calibration comes to play. You tell the sensor basically how "much light" there is in the room and what should be considered black/white as colors. This could greatly vary. Another example where you should use calibration is when following lines with EV3 Mindstorms robots.
All episodes from the series:
- In the previous episode we implemented a catapult that can load and fire automatically using the color sensor but we stopped on calibrating. In this episode we're going to implement the calibration of the sensor so that when the light turns off the catapult will continue working.
Initially we start with the program from the previous episode. Check out the link below and you can remind yourself. We would like to calibrate the sensor and the parts of calibrating process holes. We wait for a push of a button. We compare that we have pressed, for example the second button is pressed and released. When the second button is pressed, released this means the last button in the middle, we take the value of the color sensor and to set this value as the maximum value.
The purpose of a calibration process is to keep the minimum and the maximum value detected by the color sensor applied for your lighting conditions in their own currently. The next step is to calibrate the minimum value. Again we wait for red button to be pressed, second button bumped. We set the minimum value. Again, we wait for a button. We set the maximum value. We wait for a button, we set the minimum value. We will wait again, and after the button is pressed for the third time, the program continues as it shoots. Loading can find... Let me just check, bump. This is the whole program. I'll move this here to make it more readable, and let's run the program. The program is running and we are at our maximum value that the sensor detects the back of the brick which we consider the maximum. We press the button once. Then as the second step, we must load the catapult manually.
The sensor detects black or this should be considered its minimum value. Let's press the button again.
Now we release the catapult and we start the program.
Let's do the same experiment, this time turning the lights in the room off. The lights in the room are turned off, and again we detect our maximum value. Press the button, then reload the catapult. Now we detect our minimum value. Press the button, then we release the catapult and restart the program.
As you can see, even without lights in the room because we have calibrated the sensor, the program still works.
Курсове и занятия включващи този Урок
Този Урок е използван в следните курсове и занятия.