Temperature Sensing Fire Alarm With Fan
by Sarah W in Circuits > Arduino
106 Views, 0 Favorites, 0 Comments
Temperature Sensing Fire Alarm With Fan
![IMG-4942.jpg](/proxy/?url=https://content.instructables.com/FMM/R21B/LJ00ES2B/FMMR21BLJ00ES2B.jpg&filename=IMG-4942.jpg)
In it's blazing beauty, fire is an element of art, however it is also dangerous and can cause both damage and pain. With this creation not only will you be notified of the hot temperature change through the flashing lights, but also with the help of the cooling fan the room can be cleared of some smoke and may aid to stop the fire (theoretically since the fan isn't too strong).
Supplies
Circuit
2 x LED (Red)
1 x Arduino Uno
1 x Fan
Box
1 x Excato Knife
1 x Electrical Tape
1 x Hot Glue Gun
1 x Masking Tape
2 x Popsicle Sticks
1 x Soldering Iron
1 x Soldering Stand
Any Cardboard box
Soldering LED
![IMG-4879.jpg](/proxy/?url=https://content.instructables.com/F4O/Z5D5/LJ00EUD5/F4OZ5D5LJ00EUD5.jpg&filename=IMG-4879.jpg)
![leds.png](/proxy/?url=https://content.instructables.com/FLT/79CU/LJ00EV1Q/FLT79CULJ00EV1Q.png&filename=leds.png)
To solder the led you will need a long red wire and a long black wire both approximatly 20 cm in length.
You want to regonize which led leg is the anode (longer leg) and which is the cathod. (shorter le
Soldering Wire to LED Leg ( Red wire to Anode)
- First you want to take one of your clamp one clip to the cathode of the led, then using the second clamp you need to cip your red wire you'd like to solder.
- Next you want to adjust the clamps so the stripped part of the wire is touching the anode leg of the led.
- Then using the thin wire touch the part where the red wire and led leg touch and proceed to gently melt the metal with the iron to hold them together.
- Once the metal covers enough of both wire and leg to hold it together, gently blow to cool down the metal.
Solder Wire to LED (Black wire to Cathode)
To solder the black wire to the cathode leg of the LED, switch the clamp clips and use one to hold the anode side and use the other to hold the black wire in place.
Now you are set up to repeat steps 2-4.
Do this for both red LEDs.
Wiring
![Screenshot 2023-06-17 2.34.14 PM.png](/proxy/?url=https://content.instructables.com/F8M/MPSN/LJ00ES5F/F8MMPSNLJ00ES5F.png&filename=Screenshot 2023-06-17 2.34.14 PM.png)
![IMG-4830.jpg](/proxy/?url=https://content.instructables.com/FI6/W1RH/LJ00ES3S/FI6W1RHLJ00ES3S.jpg&filename=IMG-4830.jpg)
![IMG-4880.jpg](/proxy/?url=https://content.instructables.com/FGJ/89DP/LJ00ES46/FGJ89DPLJ00ES46.jpg&filename=IMG-4880.jpg)
![IMG-4893.jpg](/proxy/?url=https://content.instructables.com/FRK/S2AG/LJ00ES40/FRKS2AGLJ00ES40.jpg&filename=IMG-4893.jpg)
Create this circuit on your mini breadboard
Power/Ground
Connect a jumper wire from the 5V (power) pin to the positive power rail. USE RED WIRE.
Connect a jumper wire from the GND (ground) pin negative power rail. USE BLACK WIRES
Then using another set of red and black wires power the other side of the breadboard by connecting the positive rail to the power rail on the other side, and same for the ground.
Wiring LEDs
LED 1:
- Begin by connecting the cathode leg of the LED with a 330 resistor to the ground rail.
- Next connect the anode leg of the led to the digital pin 5 on the Arduino Uno using wires (try to keep the colour wires for led connections to breadboard consistant).
LED 2:
- Now do the same thing for the second led. Connect the cathode leg of the LED with a 330 resistor to the ground rail.
- Then connect the anode leg of the led to the digital pin 3 on the Arduino Uno.
Wiring The Fan
For the connection on the fan, depending on the type of fan you get, you will see a little box with 3 holes. The middle one is power, and the right one is for ground. If it's hard to tell on your fan you can follow the colour wires from the base of the fan leading to the "box". The red wire connected hole is power and the black wire connected hole is ground. (Use picture as reference)
Connection To Breadboard
- Put a black wire into the ground hole of the fan, and plug into the groud rail on the same side as the LEDs.
- Put a red wire into the power hole of the fan and plug into digital pin 8.
Wiring LM35 (Temperature Sensor)
For the temperature sensor remember to look at it flat side facing you to determine the positve, ground , and input ends. With the sensor in this position, the power end is on the far left, the input end is in the middle, and the ground end is on the far right.
Preparing LM35 for breadboard
- Using the Male/Female wires plug each pins of the sensor to the female side (side with the holes) of 3 Male/Female wires.
- Next using the eletrical tape tape around the pins to hold them in place in the female side and hold the base of the female side together.
Connection To Breadboard
- Connect the power Male/Female wire to the positive power rail.
- Connect the Ground Male/Female wire to the negative power rail
- Connect the middle (input) Male/Female wire to analog pin A1.
Code
![FEA.png](/proxy/?url=https://content.instructables.com/FI1/F7PB/LJ00EXP0/FI1F7PBLJ00EXP0.png&filename=FEA.png)
![fea .png](/proxy/?url=https://content.instructables.com/FBS/3S1E/LJ00EXP1/FBS3S1ELJ00EXP1.png&filename=fea .png)
THIS IS A BREAK DOWN OF THE CODE NOT ALL THE CODE IS HERE
Check the images or attached file for the full code.
#define LM35 // defines the sensor to the pin A1 that it's plugged into
int led1 = 5; // stating that pin 5 is for led1 and overall adding a name to the pin.
int led2 = 3;
int fan = 8;
void setup() {
Serial.begin(9600); // allows communication from the computer to the Arduino
pinMode (led1, OUTPUT);
pinMode (led2, OUTPUT); //pinMode command declares if the pin will be an input or output
pinMode (fan, OUTPUT);
}
viod flash() { // a command that will be called back to in the loop if statements
digitalWrite (led1,HIGH); // when one light is on the other is off and alternates.
digitalWrite (led2,LOW);
delay (300);
digitalWrite (led1,LOW);
digitalWrite (led2,HIGH);
delay (300);
}
void loop() {
float lmvalue = analogRead(LM35);
float tempr = (lmvalue * 500)/1023; // converts the sensor's reading to celcius.
Serial.println (tempr); // prints the temperature the sensor reads in the serial moniter.
delay (200); // Video that helped with this portion
if (tempr > 40) { // if the sensor reads a temperature higher than 40 degrees celcius then do the following, if you want the flashing lights and fan to activate at a hotter temperature you can change 40 to a higher value.
flash(); // if this statement is true call back to the void flash command and enable that sequence.
digitalWrite (fan,HIGH); // if this is true turn on fan.
}
else { // if the sensor reads anything below 40 degrees celcius, then lights off and fan off.
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(fan, LOW);
}
Downloads
Measure & Cut Cardboard to Make Box (Optional)
![IMG-4904.jpg](/proxy/?url=https://content.instructables.com/FFN/FCYW/LJ00F7PQ/FFNFCYWLJ00F7PQ.jpg&filename=IMG-4904.jpg)
![IMG-4897.jpg](/proxy/?url=https://content.instructables.com/F5M/KILS/LJ00ES3Y/F5MKILSLJ00ES3Y.jpg&filename=IMG-4897.jpg)
Measure
Fan must be disconnected from circuit for measurement
- Place your fan in the middle of the cardboard and using a pencil/marker trace out the fan.
- Next from the width of the fan measure 3 inches from the top of the fan and bottom.
- Then measure 2 inches from right of the fan and 3.5 cm from left of the fan.
- On a seperate side of cardboard measure out 4 rectangular cardboard strips to match the width of your box (rectangle around the fan).
Cut
Now using the exacto knife carefully follow along the lines and cut out the outside rectangle then the inner (fan) rectangle. Then carefully cut out the rectangle strips.
After cutting out the cardboard with the fan measured, place it onto a clear piece of cardboard. Trace it and cut it out to be the back end of your alarm box.
Assembly Pt 1
![IMG-4928 (1).jpg](/proxy/?url=https://content.instructables.com/F92/MWQW/LJ00ES47/F92MWQWLJ00ES47.jpg&filename=IMG-4928 (1).jpg)
![IMG-4929.jpg](/proxy/?url=https://content.instructables.com/FKJ/RYWW/LJ00ES49/FKJRYWWLJ00ES49.jpg&filename=IMG-4929.jpg)
![IMG-4931.jpg](/proxy/?url=https://content.instructables.com/FGM/CHBB/LJ00ES4O/FGMCHBBLJ00ES4O.jpg&filename=IMG-4931.jpg)
![IMG-4932.jpg](/proxy/?url=https://content.instructables.com/FC0/17FT/LJ00ES4P/FC017FTLJ00ES4P.jpg&filename=IMG-4932.jpg)
Box
Using the hot glue gun glue the small rectangle strips along the ends of the fan side ensuring to match the side lenghts together (no long and short strips for the width of the box).
Fan
- Put the fan into the hole cut out for it.
- With everything on a flat surface hot glue 2 popsicle sticks along the legth of the fan to ensure it doesn't fall out and stays position.
- my fan had long wires so using the masking tape I taped it along the walls to keep things organized and no wires sticking out.
Arduino + Breadboard
This takes place on the back end cardboard.
- Place circuit (disconnected from fan) in the middle of this cardboard ensuring it's not too close to the ends.
- Note where the holes diagonally to eachother on the arduino and with a pencil mark where lines up on the cardboard.
- Then move the ciruit out of the wat and using either a pencil or a screw driver poke through the holes.
- Place the arduino and circuit back to position and place the screws throught the holes. Using a nut screw onto the screws from the back to hold the arduino in place.
- Using masking tape, tape along the ends of the breadboard ensuring not to tape over the components, just keep everything along the sides.
Assembly Pt 2
![FMMR21BLJ00ES2B.jpg](/proxy/?url=https://content.instructables.com/FSC/69TM/LJ00FH3B/FSC69TMLJ00FH3B.jpg&filename=FMMR21BLJ00ES2B.jpg)
Combining Both fan cardboard and circuit cardboard
- Approximatly measure out where the Arduino wire will be sticking out of the box and cut a little rectangle to allow this connection.
- Reconnect the fan to the rest of the circuit.
- On the sides with the popsicle sticks poke two holes with a screw driver. Make sure they are both parallel to one another on each side.
- Gently place the half with the fan ontop of the base half and carefully feed the LEDs through the holes. Make sure wires don't pop out of the breadboard or Arduino especially before step 5.
- Onces the box is closed you will see a gap at the bottom of the project to feed the LM35 sensor through,feed it through and with a little electricle tape, tape it to the bottom of the box ensuring the flat side is facing the ground.
- Using the hot glue gun glue around the outside to mend both halves together.
Now you have finished the project and using a flame hold it under the sensor (make sure not to actually touch the sensor with the flame). Feel free to decorate the outside of the alarm as much as you like :)
Here is a video of the project in action!
https://drive.google.com/file/d/1vl72yN2HrR3HywomWH1zVBRP16iqIyCI/view?usp=sharing