Introduction
This project found it’s inspiration from the crowds at a stadium representing their favorite team by wearing the color of their jersey. How could this be an active part in a stadium and how can this translate into architecture?
The basic idea of this project is to redisplay the patterns, or randomness, or pure domination displayed by these crowds through architecture by using a media facade.
Conceptual representation
[vsw id=”149447837″ source=”vimeo” width=”1536″ height=”864″ autoplay=”no”]
The simulation shows how the author wants the display color to change brightness based on the distance of the person from the color sensor.
Hardware
- Arduino Uno
- Color sensor – TCS3200
- Laptop
- Connect arduino to a laptop.
- Upload the arduino code and close serial monitor.
- Open processing code.
- Keep a color paper near color sensor and press 1 to 4 keys on your keyboard to detect colors.
Code
Arduino
#include <Average.h> // See http://playground.arduino.cc/Main/Average int OUT=10,S2=12,S3=11,LED=13,S0=8,S1=9; // define TCS3200 pins void setup() { TCS3200_Setup(); Serial.begin (9600); } void loop() { GetColor(); delay(200); } void TCS3200_Setup() { pinMode(S0,OUTPUT); pinMode(S1,OUTPUT); pinMode(S2,OUTPUT); pinMode(S3,OUTPUT); pinMode(LED,OUTPUT); pinMode(OUT,INPUT); } void TCS3200_On() { digitalWrite(LED,HIGH); // Switch LED on digitalWrite(S0,HIGH); //Output frequency scaling (100%) digitalWrite(S1,HIGH); delay(5); } void TCS3200_Off() { digitalWrite(LED,LOW); // Switch LED off digitalWrite(S0,LOW); //Power off sensor digitalWrite(S1,LOW); } void NoFilter() { //Select no filter digitalWrite(S2,HIGH); digitalWrite(S3,LOW); delay(5); } void RedFilter() { //Select red filter digitalWrite(S2,LOW); digitalWrite(S3,LOW); delay(5); } void GreenFilter() { //Select green filter digitalWrite(S2,HIGH); digitalWrite(S3,HIGH); delay(5); } void BlueFilter() { //Select blue filter digitalWrite(S2,LOW); digitalWrite(S3,HIGH); delay(5); } void GetColor() { //0=white, 1=orange, 2=yellow, 3=red, 4=green, 5=blue, 6=object out of range float FrequencyClear,FrequencyRed,FrequencyGreen,FrequencyBlue; int PercentageRed,PercentageGreen,PercentageBlue; TCS3200_On(); NoFilter(); FrequencyClear=500.0/pulseIn(OUT,LOW,10000); // Frequency in kHz RedFilter(); FrequencyRed=500.0/pulseIn(OUT,LOW,10000); // Frequency in kHz GreenFilter(); FrequencyGreen=500.0/pulseIn(OUT,LOW,10000); // Frequency in kHz BlueFilter(); FrequencyBlue=500.0/pulseIn(OUT,LOW,10000); // Frequency in kHz TCS3200_Off(); //Output frequency blue, green, red percentage represents the ratio of the //respective color to the Clear channel absolute value: PercentageRed=int((FrequencyRed/FrequencyClear)*100.0); PercentageGreen=int((FrequencyGreen/FrequencyClear)*100.0); PercentageBlue=int((FrequencyBlue/FrequencyClear)*100.0); //Learned blue, green, red percentage values of different colors int SavedColorRed[] = {28,55,42,50,19,13}; int SavedColorGreen[] = {30,25,36,22,45,26}; int SavedColorBlue[] = {45,20,20,30,36,58}; int ColorArray[3]; int i_color; int ClosestColor; int MaxDiff; int MinDiff=300; if(FrequencyClear<1.5)ClosestColor=6; // Object out of range else { for (i_color=0; i_color<6; i_color++) { //Find closest color ColorArray[0]=abs(SavedColorRed[i_color]-PercentageRed); ColorArray[1]=abs(SavedColorGreen[i_color]-PercentageGreen); ColorArray[2]=abs(SavedColorBlue[i_color]-PercentageBlue); MaxDiff = max (ColorArray[0], ColorArray[1]); MaxDiff = max (MaxDiff, ColorArray[2]); if (MaxDiff<MinDiff) { MinDiff=MaxDiff; ClosestColor=i_color; } Serial.println (ClosestColor); } } }
Processing
import processing.serial.*; color[] pixel = new color[7]; color[] pixclr = new color[4]; int lf = 10; int Columns=16; int rows=10; int value; int b = Columns * rows ; int i =0; int[] colors = new int[4]; int[] number = new int[b]; String myString = null; Serial myPort; void setup() { frameRate(1); fullScreen(); randomSeed(1); myPort = new Serial(this, Serial.list()[1], 9600); myPort.clear(); myString = myPort.readStringUntil(lf); myString = null; } void draw() { pixel[0] = color (255,255,255); //white pixel[1] = color (255,110,0); //Orange pixel[2] = color (255,255,0); //yellow pixel[3] = color (255,0,0); //red pixel[4] = color (0,255,0); //green pixel[5] = color (0,0,255); //blue pixel[6] = color (0,0,0); // switch off pixclr[0] = pixel[colors[0]] ; pixclr[1] = pixel[colors[1]] ; pixclr[2] = pixel[colors[2]] ; pixclr[3] = pixel[colors[3]] ; stroke(255); strokeWeight(3); int CL = width/Columns ; int RL = height/rows ; for (int x=0; x<width; x = x+CL) { for (int y=0; y<height; y = y+RL) { for (int i=0; i<b; i++) { number[i] = round(random(0,3)); } fill (pixclr[number[i]],255); rect(x,y,x+CL,y+RL); } } } void keyPressed() { if (key == '1'){ while (myPort.available() > 0) { myString = myPort.readStringUntil(lf); if (myString != null) { value = int(myString.trim() ); colors [0] = value; println(value); } } } if (key == '2'){ while (myPort.available() > 0) { myString = myPort.readStringUntil(lf); if (myString != null) { value = int(myString.trim() ); colors [1] = value; println(value); } } } if (key == '3'){ while (myPort.available() > 0) { myString = myPort.readStringUntil(lf); if (myString != null) { value = int(myString.trim() ); colors [2] = value; println(value); } } } if (key == '4'){ while (myPort.available() > 0) { myString = myPort.readStringUntil(lf); if (myString != null) { value = int(myString.trim() ); colors [3] = value; println(value); } } } }
Prototype