Skip to content
Gottfried Haider edited this page Oct 19, 2015 · 116 revisions

Introduction

The original Raspberry Pi contained an ARMv6 CPU, 256 or 512 MB RAM, and Broadcom VideoCore IV graphics. The Raspberry Pi 2 contains a quart-core ARMv7 CPU, 1 GB of RAM, and the same graphics as the original Pi.

Both primarily run a modified version of the Debian Linux distribution named Raspbian that was made to run on the ARMv6 CPU (and higher).

On the Pi 2 it is also possible to run other unmodified Linux distributions, such as Debian or Fedora, since those settled on the ARMv7 architecture as their "baseline" for modern ARM support. Yet on those distributions you might not have the necessary kernel modules and graphics library to make full use of the Pi's peripherals. This page thus specifically talks about running Processing on Raspbian, on either the Pi or the Pi 2!

Graphics

The Pi's graphics core exposes OpenGL ES 2.0, which is supported by Processing P2D and P3d renderer, thanks to specific enablement in the underlying library, JOGL. The graphics driver are built around a closed-source driver (found in /opt/vc), which limits our ability to troubleshoot bugs for the moment.

There is also an open source Mesa driver for the graphics core in development, which will implement full (desktop-level) OpenGL 2.0, but for the moment this is still work in progress.

Hardware I/O

Processing has a new Hardware I/O library that was extensively tested with the Pi.

GPIO

There is no special configuration necessary to use the digital pins with digitalRead(), digitalWrite() etc.

Keep in mind that the Pi uses 3.3V level, rather then the 5V of the Arduino Uno. The pins are said not to be 5V tolerant, so make sure to keep your voltages to 3.3V.

Each pin is rated up to 16 mA per pin, with 50 mA total, across all pins. (The Arduino UNO is 20 mA @ 5V per pin.) Make sure not to draw more.

The Hardware I/O library's GPIO class uses GPIO numbers with its methods. Those are not the same as the physical pin numbers of the pin header. (see pinout) You can use the special RPI class to use physical pin number in your sketch: e.g. pin 7 on the header can be addressed by RPI.PIN7 instead of (GPIO) 4.

I2C

The Pi has one (publicly exposed) hardware I2C interface. To use it in Processing (with the I2C class in processing.io), open the Raspberry Pi Configuration (under Menu, Preferences), navigate to the Interfaces tab, enable I2C and then restart your Pi.

After restarting, I2C.list() should return one interface: e.g. i2c-1 on the Pi 2. The interface is located on pins 3 (SDA) and 5 (SCL) on the Pi's header. (see pinout) Ground is conveniently located right next to it, on pin 6. Use it together with the 3.3V supply on pin 1, since that is the level that the Pi expects.

LEDs

SPI

The Pi two hardware SPI interfaces, but which share all but the SS (Slave Select) pins. To use it in Processing (with the SPI class in processing.io), open the Raspberry Pi Configuration (under Menu, Preferences), navigate to the Interfaces tab, enable SPI and then restart your Pi.

After restarting, SPI.list() should return two interfaces spidev0.0 and spidev0.1.

The interfaces' pins are located on the Pi's header on pins 19 (MOSI), 21 (MISO), 23 (SCLK), 24 (SS, aka CE0) and 26 (SS, aka CE1). (see pinout) When using spidev0.0, pin 24 (CE0) is being pulled low during a transaction, while pin26 (CE1) remains unchanged. When using spidev0.1, pin 26 (CE1) is being pulled low, while pin24 (CE0) remains unchanged. (This is to be able to address two devices on the same data & clock lines.)

PWM

Serial

Clone this wiki locally