Making Things Interactive

March 25, 2008

Final Project Proposal

Filed under: Assignments,Tiffany Yang — tyang1 @ 9:43 am

My project is the niTe liTe, a smart night table that lights up when the user wants it to. Final Project Proposal


March 23, 2008

Night Table State Machine

Filed under: 8: State Machine,Assignments,Tiffany Yang — tyang1 @ 9:15 am

For the state machine assignment I thought I should do something relevant to my final project. This is the state machine representing my Night Table idea. I simplified it a little. When the room is bright, the table is in its off state. When the room is dark, the table initializes and starts a series of actions which is shown in the state machine. The 4(? or is waiting not considered a state..anyway) states are 1. Table lights are off 2. Table lights are DIM 3. Table lights are BRIGHT 4. waiting. Night Table State Machine Schematic

March 8, 2008

The Big Black Bag

Filed under: 7: Mid-Term Project,Tiffany Yang — tyang1 @ 5:42 pm

The Big Black Bag has two functions: (1) when the zipper is unzipped, lights inside the bag light up; (2) when my cellphone rings, the bag vibrates.  If I am not holding the bag, a LED on the bag will light up.  If I am holding the bag, the LED will not light up since I cannot see it anyway. 


For the zipper portion of the interactive bag, I did not use any code for it.  It is a physical switch that connects when the bag is unzipped.  I sewed conductive thread at the ends so when the zipper reaches the ends, it is connecting the circuit and the LEDs in the bag light up. 

Conductive thread sewn in

Zipper connecting circuit

LEDs lit in bag

Cellphone Ring

For the cellphone ring portion, I sewed the lilypad vibe board in the shoulder straps as well as a push button so my arduino knows when I am holding the bag or not.  If I am holding the bag, the push button is pushed (input = LOW).  If I am not holding the bag, the push button is released (input = HIGH).   To know whether my celllphone is ringing or not, I wanted to use an RF sensor but there is none out there that is off-the-shelf.  I tried buying this key chain for $0.89 which is suppose to detect cellphone rings and then light up but it did not work.  So instead, I used a photosensor to detect incoming cellphone calls since all cellphones light up when it receives a call. 

Testing Code:

Testing photosensor response to cellphone LCD:

Shoulder Strap

shoulder strap embedded w/ vibe board & pushbutton:

Image of front of bag

Inside pockets of Bag


Battery Holder

 A Working Bag…

has not been produced yet.  I used conductive thread and solid wire to make the connections which is something I learned NOT to do.  After putting the bag together nothing worked.  It seems like the connections are not solid and the programming is a bit faulty.  I decided to test the circuit and code again by going back to the breadboard.  Individually the push button and vibe board circuit and the photosensor work but together they do not work.  I don’t understand why.  If someone can figure that one out please let me know.  In the meantime I am going code it a different way.

What not to do

Circuit Schemtic

Breadboard Circuit

Code for the breadboard circuit:

 /* This sketch describes how the BIG BLACK BAG behaves when there is an incoming cellphone call.  
 When there is an incoming call the shoulder strap will vibrate and: 
 (a) if the bag is being carried, the LED on an accessory pin will NOT light up
 (b) if the bag is NOT being carried, the LED on an accessory pin will light up

int photoPin = 0;                               // sets photosensor to analog 5
int val = 0;                                    // variable for storing the value coming from photosensor
int light = 0;                                  // variable for reading photosensor 
float sens = .85;                               // defines sensitivity of the photocells (0 - 1.0 "always on")

int vibe = 5;                                   // sets vibe board to digital 1
int triLed = 7;                                 // sets LEDs to digital 7
int buttonPin = 13;                              // sets input pin for pushbutton to digital 13
int buttonVal = 0;                              // variable for reading the button status

void setup() {  

  pinMode(photoPin, INPUT);                     // declare photosensor near zipper as input
  light = analogRead(photoPin);                 // reads initial state of photosensor i.e. retrieves ambient light value
  pinMode(vibe, OUTPUT);                        // declare vibe as an output
  pinMode(triLed, OUTPUT);                      // declare the triPin as an output 
  pinMode(buttonPin, INPUT);                    // declare photosensor as input 

void loop() {  

  val = analogRead(photoPin);                           // reads resistance from photosensor i.e light value 
  buttonVal = digitalRead(buttonPin);                   // read input value from button

    if ((val > light*sens) && buttonVal == HIGH) {      // If amount of light is larger than threshold & button is released (HIGH)
    digitalWrite(vibe, HIGH);                           // turn vibe board on ...
    digitalWrite(triLed, HIGH);                         // turn LED on.

  if ((val > light*sens) && buttonVal == LOW) {         // If amount of light is exceeds threshold & button is pressed (LOW)
    digitalWrite(vibe, HIGH);                           // turn vibe board on ... 
    digitalWrite(triLed, LOW);                          // turn LED on.
  else {                                                // when there is no incoming call (inactive state)...
    digitalWrite(triLed, LOW);                          // LEDs are off 
    digitalWrite(vibe, LOW);                            // vibe board is off


February 28, 2008

Midterm Project – The Big Black Bag

Filed under: Assignments,Tiffany Yang — tyang1 @ 1:36 am

Women like to carry big bags…and when the interior is black it is difficult to find anything. I want to design a “smart” bag that lights up inside when the bag is unzipped. Basically I will stick a photosensor right by the zipper so it will sense light when the bag is opened. Another problem with shoulder bags is that when people are walking around in a busy area they cannot feel or hear their cell phones if it rings or vibrates. My Big Black Bag will vibrate when it detects an incoming call. The bag will have a vibe board and photosensor in its shoulder straps and also on the strap, there is a decorative pin with LEDs. The photosensor is to sense if someone is carrying the bag. It will be on the bottom side of the shoulder strap so that way if someone is carrying the bag on her shoulders, the photosensor will be blocked. When my cell phone rings, the shoulder straps will vibrate and the decorative pin will light up only if someone is not carrying the bag. This is because when someone is carrying the bag they are walking and not looking at the bag so it is a waste of battery for the LEDs on the pin to light up. The LEDs on the decorative pins are tri-colored LEDs. So when the cellphone rings for 10 seconds, the LEDs will be blue. If the person does not pick up, and continues to ring for another 20 seconds, the LEDs will be green. If the person still does not pick up, the LEDs will be red. I will determine exactly how long it will ring before changing to a different color later. An RF sensor will detect the cell phone ringing that will pickup transmissions from my cell phone when there is an incoming call.

State Diagram


Bag layout

Code Sketches
• Light Inside Bag
If photosensor detects light, then LEDs turn on. Else, LEDs stay off.
• Cellphone Ring
If RF frequency within 800 – 1200MHz is detected, then vibe board vibrates in pulses for 2 minutes. If RF frequency within 800 – 1200 MHz is detected && photosensor in strap is not blocked, LEDs on shoulder strap will turn on. Otherwise LEDs on shoulder strap will stay off.

Parts List:
• Arduino Lillypad main board
• Arudino Lilypad vibe board
• 2 – Photosensors
• 4 resistors
• 4 – LEDs
• 1 – 5V battery
• conductive thread
• clothe & padding
• RF sensor (being shipped)
• 5 – Tri-colored LEDs (being shipped) 

Schematic of Circuit 

February 19, 2008

Spinning Color Wheel and Servo Motor

Filed under: 6: More Motion,Tiffany Yang — tyang1 @ 3:19 pm

Originally I wanted to create a drive belt that had numbers on them with a DC motor and rubber band. This would be a game where a solenoid controlled by a button would hit the numbers as they moved by.  The higher the numbers the more points you get.  However, the DC motor with 9V could not take any load.  When I put the rubber band on the motor, it stalled the motor.  Plus I could not get the solenoid to work.  So I moved to a new plan.  I couldn’t think of anything except sticking a color wheel on the DC motor.  The DC motor is controlled by a potentiometer so the faster you turn the potentiometer, the more merging of colors you get.  Since we had to control two things, I decided to control a servo motor.  I could not think of anything cool to do with the servo motor so all I ended up with is a spinning color wheel and servo motor.  The servo motor on its own works well but with the DC motor, the servo motor’s movement is a bit jerky.  I am guessing it is from the noise of the DC motor.         

int motPin = 9; // sets base of motor transistor to PWM 9
int potPin = 0; // sets potentiometer to analog 0
int potValue = 0; // value returned from the potentiometer

int servoPin = 3; // sets servo control pin to PWM 3
int angle;
int pulseWidth; // amount to pulse the servo

void servoPulse(int servoPin, int angle) { // creating a subroutine
pulseWidth = (angle * 9) + 300; //
digitalWrite(servoPin, HIGH); // turn servo on
delayMicroseconds(pulseWidth); // length of pulse sets the motor position
digitalWrite(servoPin, LOW); // turn servo off

void setup() {
pinMode(motPin, OUTPUT); // sets motor transistor pin as output
pinMode(potPin, INPUT); // sets potentiometer pin as input
pinMode(servoPin, OUTPUT); // sets servo transistor pin as output

void loop() {
potValue = analogRead(potPin) / 4; // read potentiometer, convert to 0 – 255
analogWrite(9, potValue); // use potentiometer to control motor

for (angle = 0; angle <=180; angle++) { // for eaching angle from 0 to 180... servoPulse(servoPin, angle); // call subroutine } delay(1000); }[/sourcecode]    

February 12, 2008

Controlling a DC motor and Solenoid

Filed under: 5: Making Motion,Tiffany Yang — tyang1 @ 9:17 pm

My project uses a potentiometer to change the speed of the motor.  On a different pin, a solenoid is just opening and closing.       

int MotPin = 9;                                  // sets base of motor transistor to PWM 9
int potPin = 0;                                  // sets potentiometer to analog 0
int potValue = 0;                                // value returned from the potentiometer

int SolPin = 1;                                  // sets base of solenoid transistor to digital 1
int switchPin = 3;                              // sets switch pin to digital 3
int switchStatus;                                // status of the switch

void setup() {
  pinMode(MotPin, OUTPUT);                       // sets motor transistor pin as output
  pinMode(potPin, INPUT);                        // sets potentiometer pin as input
  pinMode(SolPin, OUTPUT);                       // sets solenoid transistor pin as output
  pinMode(switchPin, INPUT);                     // sets switch pin as input

void loop() {
  potValue = analogRead(potPin) / 4;             // read potentiometer, convert to 0 - 255
  analogWrite(9, potValue);                      // use potentiometer to control transistor

  switchStatus = digitalRead (switchPin);        // reads status of switch
  if (switchStatus == HIGH) {                    // If switch is pressed...
    digitalWrite(SolPin, HIGH);                  // turn solenoid on
    Serial.println("button pressed");
    else {                                       //  otherwise ... 
    digitalWrite(SolPin, LOW);                   // turn solenoid off
    Serial.println("button not pressed");


February 5, 2008


Filed under: 4: Counting Sensor Input,Tiffany Yang — tyang1 @ 8:49 am

Since my project has to do with light in a night table, I thought the first step would be to use a photosensor. When light is detected, my arduino will say good night.

int ledPin = 13;                //sets LEDs to pin 13
int photoPin = 0;               //photoresistor connected to Analog 0
int light;                      //variable for reading photosensor
int photoState;                 //variable to hold the state of the sensor
int lightPresses;               //how many times the light is turned off or on

void setup() {
  pinMode(ledPin, OUTPUT);             //set the ledPin as an Output
  Serial.begin(9600);                  //set up Serial Library at 9600 bps
  pinMode(photoPin, INPUT);            //sets photoresistor as INPUT
  photoState = analogRead(photoPin);   //read the initial state of photosensor

void loop() {
  light = analogRead(photoPin);        // reads resistance from the sensor
  if (light != photoState) {
    if (light &lt;= 500) {                  //if there is no light
      digitalWrite(ledPin, HIGH);          // LEDs turn on
      Serial.print("Goodnight for the ");
      Serial.println("th times");
    else {                               //if there is light
      digitalWrite(ledPin, LOW);         //LEDs are off
  photoState = light;

January 28, 2008

Term Project

Filed under: 2: Term Project Idea,Tiffany Yang — tyang1 @ 11:21 pm

For my term project I want to make a “smart” night table.  Every time I shut the lights before going to bed I have to stumble over stuff and the same goes for when I wake up.  At first I thought it would be a simple light sensor but then there are issues such as how does it know when I am in my bed so that it can turn off OR that I am awake in the morning to turn on.  

Lady Ada tutorial

Filed under: 3: LadyAda Tutorials,Tiffany Yang — tyang1 @ 11:05 pm
Tutorial 4
 * Drive size calculator!

int drive_gb = 100;
long drive_mb;

void setup()                    // run once, when the sketch starts
  Serial.begin(9600);           // set up Serial library at 9600 bps

  Serial.print(“Your HD is “);
  Serial.println(” GB large.”);

  drive_mb = drive_gb;          // temp result is stored as long instead of int
  drive_mb = 1024 * drive_gb;

  Serial.print(“It can store “);
  Serial.println(” Megabytes!”);

void loop()                 // we need this to be here even though its empty


protoshield on top of microcontroller

January 18, 2008

Interactive Kitchen

Filed under: 1: Post Something Interesting,Tiffany Yang — tyang1 @ 10:16 pm

Interactive Kitchen at MIT’s Media Lab   Since the assignment is to find an inspiring example I thought to post what inspired me.  This is the kitchen I walked by (about 5 years ago) in the MIT Media Lab and thought it was cool.  I find myself wondering to my kitchen aimlessly about 100 times a day that it has become so routine to me. What I like about this interactive kitchen is that it re-thinks how people interact with the traditional kitchen.  Instead of testing the faucet to see if the water is cold or hot, the color (blue/red) of the spout tip eliminates that step and lets the user know visually how hot/cold the water coming out is.  Another thing I constantly do that is not very friendly to the environment is open and close the fridge just to see what’s there.  This interactive kitchen projects on the door an image of what is inside.  Here is website that has more images and where I also took the main image from.  While looking for this I also found this dishmaker which has nothing to do with this assignment but I thought it was cool.  When I first saw this kitchen, I wish I had done it but at that time (a sophmore) I did not think it was possible.  For my project I was thinking of making a water fountain that adjusts for height.  This way it eliminates the need (and the stigma) for two water fountains side-by-side one of which is for handicapped people.  And perhaps it can even go so low as for a pet to drink from.  While looking at this kitchen again for this assignment, I found that it had an adjustable sink (the video is a bit repetitive).  Perhaps I can learn from their idea.

Create a free website or blog at