Sensors
Sensor Detective
Guided by Dieter Fox
Something in your house is changing — the light, the temperature, the door. Your job is to build a robot detective that notices.
Watch
See it happen in the real world.
Robots feel the world through sensors. A light sensor turns brightness into a number. A distance sensor sends out a pulse and times how long it takes to bounce back. A touch sensor closes a circuit when something presses on it. Every robot you've ever seen is mostly a stack of these little number-makers. Dieter Fox's research is about getting a robot to trust the right sensor at the right time, because sensors lie sometimes.
Think
A question worth sitting with.
If the light sensor says 'dark' but the camera sees light, which one should the robot believe?
Build
Make something with your hands.
Take a flashlight, a piece of black paper, and a piece of white paper. Shine the flashlight on each. If you have a Scratch project open, log the brightness as a number. If not, write the number on a sticky note for each surface.
Step-by-step
Gather a flashlight, a sheet of black paper, a sheet of white paper, and a notebook.
Shine the flashlight on the white paper. On a 0–10 scale, write down how bright it looks. That number is your sensor reading.
Repeat with the black paper. Write down the reading.
Move the flashlight further away. Take both readings again. Bigger gap or smaller gap?
Pick a 'trigger threshold' — the brightness number above which your robot will react. (Example: 'beep if reading > 6'.)
Test the threshold with surfaces around the room: a window, a TV screen, a couch. Did your threshold pick the right ones?
If you have a Raspberry Pi or a light sensor
Pythonimport time
from gpiozero import LightSensor, Buzzer
eye = LightSensor(4)
voice = Buzzer(17)
THRESHOLD = 0.6 # tune this for your room
while True:
reading = eye.value
print('brightness:', reading)
if reading > THRESHOLD:
voice.beep(0.1, 0.1, n=2)
time.sleep(0.5)Toolkit
- Household
- Scratch
Play
Test it. See what it does.
Set up three mystery objects under a sheet. Use only your sense of touch to guess what each is. You are the sensor. Your brain is the robot.
Challenge
Push it a little further.
Build a door alarm: arrange your sensor so it triggers when someone opens the door to your room. Decide what 'trigger' means — a sound, a written message, a light.
Reflect
Notice what your robot taught you.
What did your robot learn about your house that you didn't already know?
Also ask yourself
What surprised you?
Reward
Mission outro
+0XP
“What else could your robot 'feel' if you added another sensor?”
Skills advanced: light sensor, distance sensor
Badge
Sensor Explorer