NightWatch
The Sensor
We tried to imagine how one (such as a teenager) might be able to disguise something as large as the infrared sensor combined with the Arduino. We decided to contain the Arduino within a stuffed animal decoration and used the infrared sensor as the stuffed animal's eyes. Given a better way to hide wires, a parent may see this as no more than a teenager's quirky decoration, rather than a security measure.
The Lamp
From the beginning of this concept, we wanted the lamp to be something that was comforting and tactile to help soothe the user's anxiety, or to blend into their private environment. We considered stuffed animals, soft, wireless night-lights; as well as a pillow. Initially, we wanted to create character with this lamp by animating a face into the light patterns, but after seeing how soothing the LED strip was as the light circulated and diffused throughout the pillow, we left the lamp's output as simple, yet beautiful. We decided on the shades of pink and blue not because they were close to the Pantone Colors of the Year (Rose Quartz and Serenity) but because they were soothing, yet very different without eliciting a negative implication about someone approaching the door (such as what would happen with the cultural implications of red vs. green.)
Demonstration Video: https://vimeo.com/169809394
Design 387 - NightWatch, by Holly Chan and Ying Zheng from Holly Chan on Vimeo.
The Final Code:
Through online research of DotStar LED strip’s library and example codes of NeoPixel LED strip, Ying figured out how to control the brightness, and she built a small library of RGB colors in the code. The final code is below the cut:
For Bat Sensor:
void setup()
{
Serial.begin(9600);
}
void loop(){
int sensorValue=analogRead(A0);
int value=map (sensorValue, 0, 560,0,255);
Serial.write(value);
delay(300);
}
For Pillow Lamp:
#include <Adafruit_DotStar.h>
#include <SPI.h>
#include <stdio.h>
# include<stdlib.h>
#define NUMPIXELS 30
int value;
#define DATAPIN 11
#define CLOCKPIN 13
Adafruit_DotStar strip = Adafruit_DotStar(
30, 11, 13, DOTSTAR_BGR);
void setup() {
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000L)
clock_prescale_set(clock_div_1);
#endif
Serial.begin(9600);
strip.begin();
strip.show();
}
int head = 0, tail = -10;
void loop() {
uint32_t red, blue, green, yellow, purple, pink, orange, steel, blush, rose;
int mycolors [10] = {red, blue,green,yellow, purple, pink, orange, steel, blush, rose};
red = strip.Color(255,0,0);
blue = strip.Color(0,0,255);
green = strip.Color(0,255,0);
yellow = strip.Color(255, 255, 0);
pink = strip.Color(139, 99, 108);
orange = strip.Color(255, 135, 0);
blush = strip.Color(255, 240, 245);
steel = strip.Color(70, 130, 180);
purple = strip.Color(180, 112, 214);
rose = strip.Color(205, 92, 92);
if (Serial.available() > 0) {
value=Serial.read();
Serial.print("value is ");
Serial.println(value);
if(value>=100){
strip.setBrightness(value);
strip.setPixelColor(head, rose);
strip.setPixelColor(tail, 0);
strip.show();
delay(value/30);
if(++head >= NUMPIXELS) {
head = 0;
}
if(++tail >= NUMPIXELS) tail = 0;
}
if(45<=value && value<100){
strip.setBrightness(value-15);
strip.setPixelColor(head, purple);
strip.setPixelColor(tail, 0);
strip.show();
delay(value);
if(++head >= NUMPIXELS) {
head = 0;
}
if(++tail >= NUMPIXELS) tail = 0;
}
if(value<45){
strip.setBrightness(15);
strip.setPixelColor(head, steel);
strip.setPixelColor(tail, 0);
strip.show();
delay(300);
if(++head >= NUMPIXELS) {
head = 0;
}
if(++tail >= NUMPIXELS) tail = 0;
}
}
}
No comments:
Post a Comment