{"id":9342,"date":"2014-11-18T17:39:30","date_gmt":"2014-11-18T06:39:30","guid":{"rendered":"http:\/\/legoeng.local\/?p=9342"},"modified":"2019-06-27T12:29:13","modified_gmt":"2019-06-27T02:29:13","slug":"exploring-thresholds","status":"publish","type":"post","link":"http:\/\/legoeng.local\/exploring-thresholds\/","title":{"rendered":"Exploring Thresholds"},"content":{"rendered":"
<\/a>This unit introduces an extremely simple exercise that allows students to think more deeply about the concept of a threshold and how to use it to make a robot react to its environment.<\/p>\n It is based on my Teachers Introduction Course to LEGO\u00ae MINDSTORMS NXT & EV3<\/a> at BOGATECH<\/a>\u2019s website. Here the programming examples are based on the LEGO MINDSTORMS EV3 Software, but at BOGATECH’s website you can find the NXT version and the differences between the two platforms, if you are interested.<\/p>\n The following exercises can even be done by students without any programming experience, with the goal of introducing the concept of a threshold and programming with logical structures. It is very interesting to observe that in this practical exercise, the challenge is not to program the Wait and Switch blocks, it is to determine the thresholds to be used in each block to make the robot detect the lines and their color correctly. Students could, for example, be given the program already written. Students typically understand these blocks very intuitively and with little explanation.<\/p>\n At the end the unit, an experiment is proposed to generate a graph based on the color sensor\u2019s measurements. This graph perfectly illustrates the sensor behavior. This approach can be extrapolated to other sensors.<\/p>\n To better understand how a sensor works and how the EV3 makes decisions based on sensor values, we need to explain the concept of a threshold.<\/p>\n A very simple example is to use the classroom doorway to illustrate that depending on where we stand, we will either be inside or outside the classroom. But if we stand just in the middle of the doorway, where will we be? We will be at the door\u2019s threshold<\/em> which separates the inside from the outside.<\/p>\n For another example, let\u2019s imagine that we want to classify the students by separating the short from the tall ones. One way to do it is to take the tallest student and the shortest one, draw two lines on the blackboard at their heights and ask the class where to draw the line that will separate the short from the tall students? In other words, how can we calculate the threshold that will state the difference between a short and a tall person? Perhaps the easiest approach would be to find the mean of the two extremes, that is to simply add the two measurements and divide the result by 2, that is, (A+B) \/ 2.<\/p>\n We can also calculate the arithmetic mean of the whole class, by adding all the students\u2019 heights and dividing the result by the number of students. That will typically give us a different result, but why? When should we apply this concept? We could also add different weights to the different measurements, but how and when should we do this?<\/p>\n To calculate the threshold required to differentiate between a pair of sensor measurements is very similar, but first we need to find out the values of the sensors we want to differentiate. As outlined below, we can use the View menu on the EV3 brick to read the value of the Color sensor when we place it on top of different colors. Similarly, we could read the volume level on a Sound sensor or the distance to an object in front of the Ultrasonic sensor.<\/p>\n As shown in this image, the exercise consists of finding the right thresholds to make the robot…<\/p>\n We need to tape a black line onto a white background. We also need another color line (e.g. green or blue) that will give a\u00a0reflected light intensity higher than black and lower than white. In the following exercises we will use several thresholds, but always between pairs of measurements corresponding to two different colors.<\/p>\n The first three exercises deal with varying the light intensity threshold of the Wait block to stop the robot at the desired lines.<\/p>\n Create a new program and add…<\/p>\nA little bit of theory<\/h2>\n
Exercise overview<\/h2>\n
\n
Preparation<\/h2>\n
\n\n
\n Black<\/strong><\/td>\n Threshold Black-Green<\/td>\n Green<\/strong><\/td>\n Threshold Green-White<\/td>\n White<\/strong><\/td>\n<\/tr>\n \n 6%<\/td>\n 7%<\/strong><\/td>\n 9%<\/td>\n 42%<\/strong><\/td>\n 75%<\/td>\n<\/tr>\n \n <\/td>\n \u00a0<\/strong><\/td>\n Threshold Black-White<\/td>\n \u00a0<\/strong><\/td>\n <\/td>\n<\/tr>\n \n <\/td>\n <\/td>\n 40%<\/strong><\/td>\n <\/td>\n <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n Exercise 1: Stop at black<\/h2>\n
\n