The goal has been to get the raspberryPi working with openFrameworks in order to measure the pulse of the participants during the “intimacy experiment” with the pulse sensor.
Conceptually, since this an experiment, here is the protocol: Touch Experiment Protocol and here is the questionnaire for before and after: Intimacy Experiment Questionnaire.
It’s been a long journey, but here is a step by step on how to get the raspberryPi working with openFrameworks, installing wiringPi to talk to the GPIO pins, and install the ofxPulseSensor addon. Big thanks to Ayo for the help here.

Working with the Pi setting up wiringPi and openFrameworks.

Testing out the pulse sensor to prepare it for the Pi.

Wiring the the breadboard to include the converter.

Accessing the GPIO pins.
Step by step:
1. Set up the SD card and create an image on your Pi http://www.raspberrypi.org/wp-content/uploads/2012/04/quick-start-guide-v2.pdf
2. Install openFrameworks on the card http://www.creativeapplications.net/tutorials/how-to-use-openframeworks-on-the-raspberrypi-tutorial/
This is the code we are using to snap a picture by keyPress, and save the images to the folder, in testApp.cpp. It took me a while to figure out that OF was complaining at first because I was using ofVideoGrabber.getPixels() that returns data with the type unsigned char *, whereas ofImage.saveImage() wants data of the type ofPixels. The confusing thing here was that ofPixels and unsigned char * are actually the same thing. So the workaround was to create a temporary ofImage, which has two versions of setFromPixels() which accept either ofPixels or unsigned char *, so we can call it with the data from getPixels() on the camera, and then save that out to a jpg.
#include “testApp.h”
//————————————————————–
void testApp::setup(){
camWidth = 320; // try to grab at this size.
camHeight = 240;
//we can now get back a list of devices.
vector<ofVideoDevice> devices = vidGrabber.listDevices();
for(int i = 0; i < devices.size(); i++){
cout << devices[i].id << “: ” << devices[i].deviceName;
if( devices[i].bAvailable ){
cout << endl;
}else{
cout << ” – unavailable ” << endl;
}
}
vidGrabber.setDeviceID(0);
vidGrabber.setDesiredFrameRate(60);
vidGrabber.initGrabber(camWidth,camHeight);
videoInverted = new unsigned char[camWidth*camHeight*3];
videoTexture.allocate(camWidth,camHeight, GL_RGB);
ofSetVerticalSync(true);
}
//————————————————————–
void testApp::update(){
ofBackground(100,100,100);
vidGrabber.update();
if (vidGrabber.isFrameNew()){
int totalPixels = camWidth*camHeight*3;
unsigned char * pixels = vidGrabber.getPixels();
for (int i = 0; i < totalPixels; i++){
videoInverted[i] = 255 – pixels[i];
}
videoTexture.loadData(videoInverted, camWidth,camHeight, GL_RGB);
}
}
//————————————————————–
void testApp::draw(){
ofSetHexColor(0xffffff);
vidGrabber.draw(20,20);
//vidGrabber.saveImage(¨stest.png¨);
}
//————————————————————–
void testApp::keyPressed (int key){
// in fullscreen mode, on a pc at least, the
// first time video settings the come up
// they come up *under* the fullscreen window
// use alt-tab to navigate to the settings
// window. we are working on a fix for this…
// Video settings no longer works in 10.7
// You’ll need to compile with the 10.6 SDK for this
// For Xcode 4.4 and greater, see this forum post on instructions on installing the SDK
// http://forum.openframeworks.cc/index.php?topic=10343
if (key == ‘s’ || key == ‘S’){
vidGrabber.videoSettings();
}
if (key == ‘p’) {
ofImage image;
image.setFromPixels(vidGrabber.getPixels(), vidGrabber.width, vidGrabber.height, OF_IMAGE_COLOR);
image.saveImage(“camera ” + ofGetTimestampString() + “.jpg”);
}
}
3. Install wiring pi through this tutorial http://wiringpi.com/download-and-install/ Follow all the instructions on the webpage and enter into terminal. The tutorial has en error: It prompts you to enter the wrong folder, where you actually need to cd wiringPi/wiringPi instead. Then in your projects config.make-file include the following line in the PROJECT LINKER FLAGS-section:
PROJECT_LDFLAGS=-Wl,-rpath=./libs
PROJECT_LDFLAGS += -lwiringPi
5. Copy the ofxWiringpi folder into your project src folder as well as your addons folder in openFrameworks
6. Include the #include wiring pi code from the basic example in your project testApp.ccp file
7. sudo make run
This is how far we’ve gotten without any problems.
8. Since the raspberryPi doesn’t take analogue input, you need to get an analogue to digital converter in order to get the data from the pulse sensor (see details in the tutorial below).
9. We added the pulse sensor by following this tutorial: https://github.com/patriciogonzalezvivo/ofxPulseSensor However, the wiring seems to be wrong, as the chip is put on backwards. So, we followed the schematic below instead. You can use this cross reference and make sure the pins are right: https://www.adafruit.com/datasheets/MCP3008.pdf

This is how far we got in testing.