Skip to main content
Teacher Portal

Teacher Toolbox icon Teacher Toolbox - The Purpose of this Activity

Using the Vision Sensor effectively requires the students to be able to configure it and tune it depending on the environment that it is in. In the following activity, the students will learn how to do both.
For more information about programming the Vision Sensor with sensing blocks, visit the help information within VEXcode IQ.

The following is an outline of what your students will do in this activity:

  1. Open the Detecting Objects example project.

  2. Watch the Configuring the Vision Sensor tutorial video.

  3. Configure the Vision Sensor.

  4. Run the Detecting Objects example project.

  5. Discuss and Reflect.

  6. Watch the Tuning the Vision Sensor tutorial video.

  7. Tune the Vision Sensor.

For help organizing students for this activity click here.

Teacher Tips icon Teacher Tips

If this is the student's first time using VEXcode IQ, they can also see the Tutorials in the toolbar to learn other basic skills.

VEXcode IQ Toolbar with the Tutorials icon called out in a red box, to the right of the File menu.

The Builder in each group should get the hardware required. The Recorder should get the group’s engineering notebook. The Programmer should open VEXcode IQ.

Materials Required:
Quantity Materials Needed
1

VEX IQ Super Kit

1

VEXcode IQ

1

Engineering Notebook

1

Configuring the Vision Sensor (Tutorial)

1

Tuning the Vision Sensor (Tutorial)

1

Detecting Objects example project

This activity will give you the tools to use the Vision Sensor.

You can use the Help information inside of VEXcode IQ learn about the blocks. For guidance in using the Help feature, see the Using Help tutorial.

VEXcode IQ Toolbar with the Tutorials icon called out in a red box, to the right of the File menu.

Teacher Tips icon Teacher Tips

Model each of the troubleshooting steps for the students. Remind the students they each group has someone in the role of the builder. That person should be checking these items throughout the activity.

Step 1:  Preparing for the activity

Before you begin the activity, do you have each of these items ready? The Builder should check each of the following:

  • Are all the motors and sensors plugged into the correct port?

  • Are the smart cables fully inserted into all of the motors and sensors?

  • Is the Brain turned on?

  • Is the battery charged?

Teacher Tips icon Teacher Tips

  • Make sure that the students have selected the Open Examples from the File menu.

  • Make sure that the students have selected the Detecting Objects Example project. You can point out to students that there are several selections to choose from on the Open Examples page. Remind students that they can refer to the Using Examples and Templates tutorial at any time.

  • You can ask students to add their initials or the name of their group to the project name. This will help differentiate the programs if you ask the students to submit them.

  • Since VEXcode IQ has autosave, there is no need to save the project again after it has been saved for the first time.

  • If students need help saving, direct them to the Naming and Saving Your Project tutorial video.

Step 2:  Open an Example Project.

  • VEXcode IQ  contains many different example projects. You’ll use one of them in this exploration. For help and tips on using example projects, check out the Using Examples and Templates tutorial.

    VEXcode IQ Toolbar with the Tutorials icon called out in a red box, to the right of the File menu.

Then, open the Detecting Objects example project.

VEXcode IQ Toolbar with the File menu open, and Open Examples selected with a red box. 'Open Examples' is the fourth item in the menu.

The Programmer should complete the following steps:

  • Open the File menu.
  • Select Open Examples.
  • Use the filter bar at the top of the application and select "Sensing."

    Example project selection window with the Sensing filter at the top highlighted with a red box and sensing project icons shown below.

  • Select and open the Detecting Objects example project.

    Example project icon reads Detecting Objects at the bottom and shows a robot icon with a sensor to the left and a sketch indicating detection to the right.

  • Save your project as Detecting Objects.

    Project name dialog box in the VEXcode IQ Toolbar. Slot 1 is selected and the project name reads Detecting Objects.

  • Check to make sure the project name Detecting Objects is now in the window in the center of the toolbar.
  • For addition help, view the Use Example Projects and Templates tutorial video.

    VEXcode IQ Toolbar with the Tutorials icon called out in a red box, to the right of the File menu.

Teacher Tips icon Teacher Tips

The three colored objects do not have to be cubes, they can be any relatively small green, red, and blue object.

Step 3: Configuring and Using the Vision Sensor

  • Begin by watching the Configuring the Vision Sensor tutorial video.
  • Next, configure the Vision Sensor for three colored objects: red, green, and blue.

    Vision Sensor configuration window shows an image of a hand holding a red cube to the left, with an overlay on the cube and the words REDBOX and W142 H142 above it. To the right, 3 Color signatures are set for BlueBox, Redbox, and Greenbox.

  • Have the Programmer open the previously saved Detecting Objects example project.

    Example project icon reads Detecting Objects at the bottom and shows a robot icon with a sensor to the right, and indicates detection to the right.

  • What is this project actually doing? Predict what the Autopilot will do and have the Recorder write down the predictions in your engineering notebook.

    Start of the Detecting Objects VEXcode IQ project is shown. To the left the project begins with a When started block with a forever block attached. Within the Forever block are commands to clear all rows and set the cursor to row 1 column 1, with a comment to Detect Blue and take a snapshot of Bluebox. Next is an if then block with the condition set to Vision12 object exists then print blue object found, else print no blue object. To the right a note reads "this project will detect 3 different colored objects and display when each object is found on the IQ Brain's screen.

  • Have the Driver Download and Run the project. Have the Builder place different colored objects in front of the Vision Sensor and observe the robot's behavior. Have the Recorder record in your engineering notebook how your prediction was different or correct compared to what you actually observed from the project.

    For additional help, view the Download and Run a Project tutorial video.

    VEXcode IQ Toolbar with the Tutorials icon called out in a red box, to the right of the File menu.

Teacher Toolbox icon Teacher Toolbox - Answers

Facilitate a classroom discussion to have the students share what they predicted this project will do in their engineering notebook and also reflect on how to configure the Vision Sensor.
Facilitate the discussion by asking the following questions:

  • What are the steps for configuring the Vision Sensor?

  • What does the Object exists block do?

  • What does the if/then/else block do?

  • What would happen to how the Vision Sensor detects objects if we changed rooms?

Answers will vary:

  • The students should note that the object name will have to be decided. The object should be placed in the frame of the Vision Sensor and stilled using the "Freeze" button. The color will then be selected and configured using the "Set" button. The students should outline the steps listed in this article as well as the steps listed in the Configuring the Vision Sensor tutorial video.

  • The Object exists block reports if the Vision Sensor detects a configured object. More information on how to use this block can be found in the Help information.

  • The if-then-else block runs the blocks inside the first or second parts of the if then else based on the Boolean value reported. More information on how to use this block can be found in the Help information.

  • If the Vision Sensor was asked to detect objects in a different environment, the lighting could change and the colors of the objects could look different. This may make it difficult for the Vision Sensor to detect objects.

Extend Your Learning icon Extend Your Learning - Configure More Objects

Choose two other colored objects to configure, possibly white, purple, yellow, etc...

AI Vision Sensor configuration window showing the snapshot on the left with a hand holding a yellow gear. There is a square overlay on the yellow gear and the data reads Yellow box, X90 y 62, w102, h 98. TO the right the color signatures for Bluebox, Redbox, Greenbox, and Yellowbox are set.

If the students need help with configuring, refer them to the Help information or tutorial.

Step 4:  Tuning the Vision Sensor

Often times an object is configured to be recognized by the Vision Sensor in one environment, for example, in a classroom. When the Vision Sensor is then taken into a different environment such as a competition setting, the object may not be recognized by the Vision Sensor. This is often due to a change in lighting after the Vision Sensor has already been configured. To solve this problem, you may have to tune your Vision Sensor.

  • Begin by watching the Tuning the Vision Sensor tutorial video.
  • Next, Tune the Vision Sensor for the three colored objects: red, green, and blue.

    Vision Sensor configuration window with a hand holding a red cube with an overlay over the cube and text reading redbox and x84 y 28 then w 158 h 166. To the right Bluebox, Redbox, and Greenbox color signatures are set with a slider highlighted in a red box with the dial set to 4.4.

  • Have the Programmer open the previously saved Detecting Objects example project.

    Example project icon reading Detecting Objects on the bottom showing a robot icon with a sensor icon and indicating detection to the right.

  • How will tuning the Vision Sensor affect how well it can detect objects? Have the Builder take the Autopilot to a different part of the room with more or less light.

    Autopilot with the Vision Sensor sitting on IQ Field, with the Vision Sensor facing the green cube.

  • Have the Driver Download and Run the project. Have the Builder place different colored objects in front of the Vision Sensor and observe the robot's behavior. Have the Recorder document in your engineering notebook how well the Vision Sensor detects objects. Does the Vision Sensor need tuned after it changed locations?

    For additional help, view the Download and Run a Project tutorial video.

    VEXcode IQ Toolbar with the Tutorials icon called out in a red box, to the right of the File menu.

  • Tune the Vision Sensor as necessary. Test the Vision Sensor after it has been tuned to determine if it can detect objects better and make adjustments as needed.

Motivate Discussion icon Motivate Discussion - Reflecting on the Activity

Q: Did the Vision Sensor detect objects as you expected it to?
A: Answers will vary; however, the goal of this question is to promote cognitive thinking. Students should note that the Vision Sensor's ability to detect objects can change depending on the environment and light.

Q: Why is it important to be able to tune the Vision Sensor as needed?
A: While answers may vary, a common response should be that if a robot uses a Vision Sensor and is taken to a competition or even used in a game or challenge, how well the robot performs will depend on the accuracy of the Vision Sensor. Tuning it is important for accuracy.

Extend Your Learning icon Extend Your Learning - Multiple Objects

Ask the students to run the Detecting Objects project and place more than one of the configured objects in front of the Vision Sensor. What happens? Ask them to document their findings in their engineering notebook.
Now, ask the students to place one configured object and one unknown or not configured object in front of the Vision Sensor. What happens? Ask them to document their findings in their engineering notebook.

Ask the students before testing it, what would happen if they placed three configured objects in front of the Vision Sensor? Ask the students to write down their predictions before testing it. Ask them to record their observations after testing it.

AI Vision Sensor configuration window showing the snapshot on the left with people holding a green cube to the left and a red cube to the right. Data for the objects shows a greenbox and redbox are detected. To the right color signatures for bluebox, redbox, greenbox, and yellowbox are set.

Facilitate a discussion on what the students predicted and observed.

Facilitate the discussion by asking:

  • What were the differences between one, two, and three objects?
  • Would you adjust the project in any way for recognizing multiple objects?