Introduction: Fire Reactive LED's
So to begin with, for this instructable you don't need to follow everything correctly. You can adjust everything as you want. Also this is not reactive to Tempature, the sensor detects flames by IR.
Let's begin
Must Have:
- Flame Detection
- Regular LED's
- Box to fit the project in
Should Have:
- RGB LED's
- Tea light holder
- Sound Detection
Would Have:
- LED's reacting to sound
- On and Off switch
List of Things you may need:
Flame Reactive Sensor (http://www.miniinthebox.com/heat-sensitive-tempera...
Arduino UNO (You can buy these anywhere, Arduino nano would also work)
RGB LED's (or regular LED's / led strip) (http://www.miniinthebox.com/5mm-4-pin-rgb-full-col... note: I used common anode
Arduino Sound Module (not needed for the fire reactive) (http://www.miniinthebox.com/3-6v-sound-sensor-modu...
Basic wires 220 ohm resistors (buy these anywhere)
Tea light (This can be bought anywhere)
Wood (for case)
Laser cutter (or incase you're handy a saw will do)
Soldering pen
Glue
Paper
Step 1: The Circuit
So first let's setup our circuit, this may be different for you if you adjust it with your own ideas.
The circuit for the flame sensor should be the same.
This is my full circuit. This includes the RGB LED's, Sound Detector and Flame Detector.
Step by step what you want to do:
Step 1: Your flame sensor has 3 pins. These are GND, VCC and DO. First Connect to GND Pin to the GND(ground) pin on your arduino.
Step 2: Connect the VCC to 5v pin and at last the DO to pin 7 (this may be any digital pin, you will have to define this in the code, in my code pin 7 is defined as flamepin)
Step 3: Just like your flame sensor the sound sensor also has 3 pins. This works the same way. GND to ground, VCC to 5v and in this case out to pin 10 (again this may be any digital pin)
Step 4: The RGB LED's have 4 pins. You will find a flat side on the led, I will order the pins from this side. The first pin is your blue one, connect this to any digital pin on the arduino (I used pin 3). Now the second pin should be longer then the others (longest pin of all 4) this is your 5v so go ahead and connect this pin to 5v on the arduino. Then the third pin is green, mine is connected to pin 5. Lastly the fourth pin is your red pin, mine is connected to pin 6.
Note: If you want to make a strip out of your led's simply connect to same pins to each other. I soldered 12 LED's and they are still all bright. You can't notice any difference in brightness between the first and last one.
Now your circuit should be compleet, you can solder this if it all works correctly.
Step 2: The Box
So lets make it look good!
I used a laser cutter to make these parts, thats why they look a little bit burned. (Personally I think it's dope)
So I made a little holder for a tea light. How did I do this:
First I measured the size of the outside of the tea light by wrapping a small piece of paper around it.
I cut around 20 - 25 of the same piece of paper which are the size of the teal light. Next up I wrapped the first one around the tea light and glue'ed it together I DID NOT GLUE IT TO THE TEA LIGHT!
Then I took the other pieces of paper and glue'ed them around the first one, one by one. This made a pretty solid circle. For the bottom I took the size of the bottom of the tea light and again cut 20 - 25 of these circles. I simply glue'ed these together and finally glue'ed it to the first part. Done!
For the box itself I used Makercase.com. You can make easy Adobe Illustrator files for a box in your size.
I made a big box (20x10x10) and a small one (10x10x2). I cut a hole with a 2cm diameter in the top of the big box and also a bigger hole of 4 cm's in both the big box and the bottom of the small box. The 2cm one is for the tea light and the 4cm one for the wires. In the sides of the smaller box are 2 holes. One with a diameter of 0.5cm and one with a diameter of 1cm. The 0.5cm one is for the flame sensor and the 1cm one for the sound sensor.
On the side of the big box I cut out an opening for my led's.
Glue'ed it all together except for the top of both the big and small box. Now I can still look inside.
There's your box all done.
Step 3: Coding
This is the code I used for my project:
int soundDetectedPin = 10; // Use Pin 10 as our Input
int soundDetectedVal = HIGH; // This is where we record our Sound Measurement boolean bAlarm = false; unsigned long lastSoundDetectTime; // Record the time that we measured a sound unsigned long CurrentTime; unsigned long ElapsedTime;
int soundAlarmTime = 50;
int isFlamePin = 7; // This is our input pin int isFlame = HIGH; // HIGH MEANS NO FLAME
int soundCounter = 0;
int redPin = 6; int greenPin = 5; int bluePin = 3;
int led = 13;
int temp5v = 2;
#define COMMON_ANODE
void setup() { pinMode(temp5v, OUTPUT); pinMode(led, OUTPUT); pinMode(isFlamePin, INPUT); pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); pinMode(soundDetectedPin, INPUT); Serial.begin(9600); }
void loop() { digitalWrite(temp5v, HIGH); soundDetectedVal = digitalRead (soundDetectedPin) ; // read the sound alarm time isFlame = digitalRead(isFlamePin);
if(isFlame == LOW){ //if we detect flame Serial.println("Lit"); if(soundCounter == 1){setColor(255,0,0);} //set color to red if(soundCounter == 2){setColor(0,255,0);} //set color to green if(soundCounter == 3){setColor(0,0,255);} //set color to blue if(soundCounter == 4){setColor(0,255,255);} //set color to aqua if(soundCounter == 5){setColor(255,255,255);} //set color to white-ish delay(50); }else{ Serial.println("Cold af"); setColor(0,0,0); }
// if(soundDetectedVal == LOW){ // lastSoundDetectTime = millis(); // // if(!bAlarm){ // soundCounter++; // Serial.println(soundCounter); // bAlarm = true; // } // }else{ // if((millis()-lastSoundDetectTime) > soundAlarmTime && bAlarm){ // bAlarm = false; // } // }
if (soundDetectedVal == LOW) // If we hear a sound { lastSoundDetectTime = millis(); // record the time of the sound alarm // The following is so you don't scroll on the output screen if (!bAlarm){ // Serial.println(ElapsedTime); soundCounter++; Serial.println("LOUD, LOUD"); Serial.println(soundCounter); bAlarm = true; } } else { if( (millis()-lastSoundDetectTime) > soundAlarmTime && bAlarm){ Serial.println("quiet"); digitalWrite(led, LOW); bAlarm = false; } }
// CurrentTime = millis(); // ElapsedTime = CurrentTime - StartTime;
//Reset de counter if(soundCounter == 6){ soundCounter = 1; }
}
void setColor(int red, int green, int blue){ #ifdef COMMON_ANODE red = 255 - red; green = 255 - green; blue = 255 - blue; #endif analogWrite(redPin, red); analogWrite(greenPin, green); analogWrite(bluePin, blue); }