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.

Thursday, May 28, 2015

Sensor & Situation UPDATE // Gloria & Jessica

We moved forward with our Rain Lamp concept - but we decided to tweak it a little.

Rather than a rain lamp, it would be a weather lamp instead.

This is the way we imagine it working:

1) We will use processing to pull data/information from a weather server.
2) Then we'll connect processing with Arduino and make sure the Arduino is getting "commands" from processing.
3) We will code different patterns for the neopixel lights to react on the Arduino according to the weather forecast.
4) The neopixel lights will react based on weather conditions. (E.g. sunny = lights glow pink/orange/yellow, etc.)

Tuesday, May 26, 2015

Jordan & Tess pseudo code, actual code, set up, and chair

We have completed a basic set up of our arduino and code to simulate what our final project would be. First is the pseudo code which maps out our chair experience. Then we created the actual code which works so that when the photosensor is covered for 3 seconds a sound plays for 4 seconds. In our actual project the 3 seconds would be 1 hour (someone sitting) and the 4 seconds would be 5 minutes (someone taking a break). From here we have to complete our code to account for "if" statements. For example, if someone covered the photosensor for a half hour and then got up for a quick moment, we need to make sure the arduino doesn't reset itself. 

Pseudo Code
if sit= false
{check light
set sit=true
}

if sit=true
start millis
check if millis>1hour
then beep for 3 mins
reset

Actual Code
boolean sit = false; int photocellPin = 0; int photocellReading; int sitThreshold = 500; int sitStart = 3000; long sitLimit = 3000; void setup() { } void loop() { if (sit == false) { photocellReading = analogRead(photocellPin); if (photocellReading < sitThreshold) { sit = true; sitStart = millis(); } } if ((sit == true) && ((millis() - sitStart) > sitLimit)) { tone(8, 300, 1000); sit = false; } }

Arduino Set Up
We will have to find or soder longer wires in our final product to acommodate for the shape of the chair. We plan to place the photosensor on the seat of the chair and put the speaker on the back of the chair.


Chair!!
We realize that the aesthetics of this chair are not pleasing to the eye and therefor we will find some fun fabric to cover it with! The best thing about this chair is that it's extremely comfortable and spinny, definitely the kind of chair someone could spend over an hour in and need to be reminded to take a break.


Wednesday, May 20, 2015

No Phones At The Table – Pseudocode and Pseudotable – Rishi Agarwal and Annie Pyle

Pseudocode

In order to detect the presence of a phone at a two-person dining table, we will monitor a series of photoresistors. The photoresistors will be placed on the underside of the table and arranged as shown below.


Each person will be monitored by two photoresistors. Based on our testing, two photoresistors should be enough to detect a phone along the 29" sides of the table, provided the person isn't trying to fool our system. The solitary sensors under the left and right sides of the table are used to determine the ambient light levels–we can be reasonably sure that there will never be a phone here so they are good "control" sensors.

Below is the pseudocode that will run on the Arduino. It was partly based on an answer posted on Stack Overflow here: http://stackoverflow.com/a/22145701. The code regularly compares the values from the sensors next to the people to the values from the "control" sensors. If there is a noticeable spike, the NeoPixels play an animation that point to that sensor.

  1. Create an array with eleven elements for each photoresistor.
  2. Every 100 ms, get the sensor value from each photoresistor and store it at the front of its respective array. Only store the eleven most recent values.
  3. Create a function "avg10" that returns the average of values array[1] through array[10]. Create another function "avg2" that returns the average of values array[0] and array[1]. These functions will be used to determine if a sensor is reporting a spike in brightness.
  4. Every 100 ms, run the following, for each sensor:
    1. If (avg2 - avg10  > a given threshold) AND if (avg2 - avg10 of the "control" sensors > a given threshold) THEN trigger an animation on the NeoPixels that points to this sensor.
    2. If (the NeoPixels are on) AND if (avg2 - avg10 of the "control" sensors < a given threshold) THEN turn off the NeoPixels
There are some potential problems with the pseudocode that will only be resolved once we test it on real hardware: 
  1. Turning on the room's lights will cause all the sensors to spike which may cause strange behavior and could incorrectly trigger the NeoPixels. This should be fixable by inserting a delay in step four, part one.
  2. There is no set behavior if both people use their phones at the same time, but maybe we shouldn't worry about it. I've found that over-engineering things makes it a pain to fix problems when they arise.


Pseudotable

At the same time, we are trying to figure out how to install the components in our table. We bought a table from IKEA (this one: http://www.ikea.com/us/en/catalog/products/40264273/). We found the same table on Craigslist for $15 but the guy never responded. At the UW surplus store we found a table for $5 but it was in terrible quality so we bit the bullet and bought the table, new from IKEA.

This is how we want to cut the table to fit the NeoPixels. The shallower cutout is for a ring of frosted acrylic that should diffuse the bright NeoPixels nicely. It will sit on top of 1/16" wide ledge. Three holes, 1/8" thick, will go all the way through the table to accommodate the wires.


We still have to figure out how we want to mount the Arduino and the photoresistors to the bottom of the table. We also need to figure out how to power the Arduino–batteries, or a cord connected to a power outlet. 

Tuesday, May 19, 2015

Lamp reacting to sound

For our project, we wanted to have a way to have out lamp change brightness with the surrounding sound. We were able to find a code similar to what we wanted where each light bulb would turn on when the microphone sensor picked up the sound. Here is what the code that we used! 

// Arduino pin numbers 
//const int DO_pin = 2;
 const int AO_pin = 0; 

int sound; 

int led1 = 8; 
int led2 = 9;
 int led3 = 10; 
int led4 = 11; 
int led5 = 12; 

void setup() 
{ //pinMode(DO_pin, INPUT); 
 pinMode(led1, OUTPUT);
 pinMode(led2, OUTPUT); 
 pinMode(led3, OUTPUT); 
pinMode(led4, OUTPUT); 
pinMode(led5, OUTPUT); 

 Serial.begin(9600); } 

 void loop() { 
if (sound > 36) 
{ digitalWrite(led1, HIGH); } 
if (sound < 36) { digitalWrite(led1, LOW); } 
if (sound > 40) { digitalWrite(led2, HIGH); }
 if (sound < 40) { digitalWrite(led2, LOW); } 
if (sound > 45) { digitalWrite(led3, HIGH); } 
if (sound < 45) { digitalWrite(led3, LOW); }
 if (sound > 50) { digitalWrite(led4, HIGH); }
 if (sound < 50) { digitalWrite(led4, LOW); }
 if (sound > 55) { digitalWrite(led5, HIGH); }
 if (sound < 55) { digitalWrite(led5, LOW); }

 sound = analogRead(AO_pin)* 0.1;
 //Serial.print(digitalRead(DO_pin)); 
Serial.print("-"); Serial.println(analogRead(AO_pin)); }

No Phones At The Table – Testing NeoPixel – Rishi Agarwal and Annie Pyle


We got our NeoPixel recently and we wanted to test it out. We hooked it up to the Arduino and made some demo code to teach ourselves the API. This animation is similar to what we might have in the final product. The code is below. If you want to see a formatted version, check here: http://pastebin.com/6Qxcq7QR



//import good stuff to make the neopixel work
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>

//define pin for neopixel
#define PIN 6

//initialize the neopixel object (number of LEDs, pin number, color mode)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.setBrightness(3);
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  int line = 11;
  lineLoop(line);
  lineStatic(line);
  lineResize(line);
  lineStatic(line);
}

//creates a line that moves around the ring
void lineLoop(int length) {
  for (int i = 0; i < 24; i++) {
    for (int j = 0; j < length; j++) {
      int light = i + j;
      if (light > 23) {
        light -= 24;
      }
      strip.setPixelColor(light, strip.Color(255, 0, 0));
    }
    strip.show();
    delay(50);
    for (int k = 0; k < 24; k++) {
      strip.setPixelColor(k, 0);
    }
    strip.show();
  }
}

//creates a line in place
void lineStatic(int length) {
  for (int i = 0; i < length; i++) {
    strip.setPixelColor(i, strip.Color(255, 0, 0));
  }
  strip.show();
  delay(500);
}

//shrinks the line and expands it to its previous size
void lineResize(int length) {
  for (int j = 0; j < 3; j++) {
    //shrinks
    for (int i = 0; i < ((length-1)/2); i++) {
      strip.setPixelColor(i, 0);
      strip.setPixelColor(length-1-i, 0);
      strip.show();
      delay(75);
    }
 
    //expands
    for (int i = ((length-1)/2) - 1; i >= 0; i--) {
      strip.setPixelColor(i, strip.Color(255, 0, 0));
      strip.setPixelColor(length-1-i, strip.Color(255, 0, 0));

      strip.show();
      delay(16);
    }
  }
}

Sunday, May 17, 2015

No Phones At The Table – Testing Sensors – Rishi Agarwal and Annie Pyle

The photoresistors are constantly generating readings – it's up to the Arduino to interpret it. In order to detect a phone, we need to write an algorithm that triggers an alert when the light levels spike past a certain threshold for a certain amount of time. This requires a lot of testing in order to calibrate it to the right sensitivity. Too sensitive and it will trigger false positives; too passive and it will create false negatives. We sent the photoresistor values to the console (with Serial.print) but it was hard to see patterns in a fast-scrolling list of numbers. To find patterns more effectively, we created a Processing script that parsed the values from the Serial monitor and generated a graph. The visual format is great for understanding the sensitivity of the photoresistors.

No Phones At The Table – Functional Diagram – Rishi Agarwal and Annie Pyle


We want to shame people for using their phone at the dining table. We will detect a phone by the brightness of its screen. A series of photoresistors installed around the perimeter of the underside of the table will detect changes in light levels. If one photoresistor's readings spike, then we can assume that there is a phone there. A ring of LEDs installed in the center of the table will then light up, shaming the offender by pointing to the sensor that spiked. We noted that if the room's lights are turned on, then all the sensor's readings will spike which would trigger a false positive. This has to be specifically handled in the Arduino code.