Programming a Robot: Light Sensor PDF

Summary

This document details a lesson plan on programming robots to react to light sensor input with activities, explanation and questions. Examples of robotic programming using light sensors are provided along with instructions.

Full Transcript

PROGRAMMING A ROBOT: LIGHT SENSOR SESSION 1 LESSON 8 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Objectives At the end of the lesson, the students should be able to:  Explain the use of light sensors in robotics;  Describe how light sensors work;  Use code blocks to program a sound sensor...

PROGRAMMING A ROBOT: LIGHT SENSOR SESSION 1 LESSON 8 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Objectives At the end of the lesson, the students should be able to:  Explain the use of light sensors in robotics;  Describe how light sensors work;  Use code blocks to program a sound sensor; and  Create a device that makes use of a light sensor as a trigger. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Engage Arrange the jumbled letters to form words related to light 1. WIANBOR - the real color of sunlight 2. RUTANLA – a source of light like the sun 3. LTIFARCIAI – a source of light created by humans 4. HTGIL MIETTGNI SOIDED- a semiconductor light source used in robotics 5. IGHLT ROSENS- a sensor used to detect light TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Explore Let us watch this video https://www.youtube.com/watch?v=aAQBOkGMIjk TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Explain Light sensors are input devices. There are two onboard light sensors on the Me Auriga board. The light sensor is used to detect and measure the intensity of light in lux. It detects and converts photons to electrons and sends the signal to the microcontroller for processing. The more light intensity it detects, the higher value it sends to the microcontroller. The value of the sensor can be used to control other electronic devices, especially the output devices, of the robot. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Explain It is used to run the program after you click or tap the play icon. [MKS1]Please include the unit of measure used. [j2]Done It is used to run all blocks inside of it repeatedly. It is used when we want the robot to make a decision. It is used to add time intervals between commands. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Explain It is used to command the robot to move. [MKS1]Please include the unit of measure used. [j2]Done It is used to open a small window next to the robot. It is used to print any text or value inside the slot. It is used to get the value of the light sensor. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Explain Key programming blocks Let us create a simple program for the robot to measure the sound waves from its surroundings. Programming steps: 1. Open the Miranda app installed on your computer. Make sure you enter the connection code, your username, and password. 2. Since we are programming the light sensor, we need to add shadow to our scene. Look at the rendering quality below and choose Medium or High. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Explain Key programming blocks 3. Click the OPEN SCENE from the cloud icon. 4. Select the scene Creators 2: L8-S1-Programming a Robot: Light Sensor to simulate the scenario. 5. After setting the rendering quality to High, we can notice the object blocking the light from the light source, and there is a shadow next to the object. We can use that shadow to make our robot measure the differences in light intensity. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Explain Key programming blocks 6. Click the Land Raider model to open the programming pane on the left side of the simulator. 7. Click the program with the Scratch icon to start building the code for the scenario. Drag the command blocks according to the image shown below. Input the values indicated in each command block. 8. Click the RUN button to start the simulation and observe the behavior of your robot. 9. If you can, create a video or screen record of the output and send it to your teacher. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: SOUND SENSOR Explain What are the blocks that we need? TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Explain Drive the robot around the scene using WASD keys and record the light intensity value measured by the light sensor. After you get the highest light intensity value, try to drive the robot in the shadows and see the difference in the light intensity. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Evaluate A. Identification Direction: Identify what is being described by the following statements and write the correct answer in the space provided. _________1. It is a microcontroller board of the mBot Ranger model in which two light sensors are embedded. _________2. It detects and converts photons to electrons and sends the signal to the microcontroller. _________3. It is a programming block that opens a small window next to the robot. _________4. It is a programming block that allows the robot to show the updated value of light sensors. _________5. It is a device that converts photons to electrons. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Evaluate Direction: The following items are important in understanding how to program the onboard light sensor of the Land Raider robot. Read each item carefully and encircle the correct answer. _______ 1. This block allows you to use the value of light intensity received by onboard light sensors. A. B. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Evaluate _______ 2. The value of light intensity changes over time. A. B. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Evaluate _______ 3. The robot should react when it detects higher light intensity. A. B. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Evaluate _______ 4. What is the output of the robot with this program code? A. The robot produces a sound when it is B. The robot turns off the alarm when it dark. is dark. TechFactors Copyright 2022 Session 1: PROGRAMMING A ROBOT: LIGHT SENSOR Evaluate _______ 5. What is the output of the robot with this program code? A. The robot produces a sound when it is B. The robot turns off the alarm when it dark. is dark. TechFactors Copyright 2022 PROGRAMMING A ROBOT: LIGHT SENSOR SESSION 2 LESSON 8 Session 2: PROGRAMMING A ROBOT: LIGHT SENSOR GUIDED ACTIVITY Direction: Read the situation carefully. Smartphones use light sensors to control the screen brightness so that the phone can save up on battery use. The same principle can be applied to your use of electricity. You can save up a lot when lights are turned off during the day since you can use natural light to brighten a room. Suppose that in your room, you want to have a night lamp. You want this night lamp to be automatically turned on when it detects light intensity lower than 400 lux so that you will only use its light in the evening. The Land Raider model should be controlled using WASD keys. The color it should produce is white. TechFactors Copyright 2022 Session 2: PROGRAMMING A ROBOT: LIGHT SENSOR GUIDED ACTIVITY What are the input and What are the blocks needed? output devices used by the robot? The onboard light sensor 1 is the input device, and the onboard RGB LED is the output device. TechFactors Copyright 2022 Session 2: PROGRAMMING A ROBOT: LIGHT SENSOR GUIDED ACTIVITY After figuring out what the robot must do and the input and output devices you will use for the robot, follow the steps below to open a scene and complete the task. 1. Open the Miranda app installed on your computer. Make sure you enter the connection code, your username, and password. 2. Since we are programming the light sensor, we need to add shadow to our scene. Look for the rendering quality and choose Medium or High. 3. Click the OPEN SCENE from the cloud icon. 4. Select the scene Creators 2: L8-S1-Programming a Robot: Light Sensor to simulate the scenario. 5. Click the Land Raider model to open the programming pane on the left side of the simulator. 6. Click the program with the Scratch icon to start building the code for the scenario. Drag the command blocks according to the image shown below. Input the values indicated in each command block. 7. Click the RUN button to start the simulation and observe the behavior of your robot. 8. If you can, create a video or screen record of the output and send it to your teacher. TechFactors Copyright 2022 Session 2: PROGRAMMING A ROBOT: LIGHT SENSOR GUIDED ACTIVITY What is the conditional statement applied in What is the code? this program? If the light intensity value received by the onboard light sensor 1 is less than 400, then the robot should produce white lights. If not, then the lights turn off. TechFactors Copyright 2022 Session 2: PROGRAMMING A ROBOT: LIGHT SENSOR INDEPENDENT ACTIVITY Direction: Read the situation carefully. The use of light sensors for a night lamp is a true application of these sensors for an energy- saving device. Aside from this, light sensors can also be used for safety devices. Did you know that failure to use the headlights of a vehicle can cause road accidents? How do you think you can use light sensors to help solve this kind of problem? Suppose that you are creating a prototype of a car that has automatic headlights. The Land Raider should do the following: Display the value of light intensity in lux measured by the light sensor. When the robot detects light intensity lower than 480 lux, it should automatically move at half speed and produce white lights using its onboard LEDs. When the robot detects light intensity higher than 480 lux, it should automatically move at full speed and turns off its onboard LEDs. TechFactors Copyright 2022 Session 2: PROGRAMMING A ROBOT: LIGHT SENSOR INDEPENDENT ACTIVITY Answer the following guide questions. 1. What are the blocks needed? 2. How will you use these blocks? 3. What is the lowest and highest light intensity detected by the sound sensor? 4. What is the conditional statement applied in this program? TechFactors Copyright 2022 Session 2: PROGRAMMING A ROBOT: LIGHT SENSOR INDEPENDENT ACTIVITY Assemble the programming blocks in the Miranda simulator. To do this, follow the steps below: 1. Open the Miranda app installed on your computer. Make sure you enter the connection code, your username, and password. 2. Since we are programming the light sensor, we need to add a shadow to our scene. Look for the rendering quality and choose Medium or High. 3. Click OPEN SCENE from the cloud icon. 4. Select the scene Creators 2: L8-S2-Programming a Robot: Light Sensor to simulate the scenario. 5. Click the Land Raider model to open the programming pane on the left side of the simulator. 6. Click the program with the Scratch icon to start building the code for the scenario. TechFactors Copyright 2022 Session 2: PROGRAMMING A ROBOT: LIGHT SENSOR INDEPENDENT ACTIVITY Answer the following guide questions. 1. How many onboard light sensors are there in the Me Auriga board? 2. Is there any difference if you transfer the open console inside the Forever Block? 3. What is the wheel value needed for the robot to move backward? 4. Why is it important to know the value of the light intensity detected by the light sensor? TechFactors Copyright 2022 Session 2: PROGRAMMING A ROBOT: LIGHT SENSOR INDEPENDENT ACTIVITY Your final output will be graded using the following rubric: TechFactors Copyright 2022 Session 2: PROGRAMMING A ROBOT: LIGHT SENSOR INDEPENDENT ACTIVITY Your final output will be graded using the following rubric: TechFactors Copyright 2022