Rachael Hasegawa and Jimmy Graham
A fire less candle
By: Rachael Hasegawa and Jimmy Graham
Brief description: A candle with out fire that you can blow on and off.
Description: For our final project we used 6 leds to make fading lights in an order to look like a candle was flickering. We also used a piezo to be able to blow the lights on and off that way it looks like you're blowing an actual flame to a candle out. then we chose a frosted glass to give it the effect of a candle in a jar.
Pictures of Candle:
Arduino Program:
int randNumber;
int led5 = 5; //declares pin 5 as a variable
int led3 = 3; //declares pin 3as a variable
int led6 = 6; //declares pin 6 as a variable
int led9 = 9; //declares pin 9 as a variable
int led10 = 10; //declares pin 10 as a variable
int led11= 11; //declares pin 11 as a variable
byte on = 0;
int knockSensor = 0;
int val = 0;
void setup ()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(knockSensor);
if (val > 100)
{on = !on;}
while (on == 1)
{
val = analogRead(knockSensor);
Serial.println (val);
randomSeed(millis());
randNumber = random(50,255);
analogWrite(led5, randNumber); //lets the leds fade unstead of just staying on.
delay(random(20,53));
analogWrite(led3, randNumber);
delay(random(15,45));
randomSeed(millis());
analogWrite(led6, randNumber);
delay(random(25,50));
analogWrite(led9, randNumber);
delay(random(17,47));
randomSeed(millis());
analogWrite(led10, randNumber);
delay(random(23,55));
analogWrite(led11, randNumber);
delay(random(27,46));
if (val > 100)
{on = !on;
}
}
analogWrite(led5, 0); //lets the leds stay off until you blow them back on.
analogWrite(led3, 0);
analogWrite(led6, 0);
analogWrite(led9, 0);
analogWrite(led10, 0);
analogWrite(led11, 0);
delay (100); //delays it for enough time to be able to blow it out and on. with out it, the leds will just go back on right away.
}
problems and how we over came them: some problems that we had were the lights not staying off and just stopped flashing, but we put the delay in so it fixed it and let the lights stay off until you blew them back on.
more time and money: if we had more time then i would have liked to make it bigger and put more leds in and if we had more money then the frosted glass tube that we put in could have been a lot nicer looking.