« Previous - Version 3/47 (diff) - Next » - Current version
Rich LeGrand, 02/19/2014 11:39 am

Hooking up Pixy to a Microcontroller like an Arduino

Pixy is meant to talk to a microcontroller, and Pixy comes out of the box ready to talk to an Arduino. Use the supplied Arduino cable to connect Pixy to your Arduino.


Now import the Pixy library ** by selecting Sketch->Import Library... in the Arduino IDE, and then browsing to the Pixy.zip file.

Next, load the "hello_world" example by selecting it in File->Examples->Pixy. Upload it and bring up the Serial Monitor. You should see messages printed that look similar to this:

Detected 1:
  block 0: sig: 1 x: 159 y: 109 width: 61 height: 61
Detected 1:
  block 0: sig: 1 x: 173 y: 114 width: 60 height: 61
Detected 1:
  block 0: sig: 1 x: 146 y: 111 width: 70 height: 65
Detected 1:
  block 0: sig: 1 x: 149 y: 104 width: 69 height: 64

Note, the example will only print messages if Pixy is running the "default program" and an object that matches one of its color signatures is visible.

Other Microcontrollers

Pixy will output objects that it finds through one of several interfaces that you choose. It supports SPI, I2C, UART, and analog/digital I/O through its 10-pin I/O connector. And Pixy supports USB 2.0 through its mini-USB connector. You can configure which interface Pixy uses through the configure dialog in PixyMon. The "Data out port" parameter determines the output port.


If you hover the mouse pointer over the "Data out port" text, a help string will be displayed that describes which value corresponds to which type of port.

  • SPI - this is the default port that uses 3 wires (pins 1, 3, and 4 on the I/O connector) and is used to communicate with Arduino
  • I2C - this is an 2-wire port (pins 5 and 9) that allows a single master to communicate with up to 127 slaves (up to 127 Pixys).
  • analog/digital x - this will output the x value of the largest detected object as an analog signal between 0 and 3.3V (pin 3) and whether an object is detected or not as a digital signal (pin 1 of the I/O connector).