Archive by Author

Final Project – Interactive LED Tent – Alexa Zyllo, Josiah Song

21 Dec

Image

Image

Image

Image

Our project was to build an interactive LED tent that explored the way we can change the experience of a space using the things we learned over the course of the class. The interactive tent is made up of two things, PVC 1/2″ piping and a Spandex/Rayon blend of fabric. Each pipe is 53″ long and was cut with a saw and sanded to get rid of any sharp edges left behind. The pipes were then put together with a 3 way pipe connector to form a cube (53″ x 53″ x 53″). After the cube was formed, the cloth was cut in a rectangle shape (60″ x 212″), and sewed to make a closed loop. After this loop was made, a square piece of cloth (53″ x 53″) was cut and sewed onto the loop to form an almost completely closed box. To insure the cloth would stretch right, little pockets were sewed into the bottom four sides (this is where the tubing went through). When the cube was completely constructed, a zipper was added to one side to allow people to enter and exit the cube.

After the construction of the tent, we strung up a string of 45 LEDs that went around the top, down one corner, and continued all the way around the bottom and connected to a power box. This in turn was connected to an Arduino and DMX shield, as well as four flex sensors that were hooked up to the tent (one on each side of the tent, attached at the top and center). The way that the tent worked was based on mapped analog value readings from the flex sensors. They were attached in such a way that when one pushed on the sides of the tent from the inside, the bottom tip of the sensor would bend outward up to about 45° and readings would depend on the degree of bending. The change in readings would correlate to changes in the color of the LEDs.

Each LED’s color is determined by a combination of a red, green, and blue value (RGB). We randomly assigned each sensor to be associated with alternating R, G, or B values along the string of LEDs. 45 LEDs meant 135 RGB values, and with up to 3 different sensors effecting one LED, the change in colors was quite drastic throughout the entire tent. The DMX shield was used to control the LEDs within the Arduino code. Originally we were coding for the brightness of the LEDs to change as well, but due to time constraints did not have a chance to try alternate coding.

With more time and finances, next steps would include recreating the tent with more size, sensors, and LED’s. The coding would be refined to allow for smoother changes in the LEDs, and we would determine better ways to organize the RGB value changes so human interaction with the tent can be more intriguing. We also had an early goal of incorporating ambient music tones to create a more ethereal effect when inside the tent that we would definitely explore given more time.

Here is the initial code that we first came up with. Each flex sensor has to be on its own channel and control an LED through its readings. In the final code, this was simply extrapolated to include multiple RGB values and incorporated the DMX shield.

int flex0 = A0;
int flex1 = A1;
int flex2 = A2;
int flex3 = A3;
int led1 = 9;
int led2 = 6;
int led3 = 5;
int led4 = 3;

void setup(){
  Serial.begin(9600);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
}

void loop(){
  int flexSensorReading0 = analogRead(flex0);
  //Serial.println(flexSensorReading0);
  int flexvalue0 = map(flexSensorReading0, 149, 312, 0, 255);
  //Serial.println(flexvalue0);
  delay(250);
 
  int flexSensorReading1 = analogRead(flex1);
  //Serial.println(flexSensorReading1);
  int flexvalue1 = map(flexSensorReading1, 149, 312, 0, 255);
  //Serial.println(flexvalue1);
  delay(250);
 
  int flexSensorReading2 = analogRead(flex2);
  //Serial.println(flexSensorReading2);
  int flexvalue2 = map(flexSensorReading2, 149, 312, 0, 255);
  //Serial.println(flexvalue2);
  delay(250);
 
  int flexSensorReading3 = analogRead(flex3);
  //Serial.println(flexSensorReading3);
  int flexvalue3 = map(flexSensorReading3, 149, 312, 0, 255);
  //Serial.println(flexvalue3);
  delay(250);
 
  analogWrite(led1, flexvalue0);
  analogWrite(led2, flexvalue1);
  analogWrite(led3, flexvalue2);
  analogWrite(led4, flexvalue3);
 
  delay(30);
}

Final Project Proposal – Interactive LED Tent – Josiah Song & Alexa Zyllo

5 Dec

Proposal: For our final project, we will be creating an interactive installation in the form of a 3-dimensional space. Specifically, our project is intended to be a cube shaped tent-like structure that can fit a human being inside while sitting down. From the inside, the walls will be able to be stretched outwards and pressed upon, which will trigger a response from 8 capacitive sensors (2 on each side) on the exterior of the cube based on the distance between hand and sensor. Based on the readings from the sensors, LED strips lining the top and bottom of the cube will change colors and brightness. The color changes will be connected to MIDI software and will be able to alter noises or sounds we install, creating an interactive space with a soothing ambience.

The code that we use to run the installation will consist of a loop that takes input readings from the capacitive sensors and continuously alters the color and brightness of the LEDS. Then, based on the current LED settings, different sounds associated with different color values will play.

The frame of the cube will be made out of PVC and measure approximately 4 ft. in length on each side. The walls will be made from a translucent fabric, most likely spandex, so that the LEDs can play off of the walls as they change color and brightness. Given cost and time restraints, it is more realistic to create a small tent for one person sitting than to create one that can fit multiple humans with standing room.

Image

Materials: PVC pipes (50 ft.), PVC connectors (8), spandex (9 yards), LED strips (8), capacitive sensors (8), Arduino board, MIDI software, wires

Schedule:

Dec 3-5: Initial sketches/designs, begin coding, gather materials

Dec 6-9: Construction of project, continue code development

Dec 10-11: Complete construction and install sound features, test code, final troubleshooting

Dec 12: Present project

Homework 05 – Arduino & Processing – Josiah Song

14 Nov

ImageImage

I created a simple circuit that uses the photoresistor to communicate between Arduino and Processing. I also changed the display color.

import processing.serial.*;
 
Serial myPort; // The serial port
int xPos = 1; // horizontal position of the graph

void setup () { // set the window size:
size(1000, 300);        

println(Serial.list());// List all the available serial ports
myPort = new Serial(this, Serial.list()[0], 9600); // don’t generate a serialEvent() unless you get a newline character:
myPort.bufferUntil(‘\n’);

background(0); // set inital background:
}
void draw () {
}
 
void serialEvent (Serial myPort) {// get the ASCII string:
 
String inString = myPort.readString();
 
if (inString != null) { // trim off any whitespace:

inString = trim(inString);// convert to an int and map to the screen height:
 
float inByte = float(inString);
inByte = map(inByte, 0, 1023, 0, height);//map incomming value to height of screen
 
stroke(50, 50 ,200 );// draw the line:
line(xPos, height, xPos, height – inByte);
 
// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
background(0);
}
else {
// increment the horizontal position:
xPos++;
}
}
}

Homework 04 – Combine Circuits – Josiah Song

5 Nov

ImageImageImage

I used the pushbutton, potentiometer, and sensor to control the LEDs. The button turns on the circuit, while the sensor determines the brightness of the LEDs. The potentiometer controls the speed that the LEDs blink.

int red = 13;//set red LED to pin 13
int blue = 6;//set blue LED to pin 6
int green = 5;//set green LED to pin 5
int button = 7;//set button to pin 7
int pot = 0;//analog pin used to connect the potentiometer
int value = 0;//setting variable value
int previous_value = 0;//store previous value
int state = 0;//state variable where 0 means off and 1 means on

void setup() {
  Serial.begin(9600);
  pinMode(red, OUTPUT);//set pin 13 to output
  pinMode(blue, OUTPUT);//set pin 6 to output
  pinMode(green, OUTPUT);//set pin 5 to output
  pinMode(button, INPUT);//set pin 7 to input
}

void loop() {//begin loop
  value = digitalRead(button);//set val to reading at pin 7
  if ((value==HIGH) && (previous_value==LOW)){
    state = 1 – state;
    delay(10);
  }
 
  previous_value = value;//set previous value to value
 
  if (state==1) {//do something if state is equal to 1
    int sensorReading = analogRead(A1);//set variable to read motion sensor
    Serial.println(sensorReading);//prints the reading to serial monitor
    pot = (analogRead(A0));
    analogWrite(red, sensorReading);//sets brightness based on motion sensor
    delay(pot);//delay based on potentiometer
    analogWrite(red, LOW);//turns led off
    delay(pot);//delay based on potentiometer
    analogWrite(blue, sensorReading);//sets brightness based on motion sensor
    delay(pot);//delay based on potentiometer
    analogWrite(blue, LOW);//turns led off
    delay(pot);//delay based on potentiometer
    analogWrite(green, sensorReading);//sets brightness based on motion sensor
    delay(pot);//delay based on potentiometer
    analogWrite(green, LOW);//turns led off
    delay(pot);//delay based on potentiometer
  } else{
    analogWrite(red, LOW);//send low signal to red led
    analogWrite(blue, LOW);//send low signal to blue led
    analogWrite(green, LOW);//send low signal to green led
  }
}

Homework 03 – Servo Motor Controlled by Variable Resistor – Josiah Song

31 Oct

Image

For this assignment, I chose to use the potentiometer to control both the servo motor and the three LEDs. The LEDs flash in a row in a basic pattern and the speed is determined by the position of the potentiometer. The servo motor position also depends on the position of the potentiometer.

#include <Servo.h>
 
Servo myservo;// create servo object to control a servo

int red = 3;//setting red led variable
int blue = 5;//setting blue led variable
int green = 6;//setting green led variable
int potpin = 0;//analog pin used to connect the potentiometer
int value;//variable to read the value from the analog pin
 
void setup()
{
  myservo.attach(9);// attaches the servo on pin 9 to the servo object
  pinMode(red, OUTPUT);//sets pin 3 to output
  pinMode(blue, OUTPUT);//sets pin 5 to output
  pinMode(green, OUTPUT);//sets pin 6 to output
}
 
void loop()
{
  value = analogRead(potpin);// reads the value of the potentiometer (value between 0 and 400)
  value = map(value, 0, 400, 0, 1000);// scale it to use it with the servo (value between 0 and 1000)
  myservo.write(value);// sets the servo position according to the scaled value
  delay(15);// waits for the servo to get there
  potpin = (analogRead(A0));//sets variable to register potentiometer
  digitalWrite(red, HIGH);//turns red led on
  delay(potpin);//delays how long the light stays on based on potentiometer position
  digitalWrite(red, LOW);//turns red led off
  delay(potpin);//delays how long the light stays off based on potentiometer position
  digitalWrite(blue, HIGH);//turns blue led on
  delay(potpin);//delays how long the light stays on based on potentiometer position
  digitalWrite(blue, LOW);//turns blue led off
  delay(potpin);//delays how long the light stays off based on potentiometer position
  digitalWrite(green, HIGH);//turns green led on
  delay(potpin);//delays how long the light stays on based on potentiometer position
  digitalWrite(green, LOW);//turns green led off
  delay(potpin);//delays how long the light stays off based on potentiometer position
}

Homework 02 – RGB LED Blink with Potentiometer – Josiah Song

29 Oct

Image

Because we are learning to use a potentiometer to control the time duration of the LEDs, I decided to create my code so that I could see the contrast of blinking lights determined by the potentiometer and lights determined by input values. My pattern is a sequence of 9 blinks, 3 by red, 3 by blue, and then 3 by green. The first blink in each set of 3 is determined by the potentiometer, the second is a set long blink, and the last is a set short blink. So the variation in the sequence is based on the potentiometer changing the time of the 1st, 4th, and 7th blinks.

Here is my code:

int red = 3; //setting red led variable
int blue = 5; //setting blue led variable
int green = 6; //setting green led variable
int pot = 0; //setting potentiometer

void setup() {
  pinMode(red, OUTPUT); //sets pin 3 to output
  pinMode(blue, OUTPUT); //sets pin 5 to output
  pinMode(green, OUTPUT); //sets pin 6 to output
}

void loop() {
  pot = (analogRead(A0));//sets variable to register potentiometer
  digitalWrite(red, HIGH);//turns red led on
  delay(pot);//delays how long the light is on based on potentiometer
  digitalWrite(red, LOW);//turns red led off
  delay(pot);//delays how long the light is off based on potentiometer
  digitalWrite(red, HIGH);//turns red led on
  delay(2000);//keeps light on for 2 seconds
  digitalWrite(red, LOW);//turns red led off
  delay(500);//keeps light off for 1/2 second
  digitalWrite(red, HIGH);//turns red led on
  delay(100);//keeps light on for 100 milliseconds
  digitalWrite(red, LOW);//turns red led off
  delay(100);//keeps light off for 100 milliseconds
  digitalWrite(blue, HIGH);//turns blue led on
  delay(pot);//delays how long the light is on based on potentiometer
  digitalWrite(blue, LOW);//turns blue led off
  delay(pot);//delays how long the light is off based on potentiometer
  digitalWrite(blue, HIGH);//turns blue led on
  delay(2000);//keeps light on for 2 seconds
  digitalWrite(blue, LOW);//turns blue led off
  delay(500);//keeps light off for 1/2 second
  digitalWrite(blue, HIGH);//turns blue led on
  delay(100);//keeps light on for 100 milliseconds
  digitalWrite(blue, LOW);//turns blue led off
  delay(100);//keeps light off for 100 milliseconds
  digitalWrite(green, HIGH);//turns green led on
  delay(pot);//delays how long the light is on based on potentiometer
  digitalWrite(green, LOW);//turns green led off
  delay(pot);//delays how long the light is off based on potentiometer
  digitalWrite(green, HIGH);//turns green led on
  delay(2000);//keeps light on for 2 seconds
  digitalWrite(green, LOW);//turns green led off
  delay(500);//keeps light off for 1/2 second
  digitalWrite(green, HIGH);//turns green led on
  delay(100);//keeps light on for 100 milliseconds
  digitalWrite(green, LOW);//turns green led off
  delay(100);//keeps light off for 100 milliseconds
}