Pixy Robot
Arduino robot with Pixy2 camera tracking colored objects in real time (27 citations).
sigitdanip/pixy-robotThe Problem
Differential-drive robots need real-time visual feedback to track moving targets. Simple IR sensors work for line following but cannot generalize to complex colored objects in dynamic environments.
The Pixy2 camera solves this by running color-based blob detection onboard at 50-60Hz, offloading vision processing from the Arduino. The challenge becomes translating raw (x, y) coordinates into smooth motor commands that keep the robot locked on target.
This project demonstrates a complete control loop, from camera detection to motor actuation, in under 100 lines of Arduino C++, making it accessible for educational robotics and rapid prototyping.
The System
The Pixy2 CMUcam5 detects color blobs using its onboard processor and communicates detected objects to the Arduino Uno via SPI/I2C at 50-60Hz. Each detection returns signature ID, bounding box (x, y, width, height), and the center coordinates.
The Arduino normalizes the x-coordinate from pixel space (0-320) to a signed range (-1 to +1) using a linear mapping function. A dead-zone of 0.15 suppresses jitter from small detection noise.
Differential-drive control uses asymmetric speeds: forward at 80 PWM, turning at 170 PWM on one motor and -80 PWM on the other. An L298N motor driver handles the H-bridge switching. The full loop runs at approximately 16ms per iteration.
Results
The robot tracks colored objects reliably at up to 0.3 m/s with sub-100ms detection-to-motor latency. The dead-zone prevents oscillation when the target is centered, while asymmetric turn speeds produce sharp corrections when the target moves off-axis.
With 27 citations as of 2026, the matching publication validates the approach for educational robotics contexts. The color-based method proved robust under varying indoor lighting conditions typical of classroom environments.
Implementation
The proportional-only controller has no integral or derivative terms. A referenced PIDLoop class exists in the codebase but is unused. This limits performance when tracking targets with non-constant velocity.
Color detection fails under strong lighting changes or when the target color appears in the background. Future work could add adaptive thresholding or multi-signature tracking for improved robustness.
Related
- Kinova ColorSort
Both use color-based computer vision for robotics control: Pixy2 on Arduino vs OpenCV on Kinova Jaco2 arm.
- Solar Cleaning Robot
Both apply embedded vision to autonomous robots: tracking vs navigation.
- Pixy2 Robot Paper
This is the matching publication: 27 citations validating the educational robotics approach.