Using the line sensors

Students will explore Otto’s ability to use the line sensors to identify light and dark surfaces.They will also be introduced to the concept of digital and analog values.

Knowledge required

This activity assumes that students are already familiar with the ultrasonic sensor and how to use it to measure distances and display lights. It also assumes that the Otto robots for this activity have line sensors connected in digital and also analog ports. 

Materials required

  • Otto Starter robot or only the circuit board with the line sensors 
  • Computers with internet and/or Bluetooth connection 

Optional materials

  • Using the line sensors worksheets 

Learning Objectives

  • Identify the key components of a robot and explain their functions. 
  • Recognize robotic systems in everyday life and be able to reason about how they help. 
  • Know that robots use algorithms to perform tasks. 
  • Write and upload programs that control the robot. 
  • Understand key concepts of programming (loops, conditionals, variables, and functions) and apply them to write effective programs for the Otto robot. 
  • Identify the problem to be solved and develop a plan to address it using the Otto robot components. 

How do line sensors work?

Start the activity by asking students to share their ideas about how the line sensors work. They can notice that the sensors have some “small bulbs”, another good question can be “what do you think that the small bulbs in the sensors are for?” 

Encourage students to share any idea they can think about! 

In the second slide, it briefly specifies that Otto can use line sensors to “see” a type of light that we humans cannot. 

The next slide provides a concise explanation of infrared lights. As a teacher, you have the freedom to expand upon this explanation using your own resources. Moving to the next slide, there is a short explanation about line sensors.  

💡 Consider conducting a little experiment for students to “see” the infrared light through a camera as shown in this video: https://www.youtube.com/watch?v=aoPSX3wYSXo 

Activity: using the sensor (digital)

Challenge students to program the line sensors in combination with the ultrasonic sensor lights so that covering the left line sensor will turn on Otto’s left “eye”, and covering the right one will turn on his right “eye”. Show them which blocks they should use (the digital blocks of line sensors) and point out that they can be used in the same way as the ultrasonic sensor to measure distance; but in this case the possible values to compare are 0 and 1.  

To use the line sensors, we have four blocks in the Sensing section. Two of them allow us to read the analog value from the left and right sensors, respectively, while the other two allow us to measure the digital value. In this activity, we will be using the digital value. 

Although in the Sensing section, the blocks for reading digital values are integrated within the comparison blocks (the green block), these can be used outside of them if desired. Just as the analog blocks—which come outside of the comparison blocks—can be used by connecting them to comparison blocks. 

In the next slide there is a solution for the challenge. Engage students in a quick conversation about how that approach works and, if they find other possibles approaches, allow them to share their own solutions.  

Possible solution to the challenge: 

This program allows the robot’s eyes to react based on what the line sensors detect. In a forever loop, the robot checks the status of its two sensors: if the left sensor detects the line, the left eye lights up blue, and if it doesn’t, that eye turns off; the same happens with the right sensor and eye. 

In this way, each eye immediately reflects what the sensor on its side perceives, making it easier for students to visually and directly observe when the robot is detecting the line on the ground. 

 

Digital vs Analog

The next two slides provide a simple explanation about what digital and analog mean in the context of sensors.  

Activity: using the sensor (analog)

The last slide shows how to use the serial monitor and the analog line sensor blocks to display the analog values read by the sensors in real time. To make it easier to read, we added a 1 second wait between each reading of the sensors, feel free to add extra time or removing it. 

Activity expansion

The next slide shows how to use the serial monitor and the analog line sensor blocks to display the analog values read by the sensors in real time. To make it easier to read, we added a 1 second wait between each reading of the sensors, feel free to add extra time or removing it. 

Program to read analog values from line sensors: 
12-2_measure-line-sensors.otto 

When you run this program and open the serial monitor, you will see the written texts + sensor values appear: 

We can see how the values change if, for example, we pick Otto up or move him to a different colored surface. 

 

Removing the wait of 1 second will cause the values on the serial monitor to appear very quickly, making it impossible to read and interpret the data. You can demonstrate this to your students to explain the importance of adding this time delay and also to demonstrate the speed at which the machines operate. 

Activity expansion

This last activity could be expanded by adding extra challenges, like:  

  • As well as with the digital blocks, use the analog blocks to measure values and trigger some actions such as playing sounds or displaying lights. Due to the high quantity of possible values, students can get creative by including a large range of possible actions depending on the value measured. 
  • Ask your students to share their ideas about “What’s better: digital or analog?” 

Lesson Evaluation

  • Students participated in discussions about infrared light and its relevance to line sensors. 
  • Students successfully coded the line sensors using digital blocks to detect light and dark surfaces, integrating this with the lights of the ultrasonic sensor. 
  • Students understood the differences between Digital and Analog in the context of line sensors. 
  • Students demonstrated their ability to use the serial monitor and analog line sensor blocks to read and display analog values in real-time. 
  • Students applied their knowledge effectively to control Otto using both digital and analog outputs from line sensors, demonstrating comprehension of sensor functionality in robotics. 
  • Lesson objectives were achieved as students successfully used line sensors to detect light and dark surfaces, distinguishing between digital and analog sensor outputs. 
Scroll to Top
This will be available with the release of this product.