This curtain is fairly simple to create, and lights up when someone walks by/through it.
Materials:
• Store bought beaded curtain (we used this curtain: http://www.save-on-crafts.com/crystalcurtain.html )
• 6 feet of multi-stranded fiber optic rope (we used http://www.wiedamark.com/42strandsideglow.aspx )
• 11 or more RGB LEDS
• 1 motion sensor (we used http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=255-1816-ND )
• Lots of wire (black, red, blue, and green if possible)
• On/Off switch
• Batteries and battery pack (we used 3 AAA)
• Arduino uno
• 2-3 index cards or some light-weight cardstock
• Rapid prototyping machine/scrap plastic/foam core
• Solder/soldering iron
• Masking tape
• Hot glue gun
• Heat shrink tubing and heat gun
• String to tie wires down
Remove these ads by
Signing UpStep 1: Make the basic circuit
Following the circuit diagram above, wire one RGB LED and the motion sensor to the Arduino (note: check the datasheet for your particular motion sensor before wiring). Run the code below and confirm that the LED runs through all three colors in unison when the motion sensor detects movement.
You can adjust the code to change the color of the LED and make whatever pattern you like. Ours had two LEDs (simply hook it up to three unused PWM pins) and was set to alternate through cool colors (one set of LEDs faded between blue and red, the other set between green and blue).
(How the code works: Basically, the code is a modified version of Sparkfun's code for using a photoresistor to control LEDs. If the motion sensor "sees" something, the voltage in A0 spikes. When the code detects this spike, it runs the LEDs through their colors and if there is no spike the LEDs stay off.)
CODE:
int lightPin = 0; //actually the motion sensor
// LED leads connected to PWM pins
const int RED_LED_PIN = 9;
const int GREEN_LED_PIN = 10;
const int BLUE_LED_PIN = 11;
// Used to store the current intensity level of the individual LEDs
int redIntensity = 0;
int greenIntensity = 0;
int blueIntensity = 0;
// Length of time we spend showing each color
const int DISPLAY_TIME = 50; // In milliseconds
void setup()
{
// pinMode(ledPin1, OUTPUT); //sets the led pin to output
// pinMode(ledPin2, OUTPUT); //sets the led pin to output
// pinMode(ledPin3, OUTPUT); //sets the led pin to output
Serial.begin(9600);
}
void loop()
{
int lightLevel = analogRead(lightPin); //Read the motion sensor
Serial.println(lightLevel);
if (lightLevel < 650) { //if the sensor sees motion (voltage spikes above threshold)
// Cycle color from red through to green
// (In this loop we move from 100% red, 0% green to 0% red, 100% green)
for (greenIntensity = 0; greenIntensity <= 255; greenIntensity+=5) {
redIntensity = 255-greenIntensity;
analogWrite(GREEN_LED_PIN, greenIntensity);
analogWrite(RED_LED_PIN, redIntensity);
delay(DISPLAY_TIME);
}
// Cycle color from green through to blue
// (In this loop we move from 100% green, 0% blue to 0% green, 100% blue)
for (blueIntensity = 0; blueIntensity <= 255; blueIntensity+=5) {
greenIntensity = 255-blueIntensity;
analogWrite(BLUE_LED_PIN, blueIntensity);
analogWrite(GREEN_LED_PIN, greenIntensity);
delay(DISPLAY_TIME);
}
// Cycle cycle from blue through to red
// (In this loop we move from 100% blue, 0% red to 0% blue, 100% red)
for (redIntensity = 0; redIntensity <= 255; redIntensity+=5) {
blueIntensity = 255-redIntensity;
analogWrite(RED_LED_PIN, redIntensity);
analogWrite(BLUE_LED_PIN, blueIntensity);
delay(DISPLAY_TIME);
}
}
else{ //if the sensor doesn't see anything
analogWrite(RED_LED_PIN, 0);
analogWrite(BLUE_LED_PIN,0);
analogWrite(GREEN_LED_PIN,0);
//digitalWrite(ledPin1,LOW);
//digitalWrite(ledPin2, LOW);
//digitalWrite(ledPin3, LOW);
}
}
doxsys
says:
May 9, 2011. 9:36 AMReply


























Not Nice









![How to Send Data by Light: Fiber Optics [Updated]](http://www.instructables.com/files/deriv/FRI/42MI/GU7FXUSW/FRI42MIGU7FXUSW.SQUARE.jpg)









Visit Our Store »
Go Pro Today »



