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!


Smart Coaster

Project Members: 
Anirban Sen

For this lab assignment, I created a "Smart Coaster". This device will be used in gatherings and party situations. It may also be used in a club/bar scene. The FSR is attached to the coaster, and the LEDs and Piezo speaker can also be attached. When the drinker has finished his or her drink, he or she will place the empty glass on the coaster. The weight of the empty glass will be sensed by the FSR and translated to LED and Piezo Speaker Output. This is the simultaneous input and output device that the assignment was specifying.


Components:

Arduino Microprocessor
LEDs
Piezo Speaker
FSR
Coaster
Arduino programming environment

Code:


int sensorPin = 0;  // select the input pin for the sensor
int speakerPin = 7; //select the input for the speaker
int ledPin1 = 9;    // select the output pin for the LED
int ledPin2 = 10;
int ledPin3 = 11;
int val = 0;        // variable to store the value coming from the sensor
int FSRPin = 0;  //to store value from FSR

void setup() {
  beginSerial(9600);
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(speakerPin, OUTPUT);
}
void loop() {
  FSRPin = analogRead(FSRPin); //read value from FSR
  analogWrite(ledPin1, val/4);  // analogWrite (dimming the LED) can be between 0-255
  analogWrite(ledPin2, val/4);
  analogWrite(ledPin3, val/4);
 
  if(FSRPin>50){
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(val);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(val);
  }
}


AttachmentSize
Assignment5_1.JPG115.77 KB
Assignment5_2.JPG127.18 KB

Comments

nice, I hope some day I will

nice, I hope some day I will never see an empty beer glass again with this!


Powered by Drupal - Design by Artinet