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!


The Cup is Half Full

Project Members: 
Matt Chew Spence

Description

For this assignment I created a plastic cup that would light if if it was half full or greater, based on the output of an FSR. It was constructed of two plastic cups, the outer one with holes in it for the FSR wires and the LED, and the inner one with a phillips machine screw taped to the bottom of it to activate the FSR. The inner cup was placed within the outer cup, and then the inner cup was filled over halfway with water. Unfortunately, the inner cup experienced some structural integrity problems and the FSR was lost, although the LED continued to work while accidentally submerged.

Parts Used

  • 1 ea Arduino board
  • 1 ea Breadboard
  • 1 ea 220 ohm resistor
  • 1 ea 10K ohm resistor
  • 1 ea FSR (RIP)
  • 2 ea plastic cups
  • 1 ea Phillips machine screw
  • 6 oz water

Arduino Code

/*
*
* If the cup is half full or more, the LED lights
*
*/
int sensorPin = 0; // select the input pin for the sensor
int ledPin = 13; // select the output pin for the LED
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(sensorPin); // read the value from the sensor, 0-1023
if(val>= 500) {
analogWrite(ledPin, 255); // analogWrite (dimming the LED) can be between 0-255
} else {
analogWrite(ledPin,0);
}
Serial.println(val); // writing the value to the PC via serial connection
delay(50); // rest a little...
}

Images

 


Comments

red is such a manic color if

red is such a manic color if you're to see the cup as half full. how about the more calming blue? :) Nice work!


Powered by Drupal - Design by Artinet