Project tutorial
pixy cmuCAM + Arduino

pixy cmuCAM + Arduino

A quick and simple guide on how to easily connect your Arduino to the pixy cmuCAM!

  • 25,364 views
  • 9 comments
  • 19 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
the micro controller.
×1
Pixy
The camera.
×1

Necessary tools and machines

Pixy Library
You can download the files from the wiki. Just look below the picture and a download link will be there.

Apps and online services

pixymon
the download link is below the USB cable picture.
Ide web
Arduino IDE
You need this to program your Arduino.

About this project

This is my first Guide, so bear with me!


Here is a video.  This is also my first video.  Lots of firsts today!  Sorry if the quality isn't that great.  (I didn't script this either, obviously)


In this guide, I will show you how to hook up and code your Arduino to connect to your Pixy!  The first thing you want to do is gather the materials.



1) Arduino Uno (or other board, as long as it has an ICSP breakout.)

2) Pixy cmuCAM (I got mine from amazon, but you can find yours in other places)

3)Arduino IDE (to program the Arduino board)

4)Arduino Pixy Library (This is important, your code wont work without this)

5)Pixymon (to set signatures and view what the camera is seeing)

I included the links to everything in the description


Step 1: Installing the software.

First, go to the website I provided for Pixymon and download it.  When it is finished, install it.  If the installed program has a picture of a purple dinosaur, it worked.


  < the dinosaur


You also need to download the Arduino IDE and the library.  

Once you have the Arduino IDE program working.  Then go to Sketch>Include Library> Add .zip Library and choose the library you downloaded earlier.


Step 2: Preparing the Pixy and the Arduino


Open the Pixymon program from step 1, and connect your pixy to the computer. It should take a couple of seconds to start.


Now its the fun part!


Find a nice, colorful object that you are sure is not similar to the colors around you.  (I used a bright pink ball for mine)

My pixy and colorful object

Now, go to action>set signature one.  hold the object in front of the cam and click the link.  Your screen should freeze.  Then take your mouse and select the object.  Now if you hold the object in front of the pixy it should register as signature 1.

This is a screen shot from the pixy.  Yours should have a highlight around your object, but mine disappeared as I uploaded the Picture.  sorry about that.

For the final configuration, go to configure>PixyMon Paramers and change runprogArg 8 1 to runprog 0.  This will make the camera start up with the regular mode.  If you want to see the video feed with the signitures, change the video to raw or cooked mode.  


Step 3: Set up Arduino and Pixy

Here are some pictures.  This part is probably the quickest and the easiest.

Gather the Arduino and the cable that came with the Pixy cam
Next plug in the cable to the breakout.  Make sure that the red part faces the word UNO.
Finally, plug in the Pixy cam.

Step 4: Uploading  and running the code.


Now plug in the Arduino.  Both the Pixy cam and the Arduino should turn on.


If you plugged something in backwards, don't worry.  Just unplug the Arduino and flip it around and you should be fine.

Now open the Arduino IDE and go to File>Examples>Pixy and open the hello world file. If you cant find it, the code is in the code section below.


Now the last part is to load it to the Arduino.  When that is done, open the Serial monitor and hold your object in front of the cam.  It should say the X, Y, Height, and Width.  

Congradulations!!  You just connected your Arduino to your Pixy!

Code

Pixy Hello_World codePlain text
//
// begin license header
//
// This file is part of Pixy CMUcam5 or "Pixy" for short
//
// All Pixy source code is provided under the terms of the
// GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html).
// Those wishing to use Pixy source code, software and/or
// technologies under different licensing terms should contact us at
// cmucam@cs.cmu.edu. Such licensing terms are available for
// all portions of the Pixy codebase presented here.
//
// end license header
//

/* 
   06.04.2014 v0.1.3 John Leimon
     + Now using pixy.init() to initialize Pixy in setup().
*/

#include <SPI.h>  
#include <Pixy.h>

Pixy pixy;

void setup()
{

  Serial.begin(9600);
  Serial.print("Starting...\n");

  pixy.init();
}

void loop()
{ 
  static int i = 0;
  int j;
  uint16_t blocks;
  char buf[32]; 
  
  blocks = pixy.getBlocks();
  
  if (blocks)
  {
    i++;
    
    if (i%50==0)
    {
      sprintf(buf, "Detected %d:\n", blocks);
      Serial.print(buf);
      for (j=0; j<blocks; j++)
      {
        sprintf(buf, "  block %d: ", j);
        Serial.print(buf); 
        pixy.blocks[j].print();
      }
    }
  }  
}

Schematics

There is no schematic, but here is picture
Snapshot 20150611 9

Comments

Similar projects you might like

Auto-Turret with Pixy and Nerf Gun

Project tutorial by RobotGeek Projects Team

  • 5,910 views
  • 0 comments
  • 21 respects

OSEPP LCD and keypad shield

Project tutorial by Joe

  • 39,051 views
  • 27 comments
  • 50 respects

Lcd Display in Real Time.

Project tutorial by Youssef Sabaa

  • 21,437 views
  • 5 comments
  • 48 respects

LED Blink Pattern

Project tutorial by Matt Arnold

  • 30,338 views
  • 14 comments
  • 84 respects

Arduino and AC Devices - Automatic Lights

Project tutorial by Ahmed Hamdy

  • 22,284 views
  • 8 comments
  • 50 respects

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 17,292 views
  • 4 comments
  • 34 respects
Add projectSign up / Login