Make the robot follow colored objects like a puppy!
How cameras see color using RGB values
Following moving targets in real-time
Using X/Y coordinates to navigate
Robot responds to visual stimuli instantly
This mission turns the robot into a playful puppy that chases colored toys! Hold up a red ball and watch it follow. Switch to a blue ball and it ignores the red. This is selective attention—the same thing our brains do when we focus on one thing and ignore distractions.
Applications: Sports ball tracking, sorting colored objects in factories, following traffic signals, even helping colorblind people identify colors! 🏀🚦
Press the Function button on the HuskyLens until you see a rainbow/palette icon. The mode name should say "Color Recognition."
Hold a bright red object (ball, toy car, piece of construction paper) about 12 inches from the camera. Center it on screen.
Move the red object around. The HuskyLens should draw a box around it and track its movement. Try these experiments:
Let's make the micro:bit respond when it sees the target color:
Upload and test! The robot should show a heart and beep whenever it sees red.
Now for the magic—steering toward the colored object:
Let's add smarts—stop if the object gets too close (prevents crashes!):
The HuskyLens can learn multiple colors and give each an ID! Train it on red (ID1) and blue (ID2), then program different behaviors:
The camera captures images as a grid of pixels. Each pixel has an RGB value (Red, Green, Blue intensity). When you train a color, the AI analyzes the dominant hue in that region and stores it as a reference.
Every frame (30 per second), it scans for pixel clusters matching that hue. It groups nearby matching pixels into "blobs" and calculates the blob's center point (X, Y) and size (width, height). This is called color segmentation.
Real-World Applications: Sports broadcasts (yellow "first down" line in football), fruit sorting machines (separating ripe from unripe), medical imaging (detecting abnormal tissue colors), and even makeup apps (changing lipstick color)! 🏈🍎💄
Put colored targets around the room. Program the robot to drive to red first, then blue, then green. Can it do a circuit?
Use a colored ball. Program the robot to push it toward a goal (marked with a different color). First to score wins!
Make traffic light cards (green/yellow/red paper). Robot follows green, slows at yellow, stops at red. Teach traffic safety!
Flash colored cards in sequence. Robot must follow them in order. Wrong color = buzzer sound. It's Simon Says!
Fantastic! The robot now chases colored objects like a playful puppy! The boys learned about color theory, computer vision segmentation, spatial tracking, and reactive AI—skills used in robotics, AR/VR, and autonomous vehicles!
Next up: We'll attach the microscope module and explore the TINY world! Look at circuits, bugs, leaves, and more at 30x magnification. Science meets robotics! 🔬
Next Mission: Microscope Explorer 🔬 →