Into Physical Computing

One of the installations I’m currently building for the museum M in Leuven, is a large interactive wall, consisting of 4 projections next to eachother. The interaction is being triggered by detection of presence or movement.
The content is built around 12 objects from the archeology collection. Each object or artefact generates an associative stream of images, as if visualising a stream-of-consciousness.

The technology involved is quite complex. For the time being, it is a combination of motion or presence detection, Arduino (as a Physical Computing platform), Flash, …

one small step into the world of Physical Computing
one small step into the world of Physical Computing

The total width of the projection is ± 1280 x 4 pixels which mounts up to a whopping 5120 pixels horizontally.

Of course, as in every project, ‘things’ need to be sorted out:
Flash export is for example still limited to 2880 x 2880 pixels. I’d hoped for changes with CS4, but alas. Scaling the exported swf to the required resolution is a no go, as not all the visuals will be vectorbased.
The compromise is to use 2 Flash files next to eachother, and use “localConnection” to have the 2 files communicate.
If intermovie communication is necessary in the final product, implementing “localConnection” will be the way to go.

Then there is/was the choice of sensors.
After quite a bit of reading and experimenting, I decided upon using the Ping))) Ultrasonic Range Finder.

The code I’m using now is based upon David Cuartielles Arduino sketch that I expanded with code that I found in the arduino playground: http://www.arduino.cc/playground/Main/UltrasonicSensor and that converts the value of the ultrasound echo into centimeters!  (Thank you Jason Ch!!)

As I’m using several sensors as physical input, I collect the separate readings of the sensors in one string, the different readings separated by a comma.
Here is the Arduino sketch (this sketch is  for 2 ultrasonic sensors:  multiply when using more sensors)

unsigned long echo_01 = 0;
int ultraSoundSignal_01 = 7; // Ultrasound signal pin
unsigned long ultrasoundValue_01 = 0;
unsigned long echo_02 = 0;
int ultraSoundSignal_02 = 8; // Ultrasound signal pin
unsigned long ultrasoundValue_02 = 0;
void setup()
{
Serial.begin(9600);
pinMode(ultraSoundSignal_01,OUTPUT);
pinMode(ultraSoundSignal_02,OUTPUT);
}
unsigned long ping_01(){
pinMode(ultraSoundSignal_01, OUTPUT); // Switch signalpin to output
digitalWrite(ultraSoundSignal_01, LOW); // Send low pulse
delayMicroseconds(2); // Wait for 2 microseconds
digitalWrite(ultraSoundSignal_01, HIGH); // Send high pulse
delayMicroseconds(5); // Wait for 5 microseconds
digitalWrite(ultraSoundSignal_01, LOW); // Holdoff
pinMode(ultraSoundSignal_01, INPUT); // Switch signalpin to input
digitalWrite(ultraSoundSignal_01, HIGH); // Turn on pullup resistor
echo_01 = pulseIn(ultraSoundSignal_01, HIGH); //Listen for echo
ultrasoundValue_01 = (echo_01 / 58.138) ; //convert to Centimeters
return ultrasoundValue_01;
}
unsigned long ping_02(){
pinMode(ultraSoundSignal_02, OUTPUT); // Switch signalpin to output
digitalWrite(ultraSoundSignal_02, LOW); // Send low pulse
delayMicroseconds(2); // Wait for 2 microseconds
digitalWrite(ultraSoundSignal_02, HIGH); // Send high pulse
delayMicroseconds(5); // Wait for 5 microseconds
digitalWrite(ultraSoundSignal_02, LOW); // Holdoff
pinMode(ultraSoundSignal_02, INPUT); // Switch signalpin to input
digitalWrite(ultraSoundSignal_02, HIGH); // Turn on pullup resistor
echo_02 = pulseIn(ultraSoundSignal_02, HIGH); //Listen for echo
ultrasoundValue_02 = (echo_02 / 58.138) ; //convert to Centimeters
return ultrasoundValue_02;
}
void loop()
{
int x_01 = 0;
x_01 = ping_01();
Serial.print(x_01);
//insert a comma to separate the readings
//in Flash you can generate an array from this string
Serial.print(',');
int x_02 = 0;
x_02 = ping_02();
Serial.print(x_02);
Serial.println(0, BYTE);  // necessary for being able to read the data in Flash!!!
delay(100); //delay 1/4 seconds. // set slower to 1000 e.g. depending on the needs
}

Another issue in the Arduino-Flash communication is that the Arduino board does not communicate directly with Flash. In contrast to programmes such as Processing or Max/MSP, you need a socket that transfers the serial data from the Arduino board to Flash.
A solution that works fine for me is the Java applet “Serial Server”, handling the serial communication in the background.

(Screenshot to be inserted)

Explaining the Flash part will be for another day.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s