Sometime between the age of 10 (when what scientists call the "ew boys" phase*) and death, most people lose that childish lack of inhibitions. A facsimile of this not giving a crap can be found through the help of alcohol (often needing copious amounts). My project seeks to help people change this behaviour, if only for a short time.
The basic idea of my project is that people are in a dark room, milling about. Everyone is wearing a strange belt. With different movements, various things happen in the room. If a user (to borrow from some CS lingo here) stands very still, slowly blue flowers begin to light up around him. With the rising lights, a soft, mellow bass line starts playing in his vicinity. Another user, standing some distance away, nervously shifts from leg to leg. This slight swinging of her hips starts to light up greenery around her and a jaunty melody plays. Seeing this, she shakes her hips more because it's a VERY catchy song that makes you have to dance. Some distance away, two users are talking to each other, hear the music from the green plants and start dancing, because let's face it, this is hypothetical and that music is REALLY catchy. The red flowers around them light up due to their closeness and there you go! it's a magic music jungle! The users then try all different kinds of actions to light up more colors, but they just look silly because there are only three colors in this jungle.
Obviously I could not illustrate the music. For the purposes of presenting in this class, I will implement the shaker (basically the accelerometer), and the lack of shaking (basically no movement and the blue light turns on slowly), and the proximity of another person with a magnet and the magnetic sensor. That will turn on the red led slowly. None of the lights will go off until reset. In my fully realized implementation of this, the lights would go off slowly with no movement and the blue ones would only start turning off when all the others were. But by slowly I mean over a period of about 20 - 30 minutes.
To add a little fun to this setup, the users will also be able to affect the brightness of the jungle. Calibrating for ambient noise (including the level of the music the plants themselves are emitting), as the level of noise in the room rises, so, too, will the brightness of the lights. This will provide a fun experiment to see if people will get louder as the visual noise of the flowers gets louder. Since we don't have a noise sensor, the serial input of !!!!!'s will be a substitute.
Here are the sensors I will be using. This is a hall effect magnetic sensor. It will be affecting the red lights.
The other sensor is an accelerometer
This will be connected to the green lights.
Here is my code:
Since I accidentally burned out my red LED, the yellow LED will substitute as the blue lights, and the green will act as the red ones and the green ones. My LED meter will act as a noise level.
int accX = A0;
int accY = A1;
int accZ = A2;
float xVal,
yVal,
zVal;
int mag = A7;
float magVal;
int ledG = 9;
int ledY = 10;
int ledRval;
int ledGval;
int ledBval;
int ledMeter;
int i;
//bar graph
int led_0 = 30;
int led_1 = 31;
int led_2 = 32;
int led_3 = 33;
int led_4 = 34;
int led_5 = 35;
int led_6 = 36;
int led_7 = 37;
int led_8 = 38;
int led_9 = 39;
void setup() // run once, when the sketch starts
{
Serial.begin(9600);
pinMode(accX, INPUT);
pinMode(accY, INPUT);
pinMode(accZ, INPUT);
pinMode(ledG, OUTPUT);
pinMode(ledY, OUTPUT);
pinMode(led_0, OUTPUT);
pinMode(led_1, OUTPUT);
pinMode(led_2, OUTPUT);
pinMode(led_3, OUTPUT);
pinMode(led_4, OUTPUT);
pinMode(led_5, OUTPUT);
pinMode(led_6, OUTPUT);
pinMode(led_7, OUTPUT);
pinMode(led_8, OUTPUT);
pinMode(led_9, OUTPUT);
pinMode(mag, OUTPUT);
ledBval = 0;
ledMeter = 0;
i = 0;
}
void loop() // run over and over again
{
xVal = analogRead(accX);
yVal = analogRead(accY);
zVal = analogRead(accZ);
magVal = analogRead(mag);
if(xVal > 18 || xVal < 18 ||
yVal > 190 || yVal < 190 ||
zVal > 250 || zVal < 250)
analogWrite(ledG, 255);
else
{
analogWrite(ledG, 0);
ledBval += 10;
analogWrite(ledY, ledBval);
}
if(mag > 0)
analogWrite(ledG, 255);
i = 0;
char inputChar;
char* input;
while(Serial.available() && i < 3)
{
inputChar = Serial.read();
input[i] = inputChar;
i++;
delay(10);
}
ledMeter = i;
if(ledMeter == 0)
{
analogWrite(led_0, 0);
analogWrite(led_1, 0);
analogWrite(led_2, 0);
analogWrite(led_3, 0);
analogWrite(led_4, 0);
analogWrite(led_5, 0);
analogWrite(led_6, 0);
analogWrite(led_7, 0);
analogWrite(led_8, 0);
analogWrite(led_9, 0);
}
else if(ledMeter == 1)
{
analogWrite(led_0, 255);
analogWrite(led_1, 0);
analogWrite(led_2, 0);
analogWrite(led_3, 0);
analogWrite(led_4, 0);
analogWrite(led_5, 0);
analogWrite(led_6, 0);
analogWrite(led_7, 0);
analogWrite(led_8, 0);
analogWrite(led_9, 0);
}
else if(ledMeter == 2)
{
analogWrite(led_0, 255);
analogWrite(led_1, 255);
analogWrite(led_2, 0);
analogWrite(led_3, 0);
analogWrite(led_4, 0);
analogWrite(led_5, 0);
analogWrite(led_6, 0);
analogWrite(led_7, 0);
analogWrite(led_8, 0);
analogWrite(led_9, 0);
}
else if(ledMeter == 3)
{
analogWrite(led_0, 255);
analogWrite(led_1, 255);
analogWrite(led_2, 255);
analogWrite(led_3, 0);
analogWrite(led_4, 0);
analogWrite(led_5, 0);
analogWrite(led_6, 0);
analogWrite(led_7, 0);
analogWrite(led_8, 0);
analogWrite(led_9, 0);
}
else if(ledMeter == 4)
{
analogWrite(led_0, 255);
analogWrite(led_1, 255);
analogWrite(led_2, 255);
analogWrite(led_3, 255);
analogWrite(led_4, 0);
analogWrite(led_5, 0);
analogWrite(led_6, 0);
analogWrite(led_7, 0);
analogWrite(led_8, 0);
analogWrite(led_9, 0);
}
else if(ledMeter == 5)
{
analogWrite(led_0, 255);
analogWrite(led_1, 255);
analogWrite(led_2, 255);
analogWrite(led_3, 255);
analogWrite(led_4, 255);
analogWrite(led_5, 0);
analogWrite(led_6, 0);
analogWrite(led_7, 0);
analogWrite(led_8, 0);
analogWrite(led_9, 0);
}
else if(ledMeter == 6)
{
analogWrite(led_0, 255);
analogWrite(led_1, 255);
analogWrite(led_2, 255);
analogWrite(led_3, 255);
analogWrite(led_4, 255);
analogWrite(led_5, 255);
analogWrite(led_6, 0);
analogWrite(led_7, 0);
analogWrite(led_8, 0);
analogWrite(led_9, 0);
}
else if(ledMeter == 7)
{
analogWrite(led_0, 255);
analogWrite(led_1, 255);
analogWrite(led_2, 255);
analogWrite(led_3, 255);
analogWrite(led_4, 255);
analogWrite(led_5, 255);
analogWrite(led_6, 255);
analogWrite(led_7, 0);
analogWrite(led_8, 0);
analogWrite(led_9, 0);
}
else if(ledMeter == 8)
{
analogWrite(led_0, 255);
analogWrite(led_1, 255);
analogWrite(led_2, 255);
analogWrite(led_3, 255);
analogWrite(led_4, 255);
analogWrite(led_5, 255);
analogWrite(led_6, 255);
analogWrite(led_7, 255);
analogWrite(led_8, 0);
analogWrite(led_9, 0);
}
else if(ledMeter == 9)
{
analogWrite(led_0, 255);
analogWrite(led_1, 255);
analogWrite(led_2, 255);
analogWrite(led_3, 255);
analogWrite(led_4, 255);
analogWrite(led_5, 255);
analogWrite(led_6, 255);
analogWrite(led_7, 255);
analogWrite(led_8, 255);
analogWrite(led_9, 0);
}
else if(ledMeter == 10)
{
analogWrite(led_0, 255);
analogWrite(led_1, 255);
analogWrite(led_2, 255);
analogWrite(led_3, 255);
analogWrite(led_4, 255);
analogWrite(led_5, 255);
analogWrite(led_6, 255);
analogWrite(led_7, 255);
analogWrite(led_8, 255);
analogWrite(led_9, 255);
}
delay(50);
}
*by scientists I mean me.

No comments:
Post a Comment