Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

cakraawijaya/Smart-Fire-Smoke-Detector-Berbasis-IoT-Mobile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Source Love License: MIT GitHub last commit Project Type

Smart-Fire-Smoke-Detector-Berbasis-IoT-Mobile

Starting Class to Become a Great IoT Engineer Batch 1

The increase in population in a country is one of the development capitals. A large population can influence the development of settlements. On the other hand, settlements that are not well regulated can lead to disasters, such as fires. Fire disasters that occur can result in material and immaterial losses. Therefore, the goal of this project is none other than to produce a good fire detection system. This project has been implemented and took approximately 2 weeks. The results show that the system can function properly. The system interface uses the MIT App Inventor application.



Project Requirements

Part Description
Development Board Wemos D1 R2
Code Editor Arduino IDE
Application Support MIT App Inventor
Driver CH340 USB Driver
IoT Platform Antares
Communications Protocol • Inter Integrated Circuit (I2C)
• Transmission Control Protocol/Internet Protocol (TCP/IP)
• Message Queuing Telemetry Transport (MQTT)
IoT Architecture 4 Layer
Database Firebase
Programming Language C/C++
Arduino Library • ESP8266WiFi (default)
• Wire (default)
• AntaresESP8266MQTT
• Firebase_Arduino_Client_Library_for_ESP8266_and_ESP32
• MQ2_LPG_Library
• LiquidCrystal_I2C
Actuators Piezo buzzer (x1)
Sensor • KY-26: Fire Sensor (x1)
• MQ-2: Gas Sensor (x1)
Display LCD I2C (x1)
Other Components • Micro USB cable - USB type A (x1)
• Jumper cable (1 set)
• Breadboard (x1)
• Casing box (x1)



Download & Install

  1. Arduino IDE

    https://bit.ly/ArduinoIDE_Installer
    

  2. CH340 USB Driver

    https://bit.ly/CH340_USB_Driver
    



Project Designs

Schematic Diagram Pictorial Diagram Block Diagram
schematic-diagram pictorial-diagram block-diagram
Infrastructure Prototype Systems Diagram
infrastructure prototype systems-diagram



Basic Knowledge

The difference in pinouts on the Wemos D1 R1 and R2 boards is clearly shown in the image below:

Wemos D1 R1 Wemos D1 R2
wemos-d1-r1-pinout-reference wemos-d1-r2-pinout-reference



Scanning the I2C Address on the LCD

#include <Wire.h>

void setup() {
  Wire.begin();
  Serial.begin(115200);
  while (!Serial); // Wait for serial monitor
  Serial.println("\nI2C Scanner");
}

void loop() {
  int nDevices = 0;
  Serial.println("Scanning...");

  for (byte address = 1; address < 127; ++address) {
    // The i2c_scanner uses the return value of the Wire.endTransmission to see if a device did acknowledge to the address.
    Wire.beginTransmission(address);
    byte error = Wire.endTransmission();

    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address < 16) {
        Serial.print("0");
      }
      Serial.print(address, HEX);
      Serial.println("  !");

      ++nDevices;
    } else if (error == 4) {
      Serial.print("Unknown error at address 0x");
      if (address < 16) {
        Serial.print("0");
      }
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  } else {
    Serial.println("done\n");
  }
  delay(5000); // Wait 5 seconds for next scan
}



MQ-2 Sensor Calibration for LPG Gas

MQ-2 sensor calibration tutorial for LPG Gas: Click Here



Arduino IDE Setup

  1. Open the Arduino IDE first, then open the project by clicking File -> Open :

    Final_Project_Indobot_KelasMulaiJadiIoTEngineerHebat.ino


  2. Fill in the Additional Board Manager URLs in Arduino IDE

    Click File -> Preferences -> enter the Boards Manager Url by copying the following link :

    http://arduino.esp8266.com/stable/package_esp8266com_index.json
    

  3. Board Setup in Arduino IDE

    How to setup the WEMOS D1 R2 board

    • Click Tools -> Board -> Boards Manager -> Install esp8266.

    • Then click Tools -> Board -> ESP8266 Board -> LOLIN(WEMOS) D1 R2 & mini.


  4. Change the Board Speed in Arduino IDE

    Click Tools -> Upload Speed -> 115200


  5. Install Library in Arduino IDE

    Download all the library zip files. Then paste it in the: C:\Users\Computer_Username\Documents\Arduino\libraries


  6. Port Setup in Arduino IDE

    Click Port -> Choose according to your device port (you can see in device manager)


  7. Change the WiFi Name, WiFi Password, and so on according to what you are currently using.

  8. Before uploading the program please click: Verify.

  9. If there is no error in the program code, then please click: Upload.

  10. If there is still a problem when uploading the program, then try checking the driver / port / others section.



Antares Setup

  1. Getting started with Antares :

    • Please Sign Up first.

    • Then please Sign In to access the service.


  2. Activate Access Key :

    • Go to Account menu.

    • Click Get Access Key to generate an access key. This process only needs to be done once.

    • If you have activated an access key before, skip this step.


  3. Create applications :

    • Go to Applications menu.

    • Click + Create an Application.

    • In the Add Application menu, please specify the following :

    • Application Name -> Name of the App you will create.
    • Application ID -> ID of the App you will create.
    • Labels -> determine according to project needs.

  4. Create a device :

    • Make sure you are on the Home / Applications / The app you created menu.

    • Click + Add Device.

    • You should specify the name of this device based on the variables in the project.


  5. Firmware configuration :

    • Make sure you are on the Account menu.

    • Copy Access Key mentioned.

    • Paste in the firmware code, for example like this :

    #define ACCESSKEY "1444e88d02acb758:b996115b1c2f6f0f"

    • Then, the Project name and Device name must match what was created earlier. For example :

    #define projectName "Final_Project_Indobot_Academy_2023"
    #define deviceName "Smart_Fire_Smoke_Detector"



Firebase Setup

  1. Open the official website Firebase :

    https://console.firebase.google.com/
    

  2. Create a project with a free name.

  3. Click gear symbol next to Project Overview -> Then select Project settings to get the FirebaseToken.

  4. Click Realtime Database to get the FirebaseURL.



MIT App Inventor Setup

  1. Open the official website MIT App Inventor :

    https://appinventor.mit.edu/
    

  2. Click Create Apps!, then log in using google account.

  3. Click Project -> then import the files in the Smart-Fire-Smoke-Detector-Berbasis-IoT-Mobile\Src\MIT App Inventor Project\ directory :

    Smart_Fire_Smoke_Detector.aia


  4. Click FirebaseDB1 then set the following 3 points:

    FirebaseToken -> fill with Token obtained from the Project settings section.

    FirebaseURL -> fill with URL obtained from the Realtime Database section.

    ProjectBucket -> fill with DB Container. In this case it is Detect.


  5. Then click Connect -> next select AI Companion.

  6. Open your smartphone, then in the Google Play Store search for the MIT AI2 Companion application, then install it.

  7. Open the MIT AI2 Companion app.

  8. Select Scan QR Code method.

  9. Point your smartphone at the QR Code area on the MIT App Inventor site.



Get Started

  1. Download and extract this repository.

  2. Make sure you have the necessary electronic components.

  3. Make sure your components are designed according to the diagram.

  4. Configure your device according to the settings above.

  5. Please enjoy [Done].



Highlights

MIT App Inventor Device Firebase Antares
mit-app-inventor device firebase antares
Simulation of Monitoring with Mobile Apps
monitoring-1 monitoring-2



Appreciation

If this work is useful to you, then support this work as a form of appreciation to the author by clicking the ⭐Star button at the top of the repository.



Disclaimer

This application is my own work and is not the result of plagiarism from other people's research or work, except those related to third party services which include: libraries, frameworks, and so on.



LICENSE

MIT License - Copyright © 2022 - Devan C. M. Wijaya, S.Kom

Permission is hereby granted without charge to any person obtaining a copy of this software and the software-related documentation files to deal in them without restriction, including without limitation the right to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons receiving the Software to be furnished therewith on the following terms:

The above copyright notice and this permission notice must accompany all copies or substantial portions of the Software.

IN ANY EVENT, THE AUTHOR OR COPYRIGHT HOLDER HEREIN RETAINS FULL OWNERSHIP RIGHTS. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, THEREFORE IF ANY DAMAGE, LOSS, OR OTHERWISE ARISES FROM THE USE OR OTHER DEALINGS IN THE SOFTWARE, THE AUTHOR OR COPYRIGHT HOLDER SHALL NOT BE LIABLE, AS THE USE OF THE SOFTWARE IS NOT COMPELLED AT ALL, SO THE RISK IS YOUR OWN.