Lesson 02 · 60 minutes
Same Job, Different Physics
Laser, sonar and infrared
Today's goal
Measure the same distances with the laser and the sonar, predict which one will be fooled by each object, and explain why.
Ideas in this lesson
- The laser (VL53L0X) times a pulse of light; the sonar (HC-SR04) times a click of sound
- Light travels in a narrow beam; sound spreads out in a wide cone
- Every sensor has things it cannot see
- The remote talks in infrared light your eyes cannot see, but a phone camera can
Sense → Think → Do
Today is all SENSE. Two sensors answer the same question, 'how far is the wall?', with completely different physics, and they disagree in interesting ways.
How the session runs
- Connect the Mecanum Workshop app and open the Sensors tab. Find the 'Laser rangefinder and sonar' panel.
- Press Watch (rw). Both numbers update five times a second: the big number is the laser in mm, the line below it is the sonar. 'nothing in range' and 'no echo' mean 'I got nothing back'.
- Hold a book flat in front of the robot at 20 cm, 50 cm and 1 m. Write down both readings each time. Do they agree?
- Now predict, then test: a fuzzy sweater, a window or glass door, a chair leg off to one side, a plastic bottle, your hand.
- Chair leg to the side: the sonar's wide cone often 'sees' it; the laser's narrow beam usually does not. Fuzzy sweater: sound gets soaked up. Glass: the laser can go straight through or bounce.
- Point the IR remote at a phone camera and press a key. The 'invisible' light shows up as a flicker on the screen.
- Make a class table: object, laser, sonar, who was right, why.
Try this
- Find the farthest thing the laser can still see. Past about 1.2 m it says 'nothing in range'.
- Find an object the sonar sees and the laser misses, and the other way round.
- Which sensor would you put on the front of a robot vacuum? Which on a robot that drives past windows?
When it goes wrong
| What you see | What it means |
|---|---|
| Laser panel says 'not found' | The VL53L0X was not found at start-up. Check SDA to A4 and SCL to A5, then restart the robot; it only looks once, at power-on. |
| Sonar says 'A2/A3 used by sensors' | A line or light sensor is wired to A2 or A3 in the running layout. The sonar steps aside on purpose. Use the ADS1115 layout or move those sensors. |
| Laser always reads short | The little coloured protective film is still on the sensor window. Peel it off. |
| Both numbers jump around | Normal near the edge of what each can see. Hold the object still and read several times. |
Notes for the grown-up
The goal is not 'which sensor is best' but 'every sensor has blind spots, and you can predict them from the physics'. Let them be wrong in their predictions; the surprises are the memorable part.
Ages: K-5: just two objects (book and sweater) and the phone-camera trick; talk about bats and dolphins for sonar. 6-12: compute speed of sound from the sonar (343 m/s, there and back) and discuss why the laser needs picosecond timing.
Materials: Robot with laser and sonar, app on a tablet or laptop, tape measure, book, fuzzy sweater or towel, glass or window, chair, phone with a camera.