As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Tuesday, April 29, 2014

Let there be LIGHT! Sensor input experiment

Chris and Skyler here, and boy do we have a goodie for y'all! We've been spending some time playing around with LEDs and we wanted to up the game by adding a photosensor input.  Through exposing our sensor to a flashlight our LED would turn off (how energy efficient! ) and if we moved the light away, the LED would light up again. The video below demos the action and you can see our code below,





int lightPin = 0;  //define a pin for Photo resistor
int ledPin=12;     //define a pin for LED

void setup()
{
    Serial.begin(9600);  //Begin serial communcation
    pinMode( ledPin, OUTPUT );
}

void loop()
{
    Serial.println(analogRead(lightPin)); //Write the value of the photoresistor to the serial monitor.
    analogWrite(ledPin, analogRead(lightPin)/4);  //send the value to the ledPin. Depending on value of resistor
                                                //you have  to divide the value. for example,
                                                //with a 10k resistor divide the value by 2, for 100k resistor divide by 4.
   delay(10); //short delay for faster response to light.
}

Chris & Skyler make Fibonacci blinking magic

The other day we figured out a code to blink the Fibonacci sequence ( 1, 1, 2, 5, 8, 13, 21, 34... ) Following the series of blinking experiments from creating this sequence was relatively simple. Main components were creating int variables that guided the codes changes of state. Check out how we did it below! 


/*
Fibonacci
 */
 
//The power out of digital 13
int led = 13;
int prev = 0;
int cur = 1;

void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  for(int i = 0; i < cur; i++){
    flashOnce();
  }
  delay(800);
  int temp = cur; //sset a holder for the current number
  cur = cur + prev; //current number + previous number
  prev = temp; //previous is now current.
}

//method for flashing once
void flashOnce() {
    digitalWrite(led, HIGH);
    delay(200);
    digitalWrite(led, LOW);
    delay(200);
}

Sunday, April 27, 2014

Constance and Haley. Arduino. Fibionacci Sequence Blinking

We have completed the Arduino sketch to blink an LED according to the Fibonacci Sequence. We used three variables to create the sequence and keep track of how far into the sequence the Arduino is at any time.

Source code posted below:

int led = 13; int count1 = 0; int count2 = 1;
void setup() { pinMode(led, OUTPUT); }
void loop() { for (int i = 0; i < count1; i = i + 1) {digitalWrite(led, HIGH); delay(500); digitalWrite(led, LOW); delay(500); } int temp = count2; count2 = count1 + count2; count1 = temp; delay (1000); }

Friday, April 25, 2014

Jered and Ciera | Arduino | Sensor Experimentation

Using an Arduino can sometimes make it difficult to control high-voltage devices. The maximum voltage that the Arduino can output from its pins is +5 volts. Say we wanted to control a motor running at +12 volts? How could we do it?

The answer is transistors. Transistors are very powerful because they allow manipulation of very high voltages using only a very low voltage signal. Think of a transistor as a signal amplifier. A transistor can use a +5v signal from the Arduino to turn on or off a higher voltage +12v motor.


In common transistors like the TIP120, the "base" pin can connect to a control signal which controls current across the "collector" and "emitter" pins.

In the schematic below, a potentiometer is used to control the speed of a 12 volt DC motor via PWM. The potentiometer acts as a sensor and is connected to pin A0 as well as +5v and GND. Extra power comes from an external "wall wart" which provides a +12v current. Note: it is very important to connect all the grounds together in circuits like this. The ground from the wall wart is connected to the ground of the Arduino even though they output different voltages.


To get this circuit to run on the Arduino, simply use the unmodified example code from Examples > Analog > AnalogInOutSerial. The Arduino reads the analog signal from the potentiometer on pin A0, and then outputs an equivalent PWM signal from pin 9. The transistor then amplifies the PWM signal in order to control the flow of +12v current through the motor.


Try it for yourself!

Webcam Glitch Art Processing Sketch

I have been interested in glitch art for a while, and love experimenting with video. I used this sketch as an opportunity to explore both of those. But I wanted it to be interactive as well. Therefore, I decided to use the participant's mouse position as a way to make it more interactive. As the user moves their mouse, it changes the tint color of the video, as well as the size/position of the video. I am interested in discovering new ways to alter/distort video and create more interactivity with it.



import processing.video.*;
Capture cam;
void setup() {
  size(800, 800);
  cam = new Capture(this,300,300,15);
  background(255);
  String[] cameras = Capture.list();
   
  if (cameras.length == 0) {
    println("There are no cameras available for capture.");
    exit();
  else {
    println("Available cameras:");
    for (int i = 0; i < cameras.length; i++) {
      println(cameras[i]);
    }
     
    // Initialize Camera
    cam = new Capture(this, cameras[0]);
    cam.start();    
  }     
}
void draw() {
  if (cam.available() == true) {
    cam.read();
  }
   
   
    // Tinting using mouse location
  tint(255 - mouseY,255 - mouseX,255);
  // Multiple Cam
  image(cam,0,0,mouseX,mouseY);
  image(cam,20,20,mouseX,mouseY);
  image(cam,30,30,mouseX,mouseY);
  image(cam,200,200,mouseX,mouseY);
  image(cam,220,210,mouseX -50 ,mouseY - 100);
  image(cam,330,240,mouseX -50 ,mouseY - 100);
  image(cam,335,245,mouseX -10 ,mouseY - 90);
  image(cam,340,250,mouseX -10 ,mouseY - 100);
    image(cam,200,200,mouseX,mouseY);
  image(cam,620,510,mouseX -50 ,mouseY - 100);
  image(cam,630,540,mouseX -50 ,mouseY - 100);
  image(cam,635,545,mouseX -10 ,mouseY - 90);
  image(cam,640,550,mouseX -10 ,mouseY - 100);
   
  
}