Navigate around objects like a self-driving car!
How sound waves measure distance (like bat echolocation!)
If obstacle detected, then turn away logic
Robot explores on its own without crashing!
Processing sensor data and reacting instantly
📍 Note: The Maqueen Plus V2 has an ultrasonic sensor mounted on the front (looks like two silver "eyes"). We'll use this to detect walls and objects!
Look at the front of your Maqueen—see those two silver cylinders? One is a transmitter (sends sound waves), the other is a receiver (listens for echoes). Just like a bat!
Let's see what distances the sensor reports! In MakeCode:
Upload the code. The LED matrix will show the distance in centimeters to the nearest object!
Now let's make the robot stop when it gets too close to something:
Stopping is good, but let's make it AVOID the obstacle by turning!
Always turning the same direction can get the robot stuck in corners. Let's make it randomly choose left or right!
Set up books, boxes, and toys in a room. Put the robot down and watch it explore autonomously!
The ultrasonic sensor sends 40kHz pulses (ultrasound—above human hearing). When the pulse hits an object, it reflects back. The sensor measures the round-trip time and calculates:
Speed of sound is ~343 meters/second. The "÷2" is because the sound travels TO the object and BACK.
Real-World Applications: This technology is everywhere! Parking sensors in cars, warehouse robots, drones, medical ultrasound imaging, and even measuring liquid levels in tanks! 🚗🏥
Check that nothing is blocking the sensors. Soft materials (fabric, foam) can absorb sound waves. Try detecting hard, flat surfaces like walls or cardboard boxes.
Increase the detection distance from 20cm to 30cm. Or slow down the forward speed so it has more time to react.
Increase turn time (try 800ms instead of 600ms) or add a second random turn if it still detects an obstacle after the first turn.
Incredible work! The robot now has spatial awareness and can navigate autonomously. The boys learned about echolocation, real-time decision making, and autonomous systems—the foundation of self-driving cars and warehouse robots!
Next up: We're adding EYES to the robot! The HuskyLens AI camera will let it see and recognize objects. This is where things get REALLY exciting! 👁️
Next Mission: First Look (HuskyLens Setup) 👁️ →