3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Tangible Interaction Design Studio: the "lamp"

Tangible Interaction Design Studio: the "lamp"
The way people behave and occupy a certain place is determined by numerous factors such as time, location, and program of the place. Accordingly,the place can generate a totally different mood depending on the behaviors and activities of the people in it. For instance, a restaurant packed with customers on Friday evening feels dramatically different from the same restaurant on Monday morning with few customers (figure 1). This is an interesting notion for me, and I decided to build an interactive machine that can replicate and record this phenomenon. The project is a lamp that detects people's activities and movements in a room. It emits different shades of light depending on the distance between the table and people.


The lamp has a total of four I/R sensors, each at a different location of the lamp. Three LEDs (red, green, blue) are designated for each sensor, and will respond to the level of activity that the sensor detects. Once the sensor detects anyone within its range, the LED for the corresponding sensor will emit different colors of light depending on the distance between him and the table. The farther the occupant is away from the table, the LED will emit "cool" colors such as blue. The closer the occupant is to the table, the LED will emit warm colors such as red, yellow, etc (figure 2).


Since the lamp has twelve LEDs responding to four sensors, the table can thus have up to four different shades at the same time. In a room with dynamic movements of occupants, the lamp will constantly change its colors. Conversely, in a room with rather static movements of occupants, the colors of the lamp will be much more constant. Figures 3 and 4 show how the table will look like depending on the locations of occupants.

 
Remove these adsRemove these ads by Signing Up
 

Step 1Programming

Programming:
The project requires the codes that can interpret the distance value received from I/R sensor. Then it tells each LED to generate appropriate color for the distance data it received. Once one "prototype" of coding is complete, you can simply replicate those codes for three other sets of I/R sensor and LEDs.

The code is written so that the value received at each I/R sensor directly translates into the color of the lamp. Thus, the lower the distance value for each I/R sensor (i.e., when the object is further away from the lamp), the birighter blue light gets. Likewise, the higher the distance value for each I/R sensor (i.e., when the object is closer to the lamp), the brigher the red light gets. The code also allows "blending" of colors in between the colors of light. In other words, when the occupant slowly approaches the lamp, the table does not abrubtly change from complete blue to complete green to complete red. Instead, it will gradually change from strong blue to light blue to turquois to green to yellow to orange to red. Please refer back to <figure 2> of "concept studeis" section of this page for color schemes.

The code is written in Arduino software. See below for coding details.


int distance = 0;
int distance2 = 0;

int analogPin0 = 0;
int analogPin2 = 1;

int red = 11;
int blue = 10;
int green = 9;

int blue2 = 5;
int red2 = 6;
int green2 = 3;

float redVal = 0.;
float blueVal = 0.;
float greenVal = 0.;

float red2Val = 0.;
float blue2Val = 0.;
float green2Val = 0.;

void setup() {
pinMode(analogPin0, INPUT);
pinMode(analogPin2, INPUT);
pinMode(red,OUTPUT);
pinMode(blue,OUTPUT);
pinMode(green,OUTPUT);

pinMode(red2,OUTPUT);
pinMode(blue2,OUTPUT);
pinMode(green2,OUTPUT);

Serial.begin(9600); // Set up the serial communication.
}

void loop() {
distance = analogRead(analogPin0);
distance2 = analogRead(analogPin2);
Serial.print("distance value: ");
Serial.print("distnace value 2: ");
Serial.println(distance);
Serial.println(distance2);

int redInt = 0;
int blueInt = 0;
int greenInt = 0;
int red2Int = 0;
int blue2Int = 0;
int green2Int = 0;
int fadevalue = 0;

if (distance <=350 && distance >=0) {
blueVal = (350 - distance) * (255/350.);
blueInt = (int) blueVal;
}

else {
digitalWrite(blue,LOW);
}

if (distance <= 300 && distance >=50) {
greenVal = (distance - 50.) * (255/250.);
greenInt = (int) greenVal;
}

else if (distance > 300 && distance <=500){
greenVal = (500 - distance) * (255/200.);
greenInt = (int) greenVal;
}

else {
digitalWrite (green, LOW);
}

if (distance <=650 && distance >=300) {
redVal = (distance - 300.) * (255/350.);
redInt = (int) redVal;
}

else {
digitalWrite (red, LOW);
}

if (distance2 <=350 && distance2 >=0) {
blue2Val = (350 - distance2) * (255/350.);
blue2Int = (int) blue2Val;
}

else {
digitalWrite(blue2,LOW);
}

if (distance2 <= 300 && distance2 >=50) {
green2Val = (distance2 - 50.) * (255/250.);
green2Int = (int) green2Val;
}

else if (distance2 > 300 && distance2 <=500){
green2Val = (500 - distance2) * (255/200.);
green2Int = (int) green2Val;
}

else {
digitalWrite (green2, LOW);
}

if (distance2 <=650 && distance2 >=300) {
red2Val = (distance2 - 300.) * (255/350.);
red2Int = (int) red2Val;
}

else {
digitalWrite (red2, LOW);
}

analogWrite(red, redInt);
analogWrite(blue, blueInt);
analogWrite(green, greenInt);

analogWrite(red2, red2Int);
analogWrite(blue2, blue2Int);
analogWrite(green2, green2Int);
}

« Previous StepDownload PDFView All StepsNext Step »
1 comment
May 19, 2009. 5:47 AMgmoon says:
The first picture on the "intro" page is the "headshot" of your project. It's visual identity, if you will.

You've got a nondescript crowd shot. Change it to a photo of the lamp--you'll get many more views.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
0
Followers
1
Author:k388dy