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.
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) |
-
Arduino IDE
https://bit.ly/ArduinoIDE_Installer
-
CH340 USB Driver
https://bit.ly/CH340_USB_Driver
Schematic Diagram | Pictorial Diagram | Block Diagram |
---|---|---|
Infrastructure | Prototype | Systems Diagram |
---|---|---|
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 |
---|---|
#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 tutorial for LPG Gas: Click Here
-
Open the
Arduino IDE
first, then open the project by clickingFile
->Open
:Final_Project_Indobot_KelasMulaiJadiIoTEngineerHebat.ino
-
Fill in the
Additional Board Manager URLs
in Arduino IDEClick
File
->Preferences
-> enter theBoards Manager Url
by copying the following link :http://arduino.esp8266.com/stable/package_esp8266com_index.json
-
Board Setup
in Arduino IDEHow to setup the
WEMOS D1 R2
board• Click
Tools
->Board
->Boards Manager
-> Installesp8266
.• Then click
Tools
->Board
->ESP8266 Board
->LOLIN(WEMOS) D1 R2 & mini
.
-
Change the Board Speed
in Arduino IDEClick
Tools
->Upload Speed
->115200
-
Install Library
in Arduino IDEDownload all the library zip files. Then paste it in the:
C:\Users\Computer_Username\Documents\Arduino\libraries
-
Port Setup
in Arduino IDEClick
Port
-> Choose according to your device port(you can see in device manager)
-
Change the
WiFi Name
,WiFi Password
, and so on according to what you are currently using. -
Before uploading the program please click:
Verify
. -
If there is no error in the program code, then please click:
Upload
. -
If there is still a problem when uploading the program, then try checking the
driver
/port
/others
section.
-
Getting started with Antares :
• Please Sign Up first.
• Then please Sign In to access the service.
-
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.
-
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.
-
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.
-
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
andDevice name
must match what was created earlier. For example :#define projectName "Final_Project_Indobot_Academy_2023" #define deviceName "Smart_Fire_Smoke_Detector"
-
Open the official website
Firebase
:https://console.firebase.google.com/
-
Create a project with a free name.
-
Click
gear symbol
next toProject Overview
-> Then selectProject settings
to get theFirebaseToken
. -
Click
Realtime Database
to get theFirebaseURL
.
-
Open the official website
MIT App Inventor
:https://appinventor.mit.edu/
-
Click
Create Apps!
, then log in using google account. -
Click
Project
-> then import the files in theSmart-Fire-Smoke-Detector-Berbasis-IoT-Mobile\Src\MIT App Inventor Project\
directory :Smart_Fire_Smoke_Detector.aia
-
Click
FirebaseDB1
then set the following 3 points:•
FirebaseToken
-> fill withToken
obtained from theProject settings
section.•
FirebaseURL
-> fill withURL
obtained from theRealtime Database
section.•
ProjectBucket
-> fill withDB Container
. In this case it isDetect
.
-
Then click
Connect
-> next selectAI Companion
. -
Open your smartphone, then in the
Google Play Store
search for theMIT AI2 Companion
application, then install it. -
Open the
MIT AI2 Companion
app. -
Select
Scan QR Code
method. -
Point your smartphone at the
QR Code
area on theMIT App Inventor
site.
-
Download and extract this repository.
-
Make sure you have the necessary electronic components.
-
Make sure your components are designed according to the diagram.
-
Configure your device according to the settings above.
-
Please enjoy [Done].
MIT App Inventor | Device | Firebase | Antares |
---|---|---|---|
Simulation of Monitoring with Mobile Apps | |
---|---|
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.
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.
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.