Yinzhen Bao :)

May 15, 2014

Digital Media Project: A Moonish Installation

Filed under: DigitalMediaProject,DMS8013,PersonalProject — yinzhenbhao @ 1:29 AM

Documentation of A Moonish Installation

Flashy Version (the version with ringing sound)


Creative Arts Practice for Digital Media Project 2014.

This interactive installation is controlled by Arduino and a USB camera, which captures the light status and ‘request’ the light by the way of ringing and changing colour of the rotatable flower randomly to attract participant’s attention if too much light is blocked on the top of the installation. It shows the opposite colour (i.e. white for the demand of dark and black is for the need of light source) in alternative light condition (dark / bright) that the installation can be captured, and impels the participant to response it as a part of the creation.

The code was programmed by Processing and Pure Data and outputted by two different visual forms through interaction. This installation was designed to invite participants to ponder the perception and interaction, immersion and embodiment, partial and the whole by digital arts throughout the interactive process.

—————————————————————————————————————-
Project Code:

Processing Part:

import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;

import processing.serial.*; // import the Serial library
Serial myPort;

Minim minim;
AudioPlayer sou; // variable name

float sensorValue;
float angle = 0;
int x = -142;
int y = -112;
int smallPoint, largePoint;

PImage img;

PShape SVG01;
PShape SVG02;
PShape SVG03;
PShape SVG04;
PShape SVG05;
PShape SVG06;
//PShape SVG07;
PShape SVG08;
PShape SVG09;
PFont font; // showing the sensorValue

void setup() {

// font = loadFont(“Serif-24.vlw”);
size(1300, 800);

// println(Serial.list()); // print a list of available serial ports
/* better way to print this
for (int i=0;i<Serial.list().length;i++) {
println(“[“+i+”]”+Serial.list()[i]);
}
*/

myPort = new Serial(this, “COM7”, 9600);
myPort.clear(); // Empty the buffer, removes all the data stored there.
myPort.bufferUntil(‘\n’); // Throw out the first reading, in case we started reading
// in the middle of a string from the sender. (start buffer Until “\n” is read)
smooth();
SVG01= loadShape(“img1.svg”);
SVG02= loadShape(“img2.svg”);
SVG03= loadShape(“img3.svg”);
SVG04= loadShape(“img4.svg”);
SVG05= loadShape(“img5.svg”);
SVG06= loadShape(“img6.svg”);
// SVG07= loadShape(“img7.svg”);
SVG08= loadShape(“img8.svg”);
SVG09= loadShape(“img0.svg”);
SVG51= loadShape(“img51.svg”);
SVG61= loadShape(“img61.svg”);
SVG81= loadShape(“img81.svg”);
}
void draw() {
background(255);
fill(0);
//textFont(font, 24);
// text(“sensorValue= “, width*0.3, height/2);
// text(sensorValue, width*0.55, height/2);
pushMatrix(); // save the current coordinate system to the stack
// translate to the center of screen
translate(width/2, height/2);
// rotate everything when the frameCount adds up
rotate(frameCount*0.01);

// small flower
if (sensorValue>300 && sensorValue<=400) {
fill(0, 180);
SVG09.disableStyle();
shape(SVG09, x+10, y+10, sensorValue+15, sensorValue+15);
SVG01.disableStyle();
shape(SVG01, x+10, y+10, sensorValue+15, sensorValue+15);
}
// bigger flower
else if (sensorValue>400 && sensorValue<=500) {
fill(0, 180);
SVG03.disableStyle();
shape(SVG03, x-20, y-20, sensorValue+20, sensorValue+20);
SVG04.disableStyle();
shape(SVG04, x-30, y-30, sensorValue+25, sensorValue+25);
}
// random colour
else if (sensorValue>500 && sensorValue<=700) {
//Audio is triggered
minim = new Minim(this);
sou = minim.loadFile(“ESA_installation.wav”);
sou.play();
fill(random(0, 100), random(0, 100), random(0, 100), 80);
SVG05.disableStyle();
shape(SVG51, x-60, y-60, sensorValue+60, sensorValue+60);
fill(random(100, 200), random(100, 200), random(100, 200), 150);
SVG06.disableStyle();
shape(SVG61, x-50, y-50, sensorValue+35, sensorValue+35);
fill(random(200, 255), random(200, 255), random(200, 255), 50);
SVG08.disableStyle();
shape(SVG81, x-60, y-60, sensorValue+40, sensorValue+40);
}

// else if (sensorValue>700 && sensorValue<=800) {
// fill(random(0, 100), random(0, 100), random(0, 100), 100);
// }
else {
fill(255, 150);
SVG08.disableStyle();
shape(SVG08, x+30, y+30, sensorValue+300, sensorValue+300);
}

popMatrix(); // restores the prior coordinate system
}

void serialEvent (Serial myPort) { // SerialEvent is called when data is available.
// get the ASCII string:
String inString = myPort.readStringUntil(‘\n’);
if (inString != null) { // only does the following when there is something
// convert to a float
sensorValue = float(inString);
}
}

Arduino Part:
void setup(){

Serial.begin(9600);
}
void loop(){

//Serial.println(sens);
Serial.println(analogRead(0));
delay(500);
}

Pure Data Part:pdGem

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress