Table of Contents

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:

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.

c915bad8138d82804e0f7f1360e4bbb54877be2f.jpg

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.

f3e7d4db3cdd88a0b0271ecee6465a8c3ec70a31.jpg

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.

0ba4d834c473bc80612ef7d56b16f651885e1359.jpg

0f3cc1187a5d1786ac8475c3593760ca12faf4f4.jpg

2.1.4. Insert NOOBS SD Card

fb504ec6eb8315298494cb0af421c2f1a7b0cd1b.jpg

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.

3813c1ec648f985df1feb6dc07532fc5396cd02d.jpg

Click the 'Yes' button to confirm installing.

c2c578b0804acf6d6de033b52a674c81f463ebd1.jpg

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

ce2a12811782166aab553eeb45c023b5278056b6.jpg

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

60475cf88d2bc03143339e1526fe3f4671bb9511.jpg

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

dc100ed14d7353cd103fbee235d9459b39f847f6.jpg

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

03b03c074fa339660ba61dce1662da34476ae320.jpg

Select 'Finish' to exit the configuration menu.

796d1759f69b82f172558c9c1b92238d9a8e412c.jpg

Select 'Okay' to reboot.

7fc275462ba3c4b1b4e9ee2a5b2a5a0c29c605ff.jpg

2.3. Software Dependency Installation

From the Raspberry Pi desktop, start the LXTerminal application.

d8ffb7ac38d09d2f5f35ab1bb3d57dd582f0b736.jpg

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