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.

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. 

No comments:

Post a Comment