Connecting The Flame Sensor With Android App Using Arduino Mega 2560

In this article, I will explain about connecting the flame sensor with Android app.

Introduction
  • In this article, I will explain about connecting the Flame Sensor with Android app.
  • When the flame is detected, it will send the message to the app.
Parts Of Lists
  • Arduino Mega 2560
  • Flame Sensor
  • Android App
  • Bluetooth
  • Hook Up Wires
  • Bread Board
Flame Sensor
Figure 1 - Flame Sensor
  • It is used to detect and respond to the presence of flame (or) fire.
  • The detected flame depends on the installation.
  • We will also include sounding an alarm.
Connection

Step 1

Connection from the Sensor to the Board.

Sensor

Board

Vcc5v
GndGnd
A0A1

Step 2

Connection from the Bluetooth to the Board.

Bluetooth

Board

Vcc5v
GndGnd
TXRx
RXTx

Programming
  1. const int AOUTpin = A0; //the AOUT        
  2. const int ledPin = 13; //the anode of the LED connects to digital pin D13 of the arduino        
  3. int limit;      
  4. int value;      
  5. void setup()      
  6. {      
  7.     Serial.begin(9600);      
  8.     //sets the baud rate pinMode(DOUTpin, INPUT);        
  9.     //sets the pin as an input to the arduino pinMode(ledPin, OUTPUT);        
  10.     //sets the pin as an output of the arduino        
  11. }      
  12. void loop()      
  13. {      
  14.     value = analogRead(AOUTpin); //    
  15.     limit = digitalRead(DOUTpin); //    
  16.     Serial.print("Fire value: ");      
  17.     Serial.println(value); //prints the CO value         
  18.     Serial.print("Level: ");      
  19.     Serial.print(limit); //prints the limit reached as either LOW or HIGH (above or underneath)         
  20.     delay(100);      
  21.     if (limit == HIGH)      
  22.     {      
  23.         Serial.println("fire dected");      
  24.     }      
  25.     else      
  26.     {      
  27.         Serial.println("Fire not dected");      
  28.     }      
  29. }  
Explanation
  • We have to connect the Android app in the mobile from the Playstore
  • When the fire is detected, it can be used to send the message to the app
  • When the fire is detected, it will send the message: "Fire Detected."