Arduino Meets Pixy

How-To Get Up & Running Flying Pixy! Ardu_Serie#76

J3
Jungletronics
6 min readMar 27, 2019

--

Pixy: What is it?

It’s a little vision sensor that made it’s IPO at a successful Kickstarter campaign in 2013.

Pixy CMUcam5

With Pixy, you can quickly teach it to find objects, and it connects directly to Arduino and other controllers (it was Created by Charmed Labs and Carnegie Mellon).

In this post, we will connect Pixy with Arduino UNO Rev3 using PixyMon and see results on the Arduino’s serial monitor; at the end, you will feel like a true pilot of an attack airplane hunting red enemies… oops balls, more precisely :b

Here you track two red objects of different sizes and the PixyMon makes you think that you are in front of a control panel of an Embraer EMB 314 Super Tucano (a Brazilian turboprop light attack aircraft); The geometric figure represents the perspective of the camera’s point of view

Let’s fly together, higher every time :D

1º Step Connect IDC Pixy Cable into Arduino’s ICSP pins

To get Pixy and Arduino talking to each other, use the supplied IDC 2 ICSP Arduino cable to connect Pixy to your Arduino;

Connect IDC Pixy into Arduino ICSP pins, this version is ready to Pixy LEGO =)

2º Step — Connect Mini B USB Cable to Pixy;

Connect Mini B USB Cable to Pixy

3º Step — Connect everything to two 2.0 USB Ports direct on your computer so that Pixy and Arduino are powered by USB’s force;

Plug everything into two USB ports on your computer

4º Step — Install PixyMon now!

PixyMon allows you to configure Pixy and see what it sees;

5º Step — Configure Pixy in PixyMon

With Pixy plugged via IDC to Arduino’s ICSP pins and both USB connected on your computer, click on Icon Config (1) > Pixy Parameters (2)>Signature Labels (3) and write down these three colors: red, yellow and orange as the figure below; then click ok;

Presetting signature slots for later teach Pixy these 3 color's names

6º Step—-Go to Config(1), Pixy Parameters tab (2) and choose SPI Interface(3) like this figure below (hey, I2C and UART are not used here; these remain in its default values);

=>Data out port: Arduino ICSP SPI ;

I2C address : 0x54

UART baud rate: 19200

IDC cable and ICSP SPI Interface

7º Step — Teaching Pixy: Grab three object: one red, other yellow and another orange and position them in front of the camera; make sure you get the best focus and light (the image are low resolution);

8º Step — Now go to Menu Action > Set Signature #1

Put 3 images in from of Pixy in order to teach it colors’ recognition

9º Step — Select a region from the red figure and release the right mouse button making a rectangular shape inside it; now red must be shown on the screen;

10º Step — Repeat the previous procedures for the yellow and orange; choose Set Signature #2 for yellow & Set Signature #3 for orange, in these right orders ;)

11º Step —Finally go to Config > PixyMon Parameters (1)> General tab and choose under Cooked render mode (2) as boxes only; this let us get rid of the pixels and emphasize the edges of the captured figure; see below;

Now we are ready to go to Arduino IDE!

12º Step — Open Arduino IDE (mine is 1.8.5), Go to Sketch > Include Library > Add .ZIP library… and choose, at this page, this file lib 4 win10 (or Mac:)-> arduino_pixy-x.y.z.zip;

Download Here The Lib For Your Platform

Extract the files into the Arduino/libraries folder.

Quit the Arduino IDE and open it again and voilà, you’re done!

13º Step — Load on Arduino IDE 1.8.5, File > Examples > Pixy > hello_world example and maintain the baud rate to 9600 as the default value:)

Run Pixy hello_word example

14º Step —Run Arduino hello_world sketch together with PixyMon, fire Arduino’s serial monitor, side-by-side with PixyMon; this button (Display Cooked/Processed/Video) must be unable:

15º Step — To see the (2) data on Arduino’s serial monitor disable the Display Cooked Video by clicking on (1) Default Program button:

Note, this example will only print messages if Pixy is running the default program and an object that matches one of its color signatures is visible, in this case, red and 2 objects were detected :)

For your references here are the rough measurements of my table triangle:

Congratulations! Your Pixy is talking to YOUR Arduino right now!

Now, just relax, you are on the shape to see these bonus instructions on these videos;

The first videos explore how the lighting configurations affect Pixy’s readings:

PixyMon: Light Changes

This video tells you about cooker modes:

PixyMon: Cooker Modes

And finally, the last video makes some experiments as if you were an airplane pilot: Super Tucano’s dashboard at your disposal! Get boarded now!

PixyMon: LAB I (in english)

PixyMon: LAB I (in portuguese)

See website hackaday words about this camera:The CMUcam5 “Pixy” (also funded on Kickstarter) shipped in 2014 had a clever demo mode. Out of the box, it had the ability to recognize colors that were held in front of it, and even had headers for hobby servos to be used in a pan/tilt configuration. This allowed the camera to be trained to track a color, then move to follow that color, all without involving a computer. It was also possible to view raw or processed video, but that required connecting to a laptop or desktop by USB and running a program unique to the Pixy in order to access video and configuration. The ability to “see what the camera sees” was a great feature that made setup and troubleshooting much easier, even if it was limited.

And that’s all, folks!

Thank you for being here!

Till the next episode on Jungletronics;

We’re gonna focus on LEGO MINDSTORM on Kidstronics soon. Be tuned! o/

Related Post

16° Lego Meets Pixy Episode — How to Connect Your Inexpensive Camera Module to Lego — Episode #16

References & Credits

Pixy (CMUcam5) Index from https://docs.pixycam.com

Pixy Quick Start from https://docs.pixycam.com

Hooking up Pixy to a Microcontroller (like an Arduino) from https://docs.pixycam.com

About Pixy from https://docs.pixycam.com

CMUcam5 (Pixy) Schematic ver 1.2

Teach Pixy an Object from https://docs.pixycam.com

Introducing Pixy2 from https://docs.pixycam.com

Powering Pixy from https://docs.pixycam.com

Connecting to a Microcontroller like an Arduino from irlock.com

Tracking Objects with Pixy Visual Sensor on Raspberry Pi using Windows 10 IoT Core from https://www.codeproject.com

UPS Tests Residential Delivery Via Drone from youtube

--

--

J3
Jungletronics

Hi, Guys o/ I am J3! I am just a hobby-dev, playing around with Python, Django, Ruby, Rails, Lego, Arduino, Raspy, PIC, AI… Welcome! Join us!