# Web Enabled PIXEL on Raspberry Pi

## Overview

[The PIXEL kit from LED:ART consists of an RGB LED matrix, a IOIO Mint Bluetooth microcontroller to drive the matix, and some software to give instructions to the IOIO for what to display.](https://www.adafruit.com/product/1357)

Originally, only an Android and PC based software was available. &nbsp;Now, web based controls are available, via a Java application. &nbsp;Web based controls means that platforms with a modern browser are supported; iStuff, Android, PC, Tablet, and others. &nbsp;The Web applicaion is started from the command line.

Being able to run from the command line allows for use as a background service/daemon. &nbsp;This approch is also ideal for setting up headless envronments (no monitor attached to the mother board), where the hardware profile needs to be as slim as possible.

PIXEL comes pre-bundled with some still and animated images. &nbsp;On first run, the images are extracted to pixel/ under the user's home directory.

Once the hardware is assembled, and the software running, the PIXEL Web controls are availble to any computer on the same network as the Raspberry Pi.

Here is a video showing some of the available animations:&nbsp;

https://www.youtube.com/watch?v=aMMqp370_K0

# Web Enabled PIXEL on Raspberry Pi

## Hardware

## Required Hardware

- [Raspberry Pi](https://www.adafruit.com/products/1914 "Raspberry Pi")
- USB A-Male to A-Male cable
- [Pixel Guts](https://www.adafruit.com/products/1357 "Pixel Guts")

## Hardware for Networking (one or the other)

- [WiFi Module](https://www.adafruit.com/products/814 "WiFi Module")
- [Ethernet Cable](https://www.adafruit.com/products/730 "Ethernet Cable")

## Optional Hardware for Wearables

To go wearable/portable, power the Raspberry Pi and Pixel board with two lipo batteries and two Adafruit PowerBoots and corresponding USB&nbsp;adaptors:

- [PowerBoost](https://www.adafruit.com/products/2030 "PowerBoost")
- [LiPo Batteries](https://www.adafruit.com/products/328 "LiPo Batteries")
- [USB to USB Micro B cable](https://www.adafruit.com/products/1513 "USB to USB Micro B cable")&nbsp;(for powering the Raspberry Pi)
- USB to Barrel Jack Adapter (for powering the LED matrix)

**Note** : The Pixel started off as a Kickstarter which is version 1 of the product. &nbsp;Some version 1 Pixels were even in the Adafruit store. &nbsp;The Pixel software used in this guide is compatible with both the version 1 and version 2 models.

# Web Enabled PIXEL on Raspberry Pi

## Assembly

See the following links to get your Raspberry Pi and Pixel setup and connected to power, but don't give them power just yet.

- [Lean about using your Raspberry Pi](../../../../category/learn-raspberry-pi "Setup Raspberry Pi")
- [Read the PIXEL Guts](http://ledpixelart.com/downloads/PIXEL-Guts-Quick-Start-Guide.pdf "Pixel Guts") Quickstart guide

The last assembly step is to connect the Raspberry Pi to the Pixel, via a male-A to male-A USB cable.

![](https://cdn-learn.adafruit.com/assets/assets/000/021/981/medium800/led_matrix_IMG_20141231_095822-use.jpg?1420042826)

Now power up the Raspberry Pi and Pixel.

![](https://cdn-learn.adafruit.com/assets/assets/000/021/982/medium800/led_matrix_IMG_20141231_095958-use.jpg?1420042891)

# Web Enabled PIXEL on Raspberry Pi

## Software

The target platform for this project is Debian Linux; Raspbian/Ubuntu.

The application runs on Raspberry Pi and PC.

The Pixel software used in this guide is distributed as a executable JAR file (Java Archive). &nbsp;This means a recent version of the JVM is needed.

If you are using the lastest version of Raspbian, then a suitable JVM is already installed.

If you don't have at least Java 8 on the Raspberry Pi, then update and install it.

```
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install oracle-java8-jdk
```

Next, download the executable JAR file.

[pixel-web-enabled-0.0.1-SNAPSHOT-jar-with-dependencies.jar](https://learn.adafruit.com/system/assets/assets/000/026/192/original/pixel-web-enabled-0.0.1-SNAPSHOT-jar-with-dependencies.jar?1435773492)
Now send the JAR to the Raspberry Pi, using your favorite file transer method.

The&nbsp; **scp&nbsp;** command is an option for file transfer:

```
scp pixel.jar pi@raspberrypi.local:
```

or you can try from the Pi itself

**wget&nbsp;https://learn.adafruit.com/system/assets/assets/000/026/192/original/pixel-web-enabled-0.0.1-SNAPSHOT-jar-with-dependencies.jar?1435773492**

# Web Enabled PIXEL on Raspberry Pi

## Usage

## Starting the App

Run the Web application with the following command.

```
sudo java -jar pixel.jar
```

In the above command, 'pixel.jar' should be replaced with the actual name of the JAR file copied to the Raspberry Pi.

There are some command line switches to configure the application. &nbsp;See below for details.

Once the Java application is running from the command line, a bunch of lines scroll on the terminal showing connection messages. &nbsp;If it is the first run, then image resource extraction messages are also shown.

Next, visit the following URL.

[http://raspberrypi:8080/files/index.html](http://raspberrypi:8080/files/index.html)

The 'raspberrypi' in the above URL should be replaced with the host name (or IP address) of computer running the Pixel Web applicaton.

At the above URL, a user interface is presented with a drop down menu to change between Pixel modes.

## Scrolling Text

The scrolling text mode lets you enter some text, change scroll speed, and specify text color.

![](https://cdn-learn.adafruit.com/assets/assets/000/021/979/medium800/led_matrix_scrolling-text.png?1420028596)

## Displaying Stills and Animations

Still image mode presents the various images available for drawing on the Pixel.

Animations mode similarly presents the various animations available.

On the user interface for still and animated images, a 'Display' button is used to&nbsp;select what is shown on the Pixel's RGB LED matrix.

![](https://cdn-learn.adafruit.com/assets/assets/000/021/980/medium800/led_matrix_still-images.png?1420028621)

## **Uploads for User Supplied Animated GIFs and Still Images**

The user can upload their own still images and animated GIFs. &nbsp;The file chooser button is used to select a still or animated GIF, on the filesystem. &nbsp;Then click the upload button and it should appear in the corrosponding animated or still image list.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/189/medium800/led_matrix_uploads-capture.png?1435695648)

## **Save A**** nimations&nbsp; ****to SD Card**

In offline mode, an animation can be played from the SD card onboard the PIXEL. &nbsp;This means you can still have an animation play even if the Web enabled application&nbsp;is not running.

Use the 'Save' button to write an animation to the SD card for offline use.

![](https://cdn-learn.adafruit.com/assets/assets/000/026/190/medium800/led_matrix_save-to-sd-card.png?1435696282)

## Clock Mode

Clock mode presents an analog clock.

## Command Line Switches

The applicaton has these command line swithces:

# Web Enabled PIXEL on Raspberry Pi

## Going Further

## Create a Custom User Interface

A default user interface comes with the Web enabled Pixel app. &nbsp;It is available at:

http://rapberrypi:8080/files/index.html

A custom user interface to control Pixel can be made by posting to the following URLs, or Web API. &nbsp;Any programming language that can make HTTP requests can control the Pixel with this Web API.

## Scrolling Text

| 

http://rapberrypi:8080/text

 | 

change to scrolling text mode

 |
| 

http://rapberrypi:8080/text?t=some text to scroll

 | 

this will scroll ‘some text to scroll’ on the pixel

 |
| 

http://rapberrypi:8080/text/color/[hex-value]

  

example:

http://rapberrypi:8080/text/color/48301b

 | 

This sets the color of the scrolling text. &nbsp;The ‘hex-value’ given is used as the color.

 |
| 

http://rapberrypi:8080/text/speed/[delay-in-milliseconds]

example:  
http://rapberrypi:8080/text/speed/300

 | 

This sets the scroll delay in milliseconds.

 |

## Still Images

| 

http://rapberrypi:8080/still

 | 

Change to still images mode.

 |
| 

http://rapberrypi:8080/still/list

 | 

This URL returns a list of the available still images names. &nbsp;The image names are delimited by "-+-".

 |
| 

http://rapberrypi:8080/still/[image-name]  
  
examples:

http://rapberrypi:8080/still/Robot.png

http://rapberrypi:8080/still/Fireball.png

 | 

This writes the image denoted by the ID at the end of the URL. &nbsp;The ID is an integer that is used as an index into the still images available to the Web app.

 |

## &nbsp;Animations

| 

http://rapberrypi:8080/animation

 | 

Change to animations mode.

 |
| 

http://rapberrypi:8080/animation/list

 | 

same as still images but for animations

 |
| 

http://rapberrypi:8080/animation/[animation-name]

examples:

http://rapberrypi:8080/animation/arrows.png

http://rapberrypi:8080/animation/earth.png

 | 

same as still images but for animations

 |
| 

http://rapberrypi:8080/animation/save/[animation-name]

examples:

http://rapberrypi:8080/animation/save/arrows.png

http://rapberrypi:8080/animation/save/earth.png

 | saves an animation to the SD card, for offline playback |

## &nbsp;

## &nbsp;Static Files

| 

http://rapberrypi:8080/files/

 | 

static files are served from this URL context; HTML, CSS, JavaScript, image and animation previews

 |
| 

http://rapberrypi:8080/files/images/

examples:

http://rapberrypi:8080/files/images/Fireball.png  
http://rapberrypi:8080/files/images/Robot.png

 | 

previews for the still images are under this URL context

 |
| 

http://rapberrypi:8080/files/animations/  
  
examples:

http://rapberrypi:8080/files/animations/arrows.png  
http://rapberrypi:8080/files/animations/earth.png

 | 

previews for the animations are under this URL context

 |

&nbsp;

## &nbsp;

## Uploads

| 

http://rapberrypi:8080/upload/

 | 

Uploads a HTTP post with a mulit-part file attachment. &nbsp;

The name of the file parameter should be 'upload'.

The request parameter named 'upload-type' is expected to have the value of 'STILL\_IMAGE' or 'ANIMATED\_GIF'.

&nbsp;

 |

&nbsp;

## Analog Clock

| 

http://rapberrypi:8080/clock

 | 

Change to analog clock mode.

&nbsp;

 |

&nbsp;

## Modify the App

The source code for the Pixel application is on Github.

[https://github.com/alinke/PIXEL](https://github.com/alinke/PIXEL)

The recomened way to make changes to the application is with the [Netbeans IDE](https://netbeans.org/ "Netbeans IDE"). In Netbeans, open the directory where you cloned Pixel from Github. &nbsp;It will recognize and open a parent project labeled ' **onebeartoe-pixel**'.

The&nbsp;' **onebeartoe-pixel**' project has other projects listed under ' **Modules**'. Open the one labeled ' **pixel-web-enabled**'. &nbsp;And make any change that better fit your setup. &nbsp;The F6 key compiles and runs the app locally.

## Keep Up with Development Builds

More features are planned for the Web applicaiton for Pixel. &nbsp;Keep up with the development builds:

[https://onebeartoe.ci.cloudbees.com/job/pixel/](https://onebeartoe.ci.cloudbees.com/job/pixel/ "Development Builds for Pixel ")


## Featured Products

### PIXEL Guts Kit - Bluetooth Controlled 32x32 RGB LED Matrix Kit

[PIXEL Guts Kit - Bluetooth Controlled 32x32 RGB LED Matrix Kit](https://www.adafruit.com/product/1357)
Control a 32x32 LED matrix with your Android, PC, Mac, Linux, Raspberry Pi, or BeagleBone Black with the **Pixel Guts Kit V2.5**!&nbsp;Simply use PIXEL’s free apps and send images, GIF animations, scrolling text, Twitter feeds, and your own pixel art creations in minutes, no...
No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1357)
[Related Guides to the Product](https://learn.adafruit.com/products/1357/guides)
### Raspberry Pi Model B 512MB RAM

[Raspberry Pi Model B 512MB RAM](https://www.adafruit.com/product/998)
Adafruit ships the **Raspberry Pi Model B 512MB RAM** as of 10/18/2012.  
  
The Raspberry Pi® is a single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of stimulating the teaching of basic computer science in schools. The Raspberry...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/998)
[Related Guides to the Product](https://learn.adafruit.com/products/998/guides)
### Raspberry Pi Model B+ 512MB RAM

[Raspberry Pi Model B+ 512MB RAM](https://www.adafruit.com/product/1914)
OMG OMG OMG, did you hear? There's a Raspberry Pi&nbsp;called the Model B+ and check it out...more USB ports, more GPIO, better power supply, four mounting holes, less sticky-out SD card! Yep, that's right, the fantastic engineers at Raspberry Pi HQ have blessed us with a new design....

In Stock
[Buy Now](https://www.adafruit.com/product/1914)
[Related Guides to the Product](https://learn.adafruit.com/products/1914/guides)

## Related Guides

- [Using the BMP085/180 with Raspberry Pi or Beaglebone Black](https://learn.adafruit.com/using-the-bmp085-with-raspberry-pi.md)
- [LED Matrix Display for Bitmap Pixel Art and Animation](https://learn.adafruit.com/pixel-art-matrix-display.md)
- [Node.js Embedded Development on the Raspberry Pi](https://learn.adafruit.com/node-embedded-development.md)
- [Adafruit WebIDE](https://learn.adafruit.com/webide.md)
- [Cloud Cam: Internet-Connected Security Camera](https://learn.adafruit.com/cloud-cam-connected-raspberry-pi-security-camera.md)
- [Setting up a Raspberry Pi as a WiFi Access Point](https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point.md)
- [Nokia 5110/3310 LCD Python Library](https://learn.adafruit.com/nokia-5110-3310-lcd-python-library.md)
- [Bluetooth-Controlled Matrix LED Sign using Bluefruit Connect](https://learn.adafruit.com/bluetooth-controlled-matrix-led-sign-using-bluefruit-connect.md)
- [RGB LED Matrices with CircuitPython](https://learn.adafruit.com/rgb-led-matrices-matrix-panels-with-circuitpython.md)
- [Tiny Arduino Music Visualizer](https://learn.adafruit.com/piccolo.md)
- [Circle of Fifths Euclidean Synth with synthio and CircuitPython](https://learn.adafruit.com/circle-of-fifths-euclidean-synth-with-synthio-and-circuitpython.md)
- [Matrix Portal Flow Visualizer](https://learn.adafruit.com/matrix-portal-flow-visualizer.md)
- [Mini Raspberry Pi Handheld Notebook](https://learn.adafruit.com/mini-raspberry-pi-handheld-notebook-palmtop.md)
- [3D Printed Raspberry Pi A+ Case](https://learn.adafruit.com/3d-printed-raspberry-pi-a-plus-case.md)
- [PiGRRL 2](https://learn.adafruit.com/pigrrl-2.md)
