Phys Comp: Week 2 – Analog sensors, Part 2

This week’s assignment consisted of coming up with a fantasy device, and possibly going crazy using analog sensors. I did both.

First up: the UV-Sunlight watch. This watch detects how much sunlight you’ve received. The benefit to the wearer is that during winter months, you’ll know when you haven’t gotten enough sunlight, and during the summer you’ll know when you’ve gotten too much. I really thought about the design of this one, which may not have been the point, but I do like the final product.

It’s fairly practical and useful, and it was fun to make. But, I would, maybe, agree with the argument that it’s not that fantasmal. Hence, my second fantasy device.

The Unicorner! I learned by the age of six that most humans are incapable of viewing true unicorns. So try as I might, I have never seen a unicorn. My device changes that. This device changes the assumption that there are no unicorns in the world by revealing the true identity of what appear to be ordinary horses, by transforming them into unicorns so that humans can see them! It only works if they were really unicorns to begin with, but it’s only $49.95. It took me under 10 minutes to make, but I added the plastic bag and UPC code later, so maybe 15 minutes of work.

Other ideas included:

  • a camera that takes pictures of your food and reports the nutrition content
  • an alarm clock that mixes smells and sounds, like cinnamon rolls + Paris cafe, and bacon + New York diner.
  • a musical device for orchestra and band students, that plays back a pre-recorded song so that your band leader/conductor can’t tell when you’re playing out of tune. (Note: will not actually help you learn to play an instrument).
  • a remote control to make a parent slower and decreases the volume of their voice
  • an iPhone app that tells you if a store you’re in front of has your size in stock

Finally, I again took apart my teddy bear and hooked up light switches to two FSR sensors. When the hands of the bear are squeezed, the lights come on. But, because I put variable input into the Arduino, it’s difficult to get them both to light up simultaneously. I will add video later.

Code is here.

int ledPinGreen = 10; // Green pin
int ledPinRed = 9; // Red pin
int ledPinWhite = 11; // White pin

int analogFSRLeft = 0; // Left analog input
int analogFSRRight = 1; // Right analog input

int FSRValueLeft = 1; // Value of the left FSR
int FSRValueRight = 1; // Value of the right FSR

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop() {
FSRValueLeft = analogRead(analogFSRLeft); // read the left FSR value
// if FSRValueLeft is under 300
// light nothing
// if FSRValueLeft is between 300 and 600
if( FSRValueLeft > 250 && FSRValueLeft < 375  ){
analogWrite(ledPinGreen, FSRValueLeft/4);
} else {
digitalWrite(ledPinGreen, LOW);
}
Serial.println(FSRValueLeft); // print the FSR value

FSRValueRight = analogRead(analogFSRRight); // read the right FSR value

// if FSRValueLeft is between 300 and 600
if( FSRValueRight > 200 && FSRValueRight < 750  ){
analogWrite(ledPinRed, FSRValueRight/4);
} else { // do nothing
digitalWrite(ledPinRed, LOW);
}

/*  FSRValueRight = analogRead(analogFSRRight); // read the right FSR value
FSRValueLeft = analogRead(analogFSRLeft); // read the left FSR value
if( FSRValueRight > 200 && FSRValueRight < 750) && ( FSRValueLeft > 315 && FSRValueLeft < 380  ){
analogWrite(ledPinWhite,  FSRValueLeft/4,  FSRValueRight/4);
} else { // do nothing
digitalWrite(ledPinRed, LOW);
digitalWrite(ledPinGreen, LOW);
}
*/
Serial.println(FSRValueRight);  // print the FSR value

delay(10); // gives a 10 millisecond delay
}

Leave a Reply

Your email address will not be published.