What it’s about
The Pixy2 CMUcam can be trained to identify objects by their colors and send their locations and sizes to the ActivityBot 360. This step-by-step tutorial shows how to make the ActivityBot 360° use the data it receives from the Pixy2 to find objects of certain colors and track them in BlocklyProp. Code examples in C and Spin are also available on the Pixy2 product page under "downloads".
IMPORTANT: Follow each step; don’t skip any. You’ll have to carefully follow all the steps in this tutorial for this robot color tracking application to work. Then, you’ll see a totally new personality in your robot and be very proud of the results!
Before you start
You will need:
- Assembled and calibrated ActivityBot 360° Robot (#32600)
- Pixy2 with Cable + Mounting Hardware (#30028)
- Cylinders, blocks or painted objects of different colors. 3D printed objects work well. In this tutorial we're using 1" square wooden blocks.
You should have completed:
- Add a Pixy2 CMUcam to an ActivityBot 360°. This tutorial shows you how to mount the Pixy2 CMUcam on the ActivityBot 360° using the cable and mounting hardware.
- BlocklyProp Robotics with the ActivityBot 360 Tutorials. Experience with the servo speed blocks and managing large programs (collapsing blocks, using terminal, etc.) in BlocklyProp will be especially useful.
Pixy Power from USB or Propeller Activity Board, not Both!
It’s OK to use either power setup (A) or (B) shown below, but do not connect both at the same time. For more info, see Make the Pixy2 Connections.
Power Supply Setup (A)
In Power Supply Setup (A), Pixy2 is powered through USB during configuration. Ground, Sin and Sout are connected to Propeller Activity Board. The Pixy2's power cable is not connected to the Propeller Activity Board WX 5V supply.
Power Supply Setup (B)
In Power Supply Setup (B), the USB cable is removed. The Pixy2's Ground (Vss), Sin and Sout are connected to Propeller Activity Board. The Pixy2's power cable is connected to the Propeller Activity Board WX 5V supply. Pixy2 is powered through the Propeller Activity Board’s 5V connection. The Propeller Activity Board WX must be in switch position 2 for this arrangement (position 2 provides power to the servo header 5V ports). You may also use switch position 1 if you connect the Pixy2 5V header above the breadboard.