« Previous - Version 5/16 (diff) - Next » - Current version
Rich LeGrand, 02/18/2014 10:20 am


Teach Pixy an Object

Teaching Pixy an object is super easy, but first let's talk about which objects will work well with Pixy. Pixy uses a hue-based color filtering
algorithm to detect objects. Since Pixy uses hue (color), the object needs to have a distinct hue. Here are some objects that are good because
they have good, distrinct hues.

** **

Here are some bad objects because either there is no hue (black, white or gray) or the hue is not distinct.

**

**

Keeping these guidelines in mind, choose an object to teach Pixy. (Apply power to Pixy via battery or USB cable if you haven't already. When you power up Pixy, it will go through a series of LED flashes. Wait for the led to turn off before teaching Pixy.) Hold down the
button on top of Pixy. After about 1.5 seconds, the LED will turn on, first white, then red,
(then other colors), but when it turns red, release the button.

When you release the button, Pixy will enter what's called
"light pipe" mode, where the LED color is the color of the center pixels of Pixy's image frame.

  • quick video

Use the LED color as feedback to determine if your object is in the center of Pixy's image frame. When you are satisfied that the LED color
matches your object color) press and release the button, like you'd click your mouse. If Pixy determines that the hue of
your object is "good enough" (has enough color saturation), the LED will flash and you're done. Pixy has now "learned" your object
and will start tracking objects of the same color. If the hue is not good enough, the LED will simply turn off (no flashing) and Pixy will not have learned your object. If the LED doesn't flash, you might choose another object that has a better color saturation, or consult the Pixy troubleshooting section **.

Multiple Signatures

Pixy can learn up to seven color signatures. In the section above, we taught Pixy the 1st color signature by releasing the button when the LED turned red. If we had continued to hold down the button, the led would have turned, orange, yellow, etc. indicating the remaining color signatures. Here are the signatures in order:

  1. Red
  2. Orange
  3. Yellow
  4. Green
  5. Cyan (light blue)
  6. Blue
  7. Violet

These colors are not at all related to the hue of the object. The colors are used only to indicate the signature number. So, for example, signature 1 can be a yellow object, even though signature 1 is indicated by a red LED, and signature 2 could be a pink object even though signature 2 is
indicated by an orange LED.

Other Notes on Teaching

When you press and release the button to indicate that you're satisfied that the LED color matches your object color, Pixy will flash the LED, and the brightness of the flashing indicates the "goodness" of the hue of the object (how saturated). So bright flashing is good!

If you accidentally find yourself teaching signature 2 when you meant to teach signature 3, for example, just hold down the button until the LED turns off. This is how you tell Pixy to cancel teach mode.

White Balance

Some types of lighting (such as incandescent) have a reddish hue and others (such as fluorescent) have a bluish hue. The lighting can affect your color signatures. For example, if you teach an object under incandescent lighting and move into a room with fluorescent lighting, the color signature will likely no longer work as well. You can either re-teach all signatures or you can adjust the white balance.

When you first apply power to Pixy, it will spend the first 5 or so seconds determining the correct white balance to use. It will then disable automatic white balance. If you wish to readjust the white balance, hold down the button until the LED turns white and release. It happens quickly, so be prepared! Pixy is now in automatic white balance mode. You can hold a white sheet of paper in front of Pixy so Pixy can adjust the white balance. It only takes 2 or 3 seconds to adjust the white balance, after which you can press and release the button (like a mouse click) and you're done.