Tuesday, April 24, 2012

Number Crunching

Today we spent most of the day cost comparing the peggy board against building our own "peggy" board and doing a evaluation to see which would be the most economical for us.

Buying the Peggy Board
Peggy Board: $95.00
LEDS (625count) : $131.00
D Cell Batteries: $7.00
FTDICable: $17.00
Sensor: $15.00
Total Cost: $265.00

Builidng our Own
Arudino: $34.99
Mux Shield: $25.00
Sensor: $15.00
LEDS (200): $63.60
Transistors: $12.35
Board: $10.00
Total Cost: $160.94

Building our own but smaller (if we use the capacity of the arduino, we will save $25 on not buying a mux shield, save money on the amount of leds , and on the amount of transistors we need)

Arudino: $34.99
Sensor: $15.00
LEDs (60): $45.60
Transistors(7):$6.65
Board: $10.00
Total Cost: $105.59

Kara: (Sparkfun.com $67.20+shipping)
Diego (Arduino and casing materials $34.99+)

Thursday, April 19, 2012

Peggy Boards and Breakthroughs

Ah! We had some revolutionary ideas today.
First, Dominic suggested that we get a peggy board to program and to solder LEDs to rather then building our own circuitry. This would save us a lot of time in the long run and might be more cost effective.

Secondly, Diego had a breakthrough with muxing today. He figured out how to use transistors to control the current that goes through ground enabling which circuit is allowed to function at any given time.


Codework:

int pwr1 = 4;
int pwr2 = 3;
int pwr3 = 2;

int gnd1 = 5;
int gnd2 = 6;
int gnd3 = 7;

void setup() {
  
  pinMode(pwr1, OUTPUT);
  pinMode(pwr2, OUTPUT);
  pinMode(pwr3, OUTPUT);
  
  pinMode(gnd1, OUTPUT);
  pinMode(gnd2, OUTPUT);
  pinMode(gnd3, OUTPUT);
}

void loop() {
  digitalWrite(pwr1, LOW);
  digitalWrite(gnd1, LOW);
  digitalWrite(pwr2, LOW);
  digitalWrite(gnd2, LOW);
  digitalWrite(pwr3, LOW);
  digitalWrite(gnd3, LOW);
  delay(1); 
  
  for(int ii = 0; ii < 100; ++ii) {
    digitalWrite(pwr1, HIGH);
    digitalWrite(gnd1, HIGH);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, HIGH);
    digitalWrite(pwr2, HIGH);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, HIGH);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, HIGH);
    digitalWrite(gnd3, LOW);
    
    delay(1); 
  
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);   
  }
  
  for(int ii = 0; ii < 100; ii++) {
    digitalWrite(pwr1, HIGH);
    digitalWrite(gnd1, HIGH);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, HIGH);
    digitalWrite(pwr2, HIGH);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, HIGH);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, HIGH);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, HIGH);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, HIGH);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, HIGH);
    digitalWrite(gnd2, HIGH);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, HIGH);
    digitalWrite(pwr3, HIGH);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);  
  }
  
  for(int ii = 0; ii < 100; ii++) {
    digitalWrite(pwr1, HIGH);
    digitalWrite(gnd1, HIGH);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, HIGH);
    digitalWrite(pwr2, HIGH);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, HIGH);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, HIGH);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, HIGH);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, HIGH);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, HIGH);
    digitalWrite(gnd2, HIGH);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, HIGH);
    digitalWrite(pwr3, HIGH);
    digitalWrite(gnd3, LOW);
    
    delay(1);
    
    digitalWrite(pwr1, HIGH);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, HIGH);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, HIGH);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, LOW);
    digitalWrite(gnd3, HIGH);
    
    delay(1);
    
    digitalWrite(pwr1, LOW);
    digitalWrite(gnd1, LOW);
    digitalWrite(pwr2, LOW);
    digitalWrite(gnd2, LOW);
    digitalWrite(pwr3, HIGH);
    digitalWrite(gnd3, HIGH);
    
    delay(1);
 
  }
}



Now we are trying to code for muxing by threes. Instead of just one LED at a time. Diego was successful in getting all the LEDS to light up by using for loops.  Here is a nice video demonstrating:


RGB LED manipulation video

Here is the video for the RGB LED that I was able to manipulate with three potentiometers:


The code:
//LED pins
int redLED = 11;
int greenLED = 10;
int blueLED = 9;

//Potentiometer pins
int redIn = A0;
int greenIn = A1;
int blueIn = A2;

//Data gathered from potentiometer
int redValue = 0;
int greenValue = 0;
int blueValue = 0;

//Data used to manipulate LED after mapping
int redOutput = 0;
int greenOutput = 0;
int blueOutput = 0;

void setup() {
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
pinMode(blueLED, OUTPUT);
pinMode(redIn, INPUT);
pinMode(greenIn, INPUT);
pinMode(blueIn, INPUT);
Serial.begin(9600);
}

void loop() {
//Data from potentiometer is read
redValue = analogRead(redIn);
greenValue = analogRead(greenIn);
blueValue = analogRead(blueIn);
//Data gathered is mapped for LED analog range
redOutput = map(redValue, 0, 1023, 0, 255);
greenOutput = map(greenValue, 0, 1023, 0, 255);
blueOutput = map(blueValue, 0, 1023, 0, 255);
//Manipulatingthe color channels
analogWrite(redLED, redOutput);
analogWrite(greenLED, greenOutput);
analogWrite(blueLED, blueOutput);
Serial.print(redOutput);
Serial.print("\t");
Serial.print(greenOutput);
Serial.print("\t");
Serial.println(blueOutput);
delay(0);
}

Then I randomized the color channels to create randomness of light!


The code:
long randRed;
long randGreen;
long randBlue;

int redLED = 11;
int greenLED = 10;
int blueLED = 9;

void setup(){
Serial.begin(9600);
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
pinMode(blueLED, OUTPUT);
randomSeed(1);
}

void loop() {
randRed = random(0,254);
randGreen = random(50,254);
randBlue = random(75,254);
analogWrite(redLED, randRed);
analogWrite(greenLED, randGreen);
analogWrite(blueLED, randBlue);
Serial.print(randRed);
Serial.print("\t");
Serial.print(randGreen);
Serial.print("\t");
Serial.println(randBlue);
delay(250);
}

Thursday, April 12, 2012

Begin Coding

If viewer is close to LED painting: LEDs will be red/orange
Anywhere in between : LEDS will be yellow/green. 
If viewer is further from LED painting LEDS will be blue/purple.

Translate into code.
Possible solutions for coding:
Start coding for only one LED, translate that to multiple?

Randomness : Further from "painting" lights turn on scarcely... closer ALL LEDS turn on.

Programming for:
Amount of LEDS On at a Time (not really/more frequency)
Color of LEDS

With Muxing: One Light is on at a time. The frequency in which LEDs turn on manipulate the viewer to thinking that more than one LED is on at a time.

Process:
Start making the grid, make sure that all LEDS are working!
Start programming.

Supply List/Notes of 04/12/12

Supply List for Project
50 RGB LEDS: $20-50.
Motion Sensor $10-50.
Arduino: $17-50.
Canvas (size to be determined)/ 12x12 in, or 16x16, : $6-20.
OR FOAM board... (this may be cheaper and easier to puncture)

NOTES:
The challenges of distance sensing are this:
What you are doing when you are trying to distance sense you are getting some sense of analog.

Digital: there or not (that's pretty easy: motion sensor for yard lights are pretty standard and robust. passive infared sensors that anytime there is motion they go off

Light sensor ( casting a shadow)

Analog- range of something that is happening (distance sensing)
options for distance sensing
IR light which tends to be Sharp sensors
Ultra Sonic- standard Paralax PING  HC-SR04
Matbotix - 25 ft.

How these sensors work: Sending out something and trying to get a read off of that object.

Some sort of angle throw. It will do a better job at a certain distance rather than and people coming in from the side.
Solutions: tucking it into a corner so that viewers only come in from a certain angle/ mirroring the sensor angle
mulitiple sensors can help and cause dead spots.

ping sensor is $10 (3 m)
matbotix- $50. (25 ft)
sharp IR-long range iR ( 150 cm-5 ft)
Have traditionally been short range that are found in toilets and sinks

Using a hallway to create zones with different sensors. as people walk through and cast a shadow they
ir breakbeam;

Challenge of interactive work: how do you make an experience that is successful for one person but also for multiple people?
Programming for both SITUATIONS is often difficult. Both of these situations occur in gallery spaces.

counter: using a counter (ab) coming (ba) going

Defaulting to the closest person- as having the most control in a situation.

Arduino code on smoothing: analog sensor picking up information that is not necessary, collecting a certain amount of readings in a given time and averaging out readings

Code out (not too close)  to avoid sensor wigging, possible solution: another sensor or physical barrier that prevents viewers from getting too close and fretting the sensor.

Today: Soldered the analog knob wires back together.
Managed to create multiple colors using R, G, & B as each assigned knob.

Problems: Colors don't always combine depending on the angle in which you are looking at the LED... Even in the reflection we are getting multiple colors.

Possible solution: Using material to cover and disperse the light..
Turning LEDs on it's side? 

See video and code attached.

Wednesday, April 11, 2012

RGB LED!

Yesterday, while Kara was working on blogging and researching supplies that we need for this project. I spent a good chunk of time understanding RGB LEDs this meant frustrating trial and error.

As Kara mentioned, I was using 3 analog sensors: 2 potentiometers and 1 pressure pad to control each of the color channels individually to create a range of light colors. Because I had never worked with an RGB LED, I couldn't get it to work at all and every time I changed something in the circuit, the LED would light up in a different color (assuming that the circuit worked power it).

Luckily after asking Colleen and finding this website: http://hertaville.com/?p=168, I understood that LEDs can have either a common cathode or common anode. I assumed that my LED had a common cathode and it wasn't so.

I got it to work! I wasn't able to spend too much time playing around with it to look at the pretty lights but I have pictures:
As you can see this light is a bluish green.
The crammed mess that I made for myself.

I look forward to using my nerd skills to make this project work. (Muxing... watch out)

- Diego

Tuesday, April 10, 2012

Beginnings

Diego and I had a hard time coming up with an idea and concept for 319 Physical Computing Final Project.

We brain stormed and talked about some mutual interests that we shared. We both knew we wanted to do something that was interactive, and would engage an audience in a way that was thoughtful and innovative.

We were inspired by the idea of art as a device to experiment with society. At first, we wanted to build a robot similar to tweenbots. However, we realized that although we loved the idea of the experiment, we couldn't find a way to make it our own idea.

We then brainstormed about how we could change the environment in which students inhabit daily. Our student union is a facility which sees a lot of traffic and we were interested in how people normally interact with it and what we could do to alter this environment and this reaction. We discussed many possibilities; rearranging furniture, re flowing traffic, etc.

With our proposal way past due, we were scrambled to find something we could both agree on. It seemed that our brains were drained of any creative juices. Bombarded by senior projects and graduation musings,  we agreed to take the weekend to think or not think , hoping an idea would come to us.

Inspired by RGB LEDs, Diego decided he wanted to create a motion sensor piece that would detect presence. Over the weekend, the only thing I really came up with was a random generator that would spit out ideas (as we had none... playing with the idea of how creativity is a mystical thing between creative people) By combining our two concepts, we decided upon a creation with LEDs that would be motion censored but also have an element of random-ability.

This work would be a Light Presence Painting, a stream of LEDs that would flicker and change color depending on the distance of the viewer. If the viewer was far, the LEDs would become "sad" and be colored cooler, the activity of the lights would be dim. As the viewer came closer to the LEDs the lights would become more vibrant, signaling an intense emotional reaction.  The LEDs would then be a hotter palette. Our main gesture that we would like to evoke is one of excitability and enticement.

We talked about the idea of this piece being more dimensional rather than a painting and the idea of creating an infinity environment. However this only seems to complicate our idea, and we have limited resources as well.

Our classmates suggested that if we are to stick with a painting, that we should treat this almost as an object. Using materials that could be transparent , translucent , to magnify or diffuse the light of the LEDS. We also discussed our options as far as sensors. At this point in time, we are thinking a omnidirectional motion sensor.

Diego began experimenting with the RGB LEDS trying to have three analog sensors, 2 knobs, and one touch pad to basically output different colors.