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

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

Soldering LED

IMG-4879.jpg
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)

  1. 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.
  2. Next you want to adjust the clamps so the stripped part of the wire is touching the anode leg of the led.
  3. 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.
  4. 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
IMG-4830.jpg
IMG-4880.jpg
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:

  1. Begin by connecting the cathode leg of the LED with a 330 resistor to the ground rail.
  2. 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:

  1. Now do the same thing for the second led. Connect the cathode leg of the LED with a 330 resistor to the ground rail.
  2. 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

  1. Put a black wire into the ground hole of the fan, and plug into the groud rail on the same side as the LEDs.
  2. 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

  1. Using the Male/Female wires plug each pins of the sensor to the female side (side with the holes) of 3 Male/Female wires.
  2. 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

  1. Connect the power Male/Female wire to the positive power rail.
  2. Connect the Ground Male/Female wire to the negative power rail
  3. Connect the middle (input) Male/Female wire to analog pin A1.

Code

FEA.png
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);

}

Measure & Cut Cardboard to Make Box (Optional)

IMG-4904.jpg
IMG-4897.jpg

Measure

Fan must be disconnected from circuit for measurement

  1. Place your fan in the middle of the cardboard and using a pencil/marker trace out the fan.
  2. Next from the width of the fan measure 3 inches from the top of the fan and bottom.
  3. Then measure 2 inches from right of the fan and 3.5 cm from left of the fan.
  4. 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
IMG-4929.jpg
IMG-4931.jpg
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

  1. Put the fan into the hole cut out for it.
  2. 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.
  3. 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.

  1. Place circuit (disconnected from fan) in the middle of this cardboard ensuring it's not too close to the ends.
  2. Note where the holes diagonally to eachother on the arduino and with a pencil mark where lines up on the cardboard.
  3. Then move the ciruit out of the wat and using either a pencil or a screw driver poke through the holes.
  4. 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.
  5. 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

Combining Both fan cardboard and circuit cardboard

  1. Approximatly measure out where the Arduino wire will be sticking out of the box and cut a little rectangle to allow this connection.
  2. Reconnect the fan to the rest of the circuit.
  3. 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.
  4. 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.
  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.
  6. 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