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!


Lab 4 Tangible Micro Ecosystem-The Living Pine Cone

Project Members: 
Hsin-Hsien Chiu

Description:

The Living Pine Cone

The Living Pine Cone is a micro interactive ecosystem. There is a small, colorful songster living with her lovely Pine Cone, lying above comfortable green leaves. The tiny baby cone attached aside is her favorite treasure. The little songster is so shy that when you touch her back, she will hide herself without emitting the original blue color. However, when pushing her favorite baby cone closer, she will be very exciting and emitting red color to mix into the original blue. When pushing leaves above the large pine cone, the little songster will feel comfortable with mixed green color.

Components:

The little songster: been shells, flexible metal bars

two pine cones, leaves, two force pressure resistors, one photocell sensor, Arduino board, breadboard, wires, 3 RGB LEDs.

Movie:

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

Images:

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

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

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

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

http://photo.xuite.net/berkeleychiu/2021552/5.jpg 

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

 */

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

int sensor2Pin = 1;

int sensor3Pin = 2;

int TargetLED = 11; // start from Blue LED

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

int GreenPin = 10;

int RedPin = 9;

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

int sensor2val = 0;

int sensor3val = 0;

 

void setup() {

  Serial.begin(9600);

}

void loop() {

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

  sensor2val = analogRead(sensor2Pin);

  sensor3val = analogRead(sensor3Pin);

 

 //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...

}

 


AttachmentSize
P9270075-s.jpg60.92 KB
P9270076-s.jpg56.94 KB

Comments

excellently combining the

excellently combining the things we have learned so far, hsin-hsien! this is a fantastic lab project and I'm so glad you shared it with us during class.


Powered by Drupal - Design by Artinet