Announcements

November 24, 2007
Reading for November 27th, are now posted. Enjoy!

October 2, 2007
To upload your thoughtless acts, create a new assignment page like any other lab. You'll see "Thoughtless Acts" listed as one of the assignment options.

May 24, 2008
This site has been archived and is no longer editable. Stay tuned for the next version, coming in the fall!


Lab5- Enchanting Tentacles

Project Members: 
Hsin-Hsien Chiu

Description: Enchanting Tentacles

Since hiding wires has become an issue in past exercises, I start to think about what kind of interface could really overcome, even taking advantage of it. A dazzling jellyfish—having enchanting tentacles allowing to be squeezed to change and mix colors— could emit sound and various lights through the translucent body and cap. When approaching its cap, the rhythm of the sound and color would be fluctuating.  

Components: 

Two force pressure resistors, two photocell sensor, Arduino board, breadboard, wires, three RGB LEDs, one silicon model

Arduino Code:

/*

 * Resistive Sensor Input

 * Takes the input from a resistive sensor, e.g., FSR or photocell

 * Dims the LED accordingly, and sends the value (0-255) to the serial port

 */ by Hsin-Hsien Chiu, 2007

int sensor1Pin = 0;  // select the input pin for the sensor

int sensor2Pin = 1;

int sensor3Pin = 2;

int sensor4Pin = 3;

int TargetLED = 11; // start from Blue LED

int BluePin = 11;    // select the output pin for the LED

int GreenPin = 10;

int RedPin = 9;

int speakerPin = 7;

int sensor1val = 0;        // variable to store the value coming from the sensor

int sensor2val = 0;

int sensor3val = 0;

int speakerval = 0;


void setup() {

  Serial.begin(9600);
  pinMode(speakerPin, OUTPUT);
  beginSerial(9600);
  Serial.println("ready");

}

void loop() {
 
  digitalWrite(speakerPin, LOW);

  sensor1val = analogRead(sensor1Pin); // read the value from the sensor, 0-1023

  sensor2val = analogRead(sensor2Pin);

  sensor3val = analogRead(sensor3Pin);

  speakerval = analogRead(sensor4Pin);    // read value from the sensor
  speakerval = speakerval*2;                 // process the value a little
 
  for( int i=0; i<500; i++ ) {  // play it for 50 cycles
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(speakerval);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(speakerval);
  }

 

 //To make the light flow between 3 LED, there are five ranges starting from B-G-R-G-B as smiliar to a circle

   if (sensor3Pin > 801) TargetLED = 11;       // the range 801 - 1024 is for Green LED        

   else if (sensor3Pin > 601) TargetLED = 10;  // the range 601 - 800 is for Green LED

   else if (sensor3Pin > 401) TargetLED = 9;   // the range 401 - 600 is for Red LED

   else if (sensor3Pin > 201) TargetLED = 10;  // the range 201 - 400 is for Green LED

   else TargetLED = 11;                     // the range 0 - 200 is for Blue LED

 

  analogWrite(BluePin, sensor1val/4);  // analogWrite (dimming the LED) can be between 0-255

  analogWrite(GreenPin, sensor2val/4);

  analogWrite(RedPin, sensor3val/4);

  Serial.println(sensor1val/4);       // writing the value to the PC via serial connection

  Serial.println(sensor2val/4);

  Serial.println(sensor3val/4);

  delay(50);                   // rest a little...

}


Movies:

http://www.youtube.com/watch?v=OyU3nYW40Vc

Images:

http://photo.xuite.net/berkeleychiu/2037373/1.jpg

http://photo.xuite.net/berkeleychiu/2037373/2.jpg 

http://photo.xuite.net/berkeleychiu/2037373/3.jpg

http://photo.xuite.net/berkeleychiu/2037373/4.jpg


AttachmentSize
PA040009-s.jpg42.19 KB
PA040010-s.jpg52.53 KB
PA040011-s.jpg40.69 KB
PA040012-s.jpg53.07 KB

Powered by Drupal - Design by Artinet