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.

Step 1: 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);


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: ");

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 {

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 {

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);

Step 2: Assembly

Arduino Hardware:
As mentioned in "Concept Studies" section, the lamp uses four I/R sensors. Rather than using twelve different LEDs, I used 4 three-color LEDs, which would allow me more control over the assembly and placement of the LED inside the lamp (figure 1). The wires for I/R sensors (figure 2) are directly connected to input pins of the Arduino board, and the power and ground are connected to the breadboard that has wires going to the Arduino. Each of the four I/R sensors is attached to one side of the lamp (figure 3). Two separte Arduino boards with the identical assembly and wiring were used (figure 4).

I wanted to diffuse various colors inside the lamp, so I used translucent plastic sheet for the exterior skin of the lamp (figure 5). An opaque, gray plastic sheet was used for the bottom third of the lamp which holds and covers the Arduino borads, wires, and I/R sensors.

The plastic sheets are too thin to support any of the lamps weight, so the basic framwork of the lamp had to be built with materials that are much sturdier. For the "lamp" part, I used 1/8" thick plexi glass (figure 6). Four long sheets for the sides and one square sheet for the top were cut with the table saw and glued together with Duco Cement glue (figure 7). (FYI, thick plexi glass is IMPOSSIBLE to cut only with a cutting knife or exacto. You must use the wood shop if you want to cut them into pieces that you want.)
The bass wood for the legs of the lamp are about 3 feet long (figure 8), and were spray painted with gray so that they match the color tone of the entire lamp (figure 9).

Step 3: The "lamp"

Here are some photographs of the finished product.

Figure 1: Frontal view (Daytime)
Figure 2: Side view (Daytime)
Figure 3: Occupants are far away from the table.
Figure 4: Distance for each occupants vary. (See diagram)
Figure 5: Distance for each occupants vary. (See diagram)
Figure 6: Distance for each occupants vary. (See diagram)
Figure 7: Distance for each occupants vary. (See diagram)
Figure 8: Occupants are close to the table.

Step 4: The "lamp" in Action

The first picture on the &quot;intro&quot; page is the &quot;headshot&quot; of your project. It's <em>visual identity</em>, if you will.<br/><br/>You've got a nondescript crowd shot. Change it to a photo of the lamp--you'll get many more views.<br/>

About This Instructable




More by k388dy:Tangible Interaction Design Studio: the &quot;lamp&quot; 
Add instructable to: