Pixy2 Smart Vision Camera

The Pixy2 Smart Vision Camera is a small camera designed for object recognition, line tracking, and simple barcode reading. Pixy2 can be trained to detect the types of objects your robot is interested in detecting.

Pixy2 Smart Vision Camera

The Pixy2JavaAPI Java library from PseudoResonance allows WPI Library-based Java robot applications to access Pixy2 capabilities.

Supported Pixy Cameras

The Pixy2JavaAPI library only supports the Pixy2 camera; the older Pixy camera is not currently supported.

Supplying Power to Pixy2

As documented here, multiple methods exist to provide power to Pixy2.

At a minimum, Core Power must be supplied to Pixy2; in some cases, External Servo Power must also be supplied.

Core Power

Per Powering Pixy2 specifications, 140mA of regulated 5VDC power is required to ensure the Pixy2 camera electronics and microcontroller operate correctly. Since providing at least 10% additional current margin is generally recommended, a minimum of 155mA current should be provided.

When working with the VMX-pi, Pixy2 can be powered via a USB cable (capable of providing up to 500mA of power) or one of the CommDIO power pins (also capable of providing up to 500mA of power).

If you choose to use Pixy2’s pin #2 to provide 5V Core Power, consider the following points:

  • If connecting Pixy2’s #2 pin to the VMX-pi I2C connector’s power and ground pins, the VMX-pi CommDIO Voltage Selection jumper must be set to 5V, and the VMX-pi’s total external power supply capability of 500mA should not be exceeded if providing power to other devices as well.
  • As noted in the Powering Pixy2 page, Pixy2’s #2 (5V) and #6 (GND) pins are not reverse polarity protected, so it’s highly recommended to double-check the wiring before applying power, to avoid damage to Pixy2.
  • As described further below, if Pixy2 is configured to control external servos, the voltage and current provided on Pixy Pin #2 will likely be insufficient.
Pixy2’s Power/Signal Connector Block

External Servo Power

Pixy2 can also provide control for an external “pan” and “tilt” servo; the actual power requirements for these external servos. If External Servos are used, this power should be supplied via Pixy Pin #10 (Vin [6-10V]) [recommended] or perhaps via the Pixy2 USB connector.

Note that powering Pixy Pin #10 from VMX-pi is not supported, since it does not provide voltages higher than 5VDC.

Interfacing with the Pixy2 signals via I2C

The Raspberry Pi connected to the VMX-pi can communicate with Pixy via SPI, I2C, TTL UART, USB and via Analog Input.

This guide will discuss connecting Pixy2 to VMX-pi via I2C.

Connect Pixy2 to VMX-pi’s I2C port as follows:

VMX-pi I2C SDA <-> Pixy2 Pin #9

VMX-pi I2C SCL <-> Pixy2 Pin #5

VMX-pi I2C GND (-) <-> Pixy2 Pin #6

VMX-pi I2C Power (+) <-> Pixy2 Pin #2 [unless providing sufficient power to Pixy2 via USB or Pixy2 Pin #10]

Programming Pixy2

Using the Pixy2JavaAPI library to access Pixy2, there are several steps: