Introduction

This page documents the process of setting up the required parts of our system image from scratch for learning or other purposes. This might also be useful for people who want to incorporate the settings and libraries to use the hardware of the PiShield on their existing system without having to burn our image. In general, it is always good to verify the source of a Raspberry Pi image before you burn and run it, as there isn’t a direct way of checking for malicious code that may be added by the creator of the image!

Overview of Image

The system is based on Raspbian, with SPI and I2C enabled. Apart from these basic settings, all other functionality is provided by the installation of various libraries and applications. It would be possible to use another Raspbian-based system (such as minibian for example), but you might find that additional packages may be required (install them via apt-get). The current downloadable version is based off the May 2016 version.

Basic Raspbian Configuration

First, make sure the apt-get repos are up to date, and then perform a dist-upgrade:

sudo apt-get update
sudo apt-get dist-upgrade

Then, run sudo aspi-config and go into the “Advanced” menu to enable I2C and SPI. The GPU split should be 192MB if using video related work. At the same time, if you’re compiling openFrameworks on a system with 512MB of RAM, you may have to reduce the memory given to the GPU when compiling the main library as the compilation process will run out of memory.

By default you may want to add the following packages via apt-get:

sudo apt-get install i2c-tools libi2c-dev wiringPi libasound2-dev automake libtool fbi screen 

Once the I2C tools and wiringPi are installed, you can test the hardware by running the command-line examples.

Python Setup

Python should be installed automatically, but to make full use of the PiShield features, the following packages should be installed:

sudo apt-get install python-dev python-smbus python-spidev

Additionally, you might want psutil, pykeyboard, pyOSC for the python example applications. The basic AnalogRead8.py can be used to test the A2D converter.

node-red

There are a number of versions of node-red installs, and while there is a default one included with Raspbian, it is quite outdated. It would be recommended to uninstall both nodejs and node-red via apt-get first.

Then, your choices are to either download the latest one and compile from source (takes a while), or to download a binary installer from the official repositories. The official node-red documentation contains installation instructions for first installing node.js, and then node-red via npm that is included with node.js. Note that the instructions are slightly different for armv7 (Pi2/3) devices and the older ones. Keep in mind that if you need cross-Pi compatibility, it may be a good idea to install the armv6 version. Once installed, your node-red folder should be located at ~/.node-red, and here is where you should run any npm commands to install additional modules.

openFrameworks

openFrameworks runs quite well on the RPi. For compatibility reasons is easier to use the armv6 version. To download and compile the library follow the official instructions here. Once compiled and the built in example apps are running, you can try putting our test app into the apps folder and compile + run it. Note that you will need to have the wiringPi library installed, which should have been done previously.

Other Utilities

Most source code are placed in the ~/dev folder, and includes:

Headless Wifi Config for older Jessie Images

Since the May 2016 version of Raspbian, if a copy of wpa_supplicant.conf is placed in the /boot partition (easily accessible when inserting the SD card into Windows or Macs), the next time the Pi boots it will overwrite the existing wifi credentials with this one. It is a great way to input the login info, and is the method provided in our preconfigured image. However, if you’re running an older version, you can set up similar behaviour using the following steps:

  • edit /etc/network/interfaces:
    allow-hotplug wlan0
    iface wlan0 inet dhcp
    wpa-conf /boot/wifi.conf
    
  • then add to /boot/wifi.conf:
    network={
    ssid="Your_SSID"
    psk="WPA_PASSKEY"
    id_str="Home Wifi"
    }

Since Nov 2016, ssh is disable by default in Raspbian, and it is necessary to put a file called ssh into /boot to enable it.