Monday, April 02, 2007

Final project idea - Affection

Taking care of plant is very difficult. If the person doesn 't take care of the plant, it will die because of the lack of water or sunshine. If the person takes too much care of the plant, such as giving too much water or over extended exposure to sunlight, it will die too. The plant needs proper level of affection to ensure vivid growth and ability to bloom. It is the same in the relationship between people or any life. There should be a certain distance to keep good relationship all the time.

This projects "Affection" is about the relationship between people and plants which also implies the right amount of affection for all relationship. If the user is far away from flowers, the lightings of the flowers will appear to be deem and will produce a dull sound. If the user gets close to the flowers, they will appear to be more bright, and will trigger a fast tempo music. However, if the user moves too much close the flower, it will blink the lights and will produce a high tempo sound; eventually the flowers will suddenly be turned off.

The light and sound are the metaphor of the plant 's life. So, the user will recognize the flowers becoming more alive, based on the brightness of the lights and speed and pitch of the sound. The physical distance will be used to define the affection level because the proper amount of attention is needed for a happy and healthy life. The project will be installed on top of the mirror with several flower shapes of fiber optic. It will be attached a distance sensor to detect the distance between the user and flowers.

Final project idea - center of the universe

When people look at stars on the sky, they are often impressed of how infinite night sky is. They begin to feel like they are the center in the universe. In eastern culture, there are some theories that the life forces of humans create movement in universe. So, if humans are the center point of the universe, then the universe can be moved by the free will of human.
This project will be creating an infinite night sky with lots of star to make people the center of the world, rather the center of the universe. This project will give people the feeling of importance of their identity. To create this universe, small lights, using LED or fiber optic, will be attached on mirrors inside of box. People ' s head will be placed in the box surrounded by hanging lightings

Wedding Cake arduino code for switches, dc motor and mp3 player


int wedCurrentState = 0;
int rightSwitch = 2;//switch that controlls the direction of the servo
int wrongSwitch = 3;
int rightSwitchState = 0;//variable for the switch state
int wrongSwitchState = 0;//variable for the switch state

int servoPin1 = 4; // signal pin for servo motor
int servoPin2 = 5; // signal pin for servo motor
int minPulse =500; // Minimum servo position
int maxPulse = 2500; // Maximum servo position
int pulse = 0; // var for the pulse
int speed1 = 10;//sets the speed of the servo range 0 - 5
int speed2 = 10;//sets the speed of the servo range 0 - 5

long lastPulse = 0; // the time in milliseconds of the last pulse
int refreshTime = 20; // the time needed in between pulses

int dcMotor = 6;

int firstMp3Play = 7;
int firstMp3Forward = 8;
int firstMp3PlayCounter = 0;
int secondMp3PlayCounter = 0;
int thirdMp3PlayCounter = 0;
int fourthMp3PlayCounter = 0;

int firstLayerLEDs = 9;
int secondLayerLEDs = 10;
int thirdLayerLEDs = 11;

//int loveLEDs = 12;
int resetSwitch = 13;
int resetSwitchState = 0;//variable for the switch state

int micDigital = 12; //analogue input
//int microPhone = 1; //analogue input
//int AmpVar = 0;
int micVal = 0;
//int THRESHOLD = 400;
int micCounter = 0;

void setup() {
pinMode(rightSwitch, INPUT);//initialize the switchPin as an INPUT
pinMode(wrongSwitch, INPUT);
pinMode(servoPin1, OUTPUT); // initialize the servo signal pin as an OUTPUT
pinMode(servoPin2, OUTPUT); // initialize the servo signal pin as an OUTPUT
pulse =maxPulse; // Set the motor position value to the minimum

pinMode(dcMotor, OUTPUT);

pinMode(firstMp3Play, OUTPUT);
pinMode(firstMp3Forward, OUTPUT);

pinMode(firstLayerLEDs, OUTPUT);
pinMode(secondLayerLEDs, OUTPUT);
pinMode(thirdLayerLEDs, OUTPUT);

//pinMode(loveLEDs, OUTPUT);
pinMode(micDigital, INPUT);
pinMode(resetSwitch, INPUT);

Serial.begin(9600);//initialize the serial

digitalWrite(firstMp3Play,HIGH);
delay (3000);
digitalWrite(firstMp3Play, LOW);
delay (500);
Serial.println("firstMp3Play was pressed onece - turn on");
}

void loop() {

wrongSwitchState = digitalRead(wrongSwitch);//read the state of the switch
switch (wrongSwitchState){
case 1:
firstMp3PlayCounter = firstMp3PlayCounter+1;
if (firstMp3PlayCounter == 1){
digitalWrite(firstMp3Play,HIGH);
delay (500);
digitalWrite(firstMp3Play, LOW);
delay (5000);
Serial.println("firstMp3Play was pressed twice - play");
digitalWrite(firstMp3Play,HIGH);
delay (500);
digitalWrite(firstMp3Play, LOW);
//digitalWrite(loveLEDs, HIGH);
//delay (1000);
//digitalWrite(loveLEDs, LOW);
Serial.println("firstMp3Play was pressed third - stop");
}

break;
case 0:
firstMp3PlayCounter = 0;
break;
}

rightSwitchState = digitalRead(rightSwitch);//read the state of the switch
switch (rightSwitchState){
case 1:
if(pulse>minPulse){
pulse--;
delay(speed1); // 0-5 slow to fast
}
break;
case 0:
if(pulse 0) {
micCounter = micCounter+1;
}
//micRead();

/*if (micVal>=512){
AmpVar = micVal-512;
}
else {
AmpVar = 512-micVal;
}
micValue = AmpVar; // read the analog input

//Serial.println(AmpVar);
//Serial.println(micVal);

if (AmpVar > THRESHOLD) {
micCounter = micCounter+1;
}
*/


if (micCounter == HIGH){
digitalWrite(dcMotor, LOW);
thirdMp3PlayCounter = thirdMp3PlayCounter+1;
if (thirdMp3PlayCounter == 1){
digitalWrite(firstMp3Forward,HIGH);
delay (500);
digitalWrite(firstMp3Forward, LOW);
delay (500);
Serial.println("firstMp3Forward was pressed onece - mic change");
}
//digitalWrite(loveLEDs, HIGH);
digitalWrite(firstLayerLEDs, LOW);
digitalWrite(secondLayerLEDs,LOW);
digitalWrite(thirdLayerLEDs, LOW);
delay(500);
//digitalWrite(loveLEDs, LOW);
digitalWrite(firstLayerLEDs, HIGH);
digitalWrite(secondLayerLEDs, HIGH);
digitalWrite(thirdLayerLEDs, HIGH);
delay(500);
}

resetSwitchState = digitalRead(resetSwitch);//read the state of the switch

switch (resetSwitchState){
case 1:
Serial.println("resetSwitch on");
micCounter = 0;
firstMp3PlayCounter = 0;
secondMp3PlayCounter = 0;
thirdMp3PlayCounter = 0;
digitalWrite(firstLayerLEDs, LOW);
digitalWrite(secondLayerLEDs,LOW);
digitalWrite(thirdLayerLEDs, LOW);
//digitalWrite(loveLEDs, LOW);
digitalWrite(dcMotor, LOW);
fourthMp3PlayCounter = fourthMp3PlayCounter+1;
if (fourthMp3PlayCounter == 1){
digitalWrite(firstMp3Forward,HIGH);
delay (500);
digitalWrite(firstMp3Forward, LOW);
delay (1000);
Serial.println("firstMp3Forward was pressed onece - change");
digitalWrite(firstMp3Play,HIGH);
delay (500);
digitalWrite(firstMp3Play, LOW);
delay (1000);
Serial.println("firstMp3Play was pressed onece - stop");
}

break;
case 0:
fourthMp3PlayCounter = 0;
break;
}

}

void movetheServo(){
if (millis() - lastPulse >= refreshTime) {
digitalWrite(servoPin1, HIGH); // Turn the motor on
digitalWrite(servoPin2, HIGH); // Turn the motor on
delayMicroseconds(pulse); // Length of the pulse sets the motor position
digitalWrite(servoPin1, LOW); // Turn the motor off
digitalWrite(servoPin2, LOW); // Turn the motor off
lastPulse = millis(); // save the time of the last pulse
}
}

Wedding Cake arduino code for mic

int microPhone = 0; //analogue input
int AmpVar = 0;
int micCounter = 0;
int micCurrentState = 0;
int micPreviousState = 0;
int micVal = 0;
int THRESHOLD = 400;

int resultLEDs = 7;
int resultOutPin = 8;

void setup() {

pinMode(resultLEDs, OUTPUT);
Serial.begin(9600);//initialize the serial
}

void loop() {
micVal = analogRead(microPhone);

if (micVal>=512){
AmpVar = micVal-512;
}
else {
AmpVar = 512-micVal;
}
micVal = AmpVar; // read the analog input

Serial.println(AmpVar);

if (AmpVar > THRESHOLD) {
digitalWrite(resultLEDs, HIGH);
digitalWrite(resultOutPin, HIGH);
delay(1000);
digitalWrite(resultLEDs, LOW);
digitalWrite(resultOutPin, LOW);
delay(1000);
}
}

Wedding Cake proejct URL


how to make flowers with wax papers and LEDs




1. make star shape using 5 ultra white LEDs and make sure connect power and ground of LEDs in parallel.


2. connect to wires and test turning on lights


3. cut wax paper like petals of a flower


4. attach petals to LEDs and make shape like flower



Secret Tree project site


http://itp.nyu.edu/~jsl398/tree/

Wednesday, February 14, 2007

random idea - Secret Tree

When the people confess their secrets to the tree, the secrets make the tree grow, the flowers bloom and the fruits bear. In the book “The Giving Tree” by Shel Silverstein and the movie “In the Mood for Love” by director Wong Kar Wai, the main characters confess their secrets to a tree because it never tells their secrets to other people and it always keep them as long as the tree stays alive.
The project “Secret Tree” listens, interprets and stores people’s secrets in its leaves or fruits with a unique format. Afterwards, their secret is stored in the fruit and through a speaker other people will be able to listen to these secrets in a unique and altered format.


Idea scketch


The First Prototype

Wednesday, February 07, 2007

Do as I told you!


Untie tangled strings!

Friday, February 02, 2007

microphone setup on breadboard


reference : Physical Computing - Dan O'Sullivan and Tom Igoe
Sound Input on a Microcontroller (p.356)
audio amplifier : LM386
capacitor : 220 microparads, 10 microparads, 4.7 microparads
resistor : 1kohm, 10kohm, 100kohm

microphone Arduiono code
int microPhone = 0;
int AmpVar = 0;
int micValue =0;

void setup() {
Serial.begin(9600);
}

void loop() {
micVal = analogRead(microPhone);
if (micVal>=512){
AmpVar = micVal-512;
}
else {
AmpVar = 512-micVal;
}
micValue = AmpVar; // read the analog input
//Serial.println(AmpVar);
resetVal = digitalRead(resetSwitch);

if (micValue >= THRESHOLD) { // check if the input is HIGH (button released)
micCurrentState = 1;
}
else {
micCurrentState = 0;
}
//if(micCurrentState != micPreviousState){
if(micCurrentState == 1){
micCounter = micCounter + 1;
//Serial.println("micCounter = ");
//Serial.println(micCounter);
}
//}
//micPreviousState = micCurrentState;

if (micCounter > 0) {
digitalWrite(candleLEDs, LOW);
delay(100);
}

}

Happy Birthday project 1st prototype code

int firstLayerLEDs = 3;
int secondLayerLEDs = 4;

int candleVal = 0;
int candleSwitch =5;
int switchState = 0; // the state of all situation
int candleLEDs = 6;
int microPhone = 0;
int AmpVar = 0;
int micValue =0;
int micCounter = 0;
int micCurrentState = 0;
int micPreviousState = 0;

int resetVal = 0;
int resetSwitch = 7;

int micVal = 0;
int statePin = HIGH;
int THRESHOLD = 20;

int relay1 = 8; // select the realy pin for mp3 player
int relay2 = 9;
int relay3 = 10;

int firstCounter = 0;
int secondCounter = 0;
int thirdCounter =0;

void setup() {
pinMode(firstLayerLEDs, OUTPUT);
pinMode(secondLayerLEDs, OUTPUT);
pinMode(candleSwitch, INPUT);
pinMode(candleLEDs, OUTPUT);
pinMode(resetSwitch, INPUT);
pinMode(relay1, OUTPUT); // declare the relay Pin as an OUTPUT
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);

Serial.begin(9600);
}

void loop() {
candleVal = digitalRead(candleSwitch);
micVal = analogRead(microPhone);
if (micVal>=512){
AmpVar = micVal-512;
}
else {
AmpVar = 512-micVal;
}
micValue = AmpVar; // read the analog input
//Serial.println(AmpVar);
resetVal = digitalRead(resetSwitch);

if (micValue >= THRESHOLD) { // check if the input is HIGH (button released)
micCurrentState = 1;
}
else {
micCurrentState = 0;
}
//if(micCurrentState != micPreviousState){
if(micCurrentState == 1){
micCounter = micCounter + 1;
//Serial.println("micCounter = ");
//Serial.println(micCounter);
}
//}
//micPreviousState = micCurrentState;



if (switchState == 0) {
thirdCounter = 0;
secondCounter =0;
firstCounter= firstCounter + 1;
if (firstCounter == 1){
digitalWrite(relay1,HIGH);
delay (500);
digitalWrite(relay1, LOW);
//delay (500);
//digitalWrite(relay3,HIGH);
//delay (500);
//digitalWrite(relay3, LOW);
//delay (3000);
Serial.println("relay2 & relay3, each was pressed once");
}

digitalWrite(firstLayerLEDs, HIGH);
digitalWrite(secondLayerLEDs, HIGH);
digitalWrite(candleLEDs, LOW);
delay(100);
}
//if (candleVal == HIGH && micValue < THRESHOLD) {
if (candleVal == HIGH && micCounter == 0) {
switchState = 1;

}
if (switchState == 1) {
firstCounter =0;
thirdCounter =0;
secondCounter= secondCounter + 1;
if (secondCounter == 1){
digitalWrite(relay1,HIGH);
delay (500);
digitalWrite(relay1, LOW);
//delay (3000);
Serial.println("relay2 was pressed onece");
}

digitalWrite(firstLayerLEDs, HIGH);
digitalWrite(secondLayerLEDs, HIGH);
digitalWrite(candleLEDs, HIGH);
delay(100);
digitalWrite(firstLayerLEDs, HIGH);
digitalWrite(secondLayerLEDs, HIGH);
digitalWrite(candleLEDs, HIGH);
delay(100);
}
//comment your code!
if (candleVal == HIGH && micCounter > 0) {
switchState = 2;
}
if (switchState == 2) {
firstCounter = 0;
secondCounter = 0;
thirdCounter= thirdCounter + 1;
if (thirdCounter == 1){
digitalWrite(relay1,HIGH);
delay (500);
digitalWrite(relay1, LOW);
//delay (3000);
Serial.println("relay1 was pressed once");
}

digitalWrite(firstLayerLEDs, LOW);
digitalWrite(secondLayerLEDs, LOW);
digitalWrite(candleLEDs, LOW);
delay(100);
}


//if (resetVal == 0) {
//if (resetVal == 0 || candleVal == LOW) {
if (candleVal == LOW) {
switchState = 0;
micCounter = 0;
}
}


/*
when the cake is built all lights are on

when the candle is blown all lightw go off

*/

Happy Birthday project 1st prototype picture and movie





Happy Birthday project prototype picture and video




Happy Birthday project prototype code without mp3 function

int firstLayerLEDs = 3;
int secondLayerLEDs = 4;

int candleVal = 0;
int candleSwitch = 5;
int switchState = 0; // the state of all situation
int candleLEDs = 6;
int microPhone = 0;
int AmpVar = 0;
int micValue =0;
int micCounter = 0;
int micCurrentState = 0;
int micPreviousState = 0;

int resetVal = 0;
int resetSwitch = 7;

int micVal = 0;
int statePin = HIGH;
int THRESHOLD = 100;

void setup() {
pinMode(firstLayerLEDs, OUTPUT);
pinMode(secondLayerLEDs, OUTPUT);
pinMode(candleSwitch, INPUT);
pinMode(candleLEDs, OUTPUT);
pinMode(resetSwitch, INPUT);

Serial.begin(9600);
}

void loop() {
candleVal = digitalRead(candleSwitch);
micVal = analogRead(microPhone);
if (micVal>=512){
AmpVar = micVal-512;
}
else {
AmpVar = 512-micVal;
}
micValue = AmpVar; // read the analog input
Serial.println(AmpVar);
resetVal = digitalRead(resetSwitch);

if (micValue >= THRESHOLD) { // check if the input is HIGH (button released)
micCurrentState = 1;
}
else {
micCurrentState = 0;
}
//if(micCurrentState != micPreviousState){
if(micCurrentState == 1){
micCounter = micCounter + 1;
Serial.print("micCounter = ");
Serial.println(micCounter);
}
//}
//micPreviousState = micCurrentState;



if (switchState == 0) {
digitalWrite(firstLayerLEDs, HIGH);
digitalWrite(secondLayerLEDs, HIGH);
digitalWrite(candleLEDs, LOW);
delay(100);
}
//if (candleVal == HIGH && micValue < THRESHOLD) {
if (candleVal == HIGH && micCounter == 0) {
switchState = 1;
}
if (switchState == 1) {
digitalWrite(firstLayerLEDs, HIGH);
digitalWrite(secondLayerLEDs, HIGH);
digitalWrite(candleLEDs, HIGH);
delay(100);
digitalWrite(firstLayerLEDs, HIGH);
digitalWrite(secondLayerLEDs, HIGH);
digitalWrite(candleLEDs, HIGH);
delay(100);


}
//comment your code!
if (candleVal == HIGH && micCounter > 0) {
switchState = 2;
}
if (switchState == 2) {
digitalWrite(firstLayerLEDs, LOW);
digitalWrite(secondLayerLEDs, LOW);
digitalWrite(candleLEDs, LOW);
delay(100);
}


//if (resetVal == 0) {
if (resetVal == 0 || candleVal == LOW) {
switchState = 0;
micCounter = 0;
}
}


/*
when the cake is built all lights are on

when the candle is blown all lightw go off

*/

Thursday, January 25, 2007

Happy Birthday Blocks mockups


Sunday, January 21, 2007

example and idea of FSM



Idea of Finite State Machine
Knob Puzzle The knob puzzle is consisted by basic diagrams such as square, triangle, circle, and star. When the piece of the puzzle is inserted in the right place, the user will get instant feedback from lights and sound. Also, the user will get finish feedback when he or she completes the puzzle.

Finite State Machine

A finite state machine (FSM) or finite state automaton (plural: automata) is a model of behavior composed of a finite number of states, transitions between those states, and actions. A state stores information about the past, i.e. it reflects the input changes from the system start to the present moment. reference : http://en.wikipedia.org/wiki/Finite_state_machine