[intangible] Project 1: Light, but also how we burned an AC dimmer, a chair & almost ourselves

Last week, Dalit and I observed the lights on the floor, and decided that we really wanted to create a lamp that can be controlled by individual behaviors, independent from movement of others in the area.

We used a pair of IR beam breakers and some conductive tape as capacitive sensors.

The intended interactions are as follow:

  1. User sits down, beam is broken
  2. Light turns on automatically, at a slightly dimmed brightness
  3. User presented with touch pads (conductive tape) on the desktop
  4. User enjoys current lighting condition, or change it with touch pad interactions
  5. User leaves, beam is unbroken
  6. Automatically turn off the light

Here’s a demo of how it works: right hand movement resembles sitting down and standing up, and left hand touches the capacity sensor on the table.

Process

First we tested the IR break beam sensor, using its HIGH/LOW state to turn on and off a small LED. It was a pretty straightforward digital input. Apart from determining the state, we added a comparison of current sensor state and last sensor state, in order to indicate when the beam is being broken (when sensor state changes AND current state is LOW) and unbroken (when sensor state changes AND current state is HIGH).

Dalit had some copper tape that we used as capacitive sensor. We installed the CapacitiveSensor library on Arduino, following instruction and example code on Bare Conductive. Now when the beam breaker value is LOW, we mapped the capacitive sensor’s range (incredibly large for some reason) to LED brightness. Now, user can manipulate brightness by hovering their hands.

The tape worked wonders, but we didn’t like hovering as an interaction device — in our last class, Hal showed his work using capacity sensors, where confused and excited users often slam their hands straight on. Assuming touching as human instinct (not very intangible as it turns out), we decided to use three tape areas for touching / tapping (when reading reach threshold), each representing a state of the light: Off, dimmed halfway, full brightness.

[insert image]

Seeking more stable outputs, we wrote a while loop for when lights are triggered to be on (break beam sensor LOW, Capacity sensor 1 or 2 reach threshold), and then determine brightness within. There we have it! Three tap areas controlling brightness based on needs, on top of beam breaker’s detection of seat occupation.

In order to work with real lights, we bought a 12V power supply, a lightbulbs house with lightbulbs, and an AC Dimmer Module. With the help of the Dimmable Light library and its example code, light was lit!

We replaced LED code with dimmable light code, and that’s it. If we had more time in the future, a fade in/out could be added, so that the light’s on/off trigged by the beam breaker can be more subtle. For now, here’s the final code:

#include <CapacitiveSensor.h>
#include <dimmable_light.h>

//dimmer pins
const int syncPin = 3;
const int thyristorPin = 5;
//beam breaker pin
const int sensorPin = 4;
 
int sensorState = 0, lastState=0; 

bool lightState = false;
long measurement1;
long measurement2;
long measurement3;

DimmableLight light(thyristorPin);

CapacitiveSensor sensor1 = CapacitiveSensor(6,2); 
CapacitiveSensor sensor2 = CapacitiveSensor(9,8);
CapacitiveSensor sensor3 = CapacitiveSensor(12,11); 

void setup() {
  pinMode(sensorPin, INPUT);     
  digitalWrite(sensorPin, HIGH);

  Serial.begin(115200);
//dimmable library
  while(!Serial);
  Serial.print("Initializing DimmableLight library... ");
  DimmableLight::setSyncPin(syncPin);
  // Call this method to activate the library
  DimmableLight::begin();
  Serial.println("Done!");
}
 
void loop(){
//beam breaker
  sensorState = digitalRead(sensorPin);   
  if (!sensorState && lastState) {
    //beam is broken, light up
    light.setBrightness(150);
  }
  lastState = sensorState;
 
  if (sensorState == LOW) {     
    measurement1=sensor1.capacitiveSensor(4);
    measurement2=sensor2.capacitiveSensor(4);
    measurement3=sensor3.capacitiveSensor(4);
      if (measurement1 > 600 || measurement2 > 600) {
        lightState = true;
      } else if (measurement3 > 50) {
        light.setBrightness(0);
      }   
    delay(10); 
  } 
  else {
    light.setBrightness(0);
  }

  while (lightState1) {
    sensorState = digitalRead(SENSORPIN);
    measurement1=sensor1.capacitiveSensor(4);
    measurement2=sensor2.capacitiveSensor(4);
    measurement3=sensor3.capacitiveSensor(4);
    if (measurement1 > 600 && sensorState == LOW) {
      Serial.println("LIGHT BRIGHT!");
      light.setBrightness(250);
      delay(100);
    } else if (measurement2 > 600) {
      Serial.println("LIGHT DIM!");
      light.setBrightness(150);
      delay(100);
    } else if (measurement3 > 600
      || sensorState == HIGH){
      Serial.println("LIGHT OUT!");
      lightState = false;
      break;
    }
  }
}

Fabrication, also known as how everything when downhills:

Things went well up until this moment, and we were going filming at a nicer location. We setup the beam breakers on a chair, hung lightbulb from ceiling, and hid the breadboard and messy wires on the back of the chair. Everything ready, code was running, but somehow the lightbulb refused to respond.

Knowing the problem was the light, we tried to plug it into different wall plugs, unsure of if they have enough voltage. HOWEVER, what we didn’t realize was that we TAPED THE AC DIMMER BOARD DIRECTLY ONTO A CONDUCTIVE SURFACE.

BAD!!!!!

Clueless idiot completely unaware of what’s gonna happen

Basically there was a micro explosion which involved an unnecessarily loud noise and what can only be described as a big bundle of bright blue sparks. The dimmer was fried, leaving burn marks on the chair. No nicer video was filmed, and we learned the importance of physics.

RIP chair and dimmer.

resident Arnab checking on the explosion site

Leave a Reply

Your email address will not be published. Required fields are marked *