Hooking up Pixy to a Raspberry Pi

1. Introduction

The following procedure outlines the steps required to build the 'hello_pixy' example on a Raspberry Pi using the Raspberrian disribution. The 'hello_pixy' example is a simple program that demonstrates how to read blocks and send commands to the Pixy over USB like PixyMon.

You will need:

  • SD Card with NOOBS 1.3.9 installed
  • USB Hub with at least three ports
  • Pixy updated to latest firmware (1.0.2)
  • libpixyusb version is 0.3

NOOBS is available from the Raspberry Pi website here: http://www.raspberrypi.org/downloads/

2. Procedure

2.1. Raspberry Pi Hardware Setup

2.1.1. Connect your Raspberry Pi to the Internet

Using an Ethernet cable, connect the Raspberry Pi to an internet source as shown below.

2.1.2. Connect your Raspberry Pi to a video display

Using an HDMI cable, connect the Raspberry Pi to a video display as shown below.

2.1.3. Connect Keyboard, Mouse, and Pixy to USB hub

The Raspberry Pi only has two USB ports, so a hub is needed to connect Pixy, a keyboard, and mouse simultaneously. Using the hub, connect your keyboard, mouse, and Pixy to the Raspberry Pi.

2.1.4. Insert NOOBS SD Card

2.1.5. Connect power to Raspberry Pi

2.2. Raspberry Pi Software Setup

2.2.1. Install Raspberrian

On first boot, NOOBS will display a list of install options for the Raspberry Pi. Select Raspberrian and click the install button.

Click the 'Yes' button to confirm installing.

The installer will begin installing Raspberry Pi system files. This will take some time.

When the installer is finished, click the 'OK' button to restart.

When the Raspberry Pi boots, the configuration menu will be displayed. Select the 'Enable Boot to Desktop/Scratch...' option.

Select 'Desktop log in as user pi at the graphical desktop' and select 'OK'.

Select 'Finish' to exit the configuration menu.

Select 'Okay' to reboot.

2.3. Software Dependency Installation

From the Raspberry Pi desktop, start the LXTerminal application.

2.3.1. Install libusb

In the terminal window type:

sudo apt-get install libusb-1.0-0.dev

2.3.2. Install libboost

In the terminal window type:

sudo apt-get install libboost-all-dev

2.3.3. Install cmake

In the terminal window type:

sudo apt-get install cmake

2.4. Install Pixy Source Code

In the terminal window type:

git clone https://github.com/charmedlabs/pixy.git

2.5 Build and install libpixyusb

2.5.1. Build the library

In the terminal window type:

cd pixy/scripts
./build_libpixyusb.sh

2.5.2. Install the library

In the terminal window type:

sudo ./install_libpixyusb.sh

2.6. Running the 'hello_pixy' example

2.6.1. Build the example

In the terminal window type:

./build_hello_pixy.sh

2.6.2. Run the example

In the terminal window type:

cd ../build/hello_pixy
sudo ./hello_pixy

The output should look like something below:

Hello Pixy:
Example Version: 0.3
Pixy Firmware Version: 1.0.2
Detecting blocks...
[sig: 1 w: 11 h: 17 x:149 y: 46]
[sig: 1 w: 9 h: 21 x:148 y: 46]
[sig: 1 w: 14 h: 21 x:151 y: 45]
[sig: 1 w: 10 h: 19 x:149 y: 47]
[sig: 1 w: 8 h: 16 x:148 y: 49]
[sig: 1 w: 9 h: 19 x:148 y: 45]
[sig: 1 w: 12 h: 6 x:150 y: 54]
[sig: 1 w: 15 h: 18 x:151 y: 46]
[sig: 1 w: 11 h: 5 x:149 y: 54]
[sig: 1 w: 9 h: 7 x:148 y: 49]
[sig: 1 w: 11 h: 5 x:149 y: 50]
[sig: 1 w: 8 h: 6 x:148 y: 47]
[sig: 1 w: 10 h: 7 x:149 y: 51]

The example does the following

  1. Connects to Pixy using USB
  2. Displays firmware version installed on Pixy
  3. Block information is displayed if color signatures have been set and if the signatures are currently being detected by Pixy.