Lesson Modules
Teaching Tips:
Compared to machines, humans have terrible memory.
In Lesson 1, we compared the RobotLAB Autonomous Car's distance sensor to our human eyes, and used it to avoid running into an obstacle without human aid. Automation is all about developing technology to do what was once the job of humans.
- sight
- hearing
- sense of smell
- memory
- sense of taste
- speed
Today we will use one of the RobotLAB Autonomous Car's sensors to "remember" an aspect of driving we often forget, turning on the headlights!
Teaching Tips:
Discuss these questions with your classmates.
We know we will be using the RobotLAB Autonomous Car's light sensor, but how will we test it? In the previous lesson we just let the car loose to drive until it approached a wall. This test might not be so simple.
In order to understand light sensors, first we need to understand light.
Light has a lot of mysterious properties, and it is not yet fully understood. As you may already know, there is currently no consensus on whether light is a particle or a wave.
Things like sound waves and waves in the ocean are obviously waves. Backpacks and rocks are obviously made from particles. But light has some properties of both.
Light is a particle because:
1. it travels in straight lines
2. it forms sharp shadows
3. light beams are localized in space
Light is a wave because:
1. two crossing beams do not collide
2. light beams travel at only one speed
If we aren't even sure what light is, how can we detect it?
A light sensor, also commonly called a photosensor or photodetector, works by converting light signals that hit it into voltage or current. The light sensor on the Altino senses light shining onto the car and converts the current into a numerical value we can understand and use in our code.
What number represents no light? What number represents the maximum amount of light? The only way to find out is to test the sensor.
Teaching Tips:
Pseudocode is provided here for teachers:
use the light sensor AltinoCDS if (light-in-the-room < some-number) { turn headlights ON } if (light-in-the-room > some-number) { turn headlights OFF }
Sometimes beginning to write a program can feel daunting, and you don't know where to begin. During those times it's always helpful to describe what you want the program to do. What should this automatic headlight program do?
Sense the light in the room
Determine if it is dark out
If it's dark, turn on the headlights
And if you want to get really fancy
If it’s bright, turn off the headlights
These steps are pretty simple to convert into Pseudocode. Here are some options you can use in yours!
if (light-in-room < some-number) { | turn headlights ON | AltinoIRSensor |
if (light-in-room = some-number) { | AltinoCDS | Drive forward |
if (light-in-room > some-number) { | turn headlights OFF | AltinoABS |
Teaching Tips:
Now it's time to translate the pseudocode into real code!
Here's something to get you started:
And here are some other blocks you can use:
Remember, writing code is like writing a poem, there are many correct answers. Maybe you answered differently. If so, I encourage you to convert your pseudocode into code and see how it works!
Teaching Tips:
Question 1: What was the coolest thing you learned today? Write your answer in the box, and see it appear which your classmates answers!
Any answer will do here. If time permits, have a short discussion with students about their answers.
Question 2: Check the concepts you understand. Don’t worry, this isn’t for a grade, it’s just so your teacher can check the classes’ understanding.
This is the students' self-assessment of their understanding of the material. You will see a bar graph once all the poll answers are submitted.
Question 3: Name some light sensors you have seen in your home/ at school/ out in the world.
- Some people have light sensors in their driveways
- bar code scanners
- infrared light sensors for security
- (many possible answers)
Question 4: Is light a wave or a particle?
There is no one correct answer to this question. Light has properties that suggest either answer.
- Light is a particle and a wave
- Light sensor
- Turn on the car headlight