Mission 5: Give It Echo Ears
Big Question
How can a robot sense that something is nearby without touching it?
Your Mission
Add the ultrasonic distance sensor. It sends a tiny sound pulse and listens for the echo. The robot brain uses the echo time to estimate distance.
Parts
- Bluepill on breadboard
- Ultrasonic distance sensor
- Jumper wires
Build
- Place the ultrasonic sensor so the two round parts face outward.
- Connect power and ground.
- Connect the trigger and echo wires to the pins shown in ModuLab.
- Keep the sensor pointing into open space.
Connect
- Plug in USB.
- Press **Connect**.
- Open the sonar or distance panel.
Try It
Move your hand:
- far away
- halfway
- close
Watch the distance value change.
Success Check
- The number changes when your hand moves.
- Close objects give a smaller number.
- Far objects give a bigger number or no reading.
Debug
If the number is stuck:
- Check trigger and echo are not swapped.
- Keep your hand flat in front of the sensor.
- Move slowly.
- Check power and ground.
Remix
Make the display show:
- FAR
- NEAR
- STOP
Choose your own distance limits.
Robot Brain Idea
Sensors are inputs. They let the robot brain learn something about the world before choosing what to do next.
