Introduction: Fire Detection With Arduino and Pushingbox
Hi! My name is Emily Chin. I love hiking. During first few months in Malaysia, we have experienced serious El'Nino and there are many incidents of forest fire. Hence, I came across an idea to make a device that is able to detect forest fire at the first place, with a success rate of 86% ( 3 system failures out of 21 trials). This device is self-sufficient and it can be used in fire detection in homes too.
Step 1: Understand How It Work
Before we can actually do something, I think the most important thing is that we need to understand how this device work and how it executes certain action under certain condition. The image above is the mind map on how it works but I also expressed in word about how it works here.
This device has 2 Arduino, one of it is responsible to detect and activate the water pump, the other one helps in communication. There are 2 sensors, LM35 Analog linear temperature sensor and flame sensor. If the sensors detect an abnormal change in temperature or light intensity (flame sensor works on detecting the changes in wavelength of light) , LED will be lighted up, water pump will be activated and servo motor will turn a certain angle (in my case 54 degree) to push the pushbutton to activate WiFi shield to connect to PushingBox to:
Send an email to the authority/ to you
Tweet and twitter to raise awareness (optional if you are doing a home fire detector)
Send a notification to your phone via the app Pushbullet
Step 2: Prepare What You Need
This is what you need:
- 2×Arduino UNO
- 1×MOSFET transistor
- 1×1N4007 diode
- 1×servo motor
- A few breadboard wires (A.K.A jumper wire)
- 1×LM35 Analog linear temperature sensor
- 1×DC water pump
- 1×100uf capacitors
- 1×Cytron ESP8266 WiFi shield
- 3×200ohm resistor
- 1×flame sensor
2×LED (To indicate when there’s a fire)
Crocodile clips (To connect the pump if needed to be placed at a further distance)
Well, the parts which are BOLD can actually be found in Arduino Starter Kit. If you don't wish to buy the Starter Kit, they are just simple electronics which can be found on Arduino Main page, SparkFun, Adafruit and even Amazon. Well, for Malaysian, I recommend to buy from Cytron Technology and Myduino as there offer fast delivery within Malaysia (2-3 days).
For WiFi shield, I bought the ESP8266 WiFi shield because it is cheaper than the original Arduino WiFi shield and it is compatible to Arduino too. The link is here: Cytron ESP8266 WiFi shield.
For Water pump, I bought the DC water pump because it only require around 5V to 12V and it is way more easier to connect compare to using relay to connect normal water pump for aquarium. The link is here : DC water pump
For both sensor, I bought from Myduino because it came with long analog sensor cable. The link for temperature sensor: LM35 Analog Linear temperature sensor and the link for flame sensor: Flame sensor
Done stocking up? Let's begin!
Step 3: Wiring Up Arduino 1
There are circuits on how to wire Arduino 1 above. To make the connection clearer, I have make a few circuits about the connection on LED, water pump, servo motor and the 2 sensors (LM35 Analog Linear Temperature Sensor and Flame Sensor). These are the detail explanation on connections, it includes how and why it should be connected in such way.
Connecting LED and sensors
A 220-ohm resistor to connect ground (black wire A.K.A negative terminal) to the cathode (Short leg) of LED. Using a resistor with the LED will keep the LED from receiving too much voltage. Without resistor, LED would be brighter for a few moments, but quickly burn out.Anode (Long leg) of the LED should be connected to Digital pin on the Arduino. The sensor's analog cable have 3 wires and there shall be connected in this way: Red to 5V, Black to GND and Blue to Digital Pin.
Connecting water pump (Circled as 1 in the third diagram)
Connecting DC water pump is like connecting DC motor. There are 2 ways, first, is using the H-bridge and second, is using MOSFET transistor. I chose the second way because I think it is much easier. To differentiate which pin is gate, drain or source, place the transistor in such a way that the metal tab is facing away from you. The left pin is called the gate, connect this pin to Digital pin of Arduino. The middle one is known as drain, this should be connected to the negative terminal of the water pump. The one on the right is known as source. This pin should be connected to the ground in the breadboard. Next, the diode should be added. The diode will help in preventing back-voltage created by the motor from going back into the circuit. There is one strip at the end of the diode, that end is the cathode (negative end) of the diode. Connect the anode (the end without the strip) to the ground of the motor and cathode to the power of the motor. Remember to connect 9V battery to the breadboard. Note that DON’T connect the 5V from Arduino to the positive of the battery. Only connect the ground of 9V battery and ground of Arduino together!
Connecting servo motor(Circled as 2 in the third diagram)
The servo motor often has 3 wires, namely is red, white and black in colour.Red should be connected to 5V of Arduino, white should be connected to digital pin while black should be connected to ground. Placing a 100uf capacitor will help in smoothing out any voltage changes that may occur. Capacitors may explode if connect in a wrong way. The side which black strip (it is the cathode) should be connected to the ground, whereas the other side is anode which should be connected to 5V.
Step 4: Wiring Up Arduino 2
Arduino 2 is pretty easy to connect, it only consists of a pushbutton, a WiFi shield and a 220-ohm resistor. The WiFi shield should be stacked on Arduino UNO (as shown in picture). One side of the pushbutton should be attached to 5V on the breadboard, the other side should be attached to the digital pin. A 220-ohm resistor should be added between the ground and digital pin (as shown in diagram)
Hurray! Done for Hardware!!Few more steps to go.
Step 5: Configuring Pushingbox
To set up pushingbox, which is a webpage that helps to connect your Arduino with you by notifications, emails and tweets, it's pretty easy actually. Steps by Steps to set up Pushingbox is shown in diagrams. The word explanation is here:
- After you have reached Pushingbox webpage (Pushingbox webpage), login. I chose to login with google.
- After login, press my services. If you want email to be sent, select the service “Email”; for tweeting service, select the service “Twitter”; For push notification on your phone, select the service “Pushbullet”. Multiple services are allowed.
- Well, after dealing with my services, start create the scenario. Create a name for your scenario (in my case, I chose the name “Fire Fire scenario”). Then press the “add”.
- You will come to a page after you succeeded in creating the scenario. Press “Add an action” button, you will then see the services you just created in Step 2 appear. Hence, press the button “Add an action with this service”. Continue with writing email subject and message, Twitter message, and the message for your phone.
- Copy down the Device ID (short form: Devid) above into a notebook or somewhere important. It is important and it is needed in programming.
- Press “test scenario” and check your inbox or phone to see miracle happen!
Cool! It's time for programming!!
Step 6: Uploading Sketch
This isn't the last step, but it does play important role in making this project success.
Arduino trial: test out the sensor values
Arduino main sketch: To be uploaded in Arduino 1
Sketch_wifi 2: To be uploaded to Arduino 2
BEFORE UPLOADING SKETCH:
1) Use the trial sketch and open serial monitor to check the temperature and light intensity when there’s a fire and there’s no fire to fill in baseTemp (temperature when fire happens) and threshold (light intensity when there’s a fire). **PLEASE DO NOT START A FIRE IN THE HOUSE, use a candle**
2) Try different angle value to see which value is able to push the pushbutton on the WiFi shield. Fill in the blank in "int angle:" with the value that you have just tested.
3) Before Uploading the sketch for Arduino 2, remember to fill in your WiFi name and WiFi password at wifissid and wifipass. Remember to fill in your Device ID created at Pushingbox at:
const char devid =
4) Change the Digital Pins and Analog In at “int….” before void setup if you used different Digital Pins and Analog In.
5) Install CytronESPWiFiShield if you are using Cytron ESP8266 WiFi shield.
- How to install?
Open Arduino IDE. Go to Sketch -> Include Library -> Manage Libraries. Search for Cytron ESPWiFi Shield and install.
**Special thanks to Mr. Beng Cheat for helping me in Cytron forum on the code on WiFi shield**
Step 7: Test It and Improvements!
Well, the above is the Demo video for this device!
To improve this device and make it self sufficient, I have made it powered by solar power thanks to this Instructables [ Self sufficient Arduino(Solar Powered) ]
Thank you for watching my project. This is my first time writing an Instructables. Sorry if there’s places I didn’t explain so well or didn’t explain at all. I am glad to share with you guys. If you have any comments or problems or any idea for improvements, kindly comment below. Thank you very much.