Read more on how you can utilize the PixyCam in executing your next computing projects.
Above: Pixy 2 assembled atop an Arduino Uno
Until recently, anyone who wanted to work with computer vision had two options:
- Purchase a highly capable and rugged industrial vision system.
- Cobble something together with a webcam and computer.
Both choices have their advantages and drawbacks. But as of 2014, builders have a third option: the PixyCam.
Pixy2 vs Pixy
This small camera can track colored objects and, with the help of its pan/ tilt kit, it can physically move to aim itself. The Pixy boasted impressive features from its debut, but the recently-released Pixy2 takes this PixyCam even further. The Pixy2 is smaller, faster, and it can do everything the original Pixy can do, plus it features line-following capabilities and a pair of bright LEDs to light its path. Best of all, it’s cheaper than the original, coming in at just under $60.
Of course, Pixy/Pixy 2 aren’t perfect. They don’t include features like facial recognition or part measurement. Charmed Labs, PixyCam’s creator, explicitly stated that the device isn’t designed to control heavy machinery. The device does have a special aptitude for following colored objects, especially using its pan/tilt kit with a pair of micro servos. I use my camera with the pan/tilt kit, and it’s fun to see it track a moving red ball across my desk.
Step 1: Programming Your PixyCam to Track Objects
Here’s a short overview of setting up your PixyCam to track objects:
- Download and install Pixy’s computer interface program, PixyMon v2.
- Plug in the camera using the included micro-USB cable.
- Experiment teaching the camera to “see” a colored object, using your mouse to highlight the proper color.
- You can also teach it using the single-button interface, but the mouse interface is easiest while you have the program up. Watch the camera track objects on the video screen, acting as a sort of intelligent webcam.
Fig 2: Pixy2, along with pan-tilt kit and Arduino sold separately
Visualizza prodotti correlati
Visualizza prodotti correlati
A000073 | Arduino Uno Rev3 SMD
Arduino Corporation Sistema integrato, schede e kit di sviluppo VisualizzaStep 2: Assembling the Pan/Tilt Kit
Once you enable your camera to track objects, it’s time to assemble the pan/tilt kit. This simple project only requires:
- Pliers
- Wire cutters
- Phillips-head screwdriver
The build takes some attention to detail, but the pan/tilt kit will allow your Pixy2 to auto-aim at moving object. Once you’ve assembled your Pixy2 on its new 2-axis “neck,” plug it into the computer once more. This time, select “pan_tilt_demo” under the program menu. When properly selected, the Pixy will attempt to follow whatever item you programmed in on the last step, using the servos for movement. Since the base by itself doesn’t have much mass, you’ll need to hold it in your hand or attach it to something else to allow it to move properly without sliding the base around.
Fig 3: Pixy 2 and pan/tilt functional, staring down a small red ball
Step 3: Connecting Pixy Camera to Arduino or other Dev Boards
Once you’re familiar with the device’s functionality, the real fun begins. It’s time to attach your Pixy to an Arduino, Raspberry Pi, BeagleBone, or other dev board that communicates via SPI, I2C, UART, or USB. We used an Arduino Uno, which made things especially easy. The Arduino Uno includes a cable that connects directly to the board’s ICSP header, and the base’s bottom can screw directly into the Uno.
- Connect the device to the Arduino using the cable and standoffs.
- Set up the Arduino library for Pixy2 per PixyCam instructions found here.
- Load up the “ccc_hello_world” from Examples/Pixy2. Use a serial monitor to see the camera’s stats on the blocks.
- Next, load “ccc_pantilt” onto your dev board. Instead of tracking your object numerically, the camera physically moves around, like a person’s eye tracking a moving target.
- You can modify the tracking speed by adjusting the panLoop and tiltLoop PID numbers to find your preferred speed.
Once you’re satisfied with the program settings, you can disconnect the device from your computer and power it with a USB battery. Your Pixy can now track objects all on its own. It’s quite entertaining to watch it in action, though you might notice the camera wobbling slightly as it attempts to center itself on the tracked object. This is due to visual signal noise, a characteristic present in any system of this type.
Explore more of what this small CV device has to offer in your own programs. This could mean tracking colored objects with your latest robot, or following lines around a dark room using the built-in LED headlights.

