running the “Default
outputs the location of
the centroid (center of
the block) in which
PIXY has detected your
color. If you are still in
pixymon, that screen
will look like Figure 4.
Figure 5 shows
the red (ID 1) and
green (ID 2) colors I
“taught” PIXY to track.
This view is the
“Processed” video image where the
PIXY data is overlaid on the actual
3. Setting up an Arduino to use
the tracking data from PIXY.
Remember that bit about
Googling to find how someone may
have solved all or some of what you
need? Well, the CMUcam folks nicely
provide a demo program to show you
how to get tracking data from a PIXY.
Remember, your PIXY must be the
“default program” mode for this to
The Arduino sketch I provided has
one customized hack to the original
“hello_world” sketch. I specify to only
display a “hit” when the width and
height of a block is more than 10x10.
I did this because I kept getting
“echoes” of color detections from my
shirt. Yeah, I hacked the program to
avoid changing my shirt. It was
Before you can use this sketch,
you need to put the pixy library
m5/wiki/Latest_release) into your
library folder for the Arduino IDE
environment), or — in my case — the
UECIDE library. This will give you the
pixy objects and example code, like
the source code in Listing 1.
After you have trained your PIXY,
attached it to your Arduino, and
downloaded the “hello_world” sketch,
You can get your robot to chase
your programmed color by using the
X/Y and width/height block data.
Turn your robot to follow the X
coordinate. Typically, if the Y
coordinate is to the bottom, the
object is further away; higher up
means it is closer. Similarly, the
width/height of the block will be
larger if the object is closer.
I have proven my hardware and
training on an Arduino. Now, I need
to interface to the chipKIT Max32. I
cannot use the same cabling because
the Max32 puts 3.3V out on the SPI
connector and the PIXY needs 5V.
More on this next time as I solve
the voltage level interfacing problem.
Now the Teaser ...
Don’t forget the USA Megabot
Mech challenge to Japan’s Kuratis is
coming up soon! Just Google these
names. They are all over the techie
Well, that’s it again for another
month. I hope you were inspired, and
go out and make something new and
fun for yourself!
As usual, keep those questions
coming to roboto@servomagazine
.com and I’ll do my best to answer
SERVO 07.2016 13
The Easiest Way
to Design Custom
Front Panels &
; ; ; Cost effective prototypes
and production runs with
no setup charges
; ; Powder-coated and
anodized finishes in
; ; Select from aluminum,
acrylic or provide your
; Standard lead time
in 5 days or express
manufacturing in 3 or
You design it
to your specifications using
our FREE CAD software,
Front Panel Designer
We machine it
and ship to you a
professionally finished product,
no minimum quantity required