IoT Master Class Indobot 2022 Final Project
Echeveria Peacockii is a type of plant that is related to cactus, but there are no thorns on the body of this plant, making it very attractive to ornamental plant lovers. The care of Echeveria Peacockii until now is still done conventionally, making it wasteful of time and energy. Therefore, this project was created to obtain a system that is able to perform watering as well as being able to monitor changes in conditions that exist in the environment around the plant. This project has been implemented and took approximately 1 month. The system interface uses Telegram Bot. The results showed that the system created can function properly.
Part | Description |
---|---|
Development Board | DOIT ESP32 DEVKIT V1 |
Code Editor | Arduino IDE |
Application Support | Telegram Bot |
Driver | CP210X USB Driver |
IoT Platform | • Blynk • ThingsBoard |
Communications Protocol | • Inter Integrated Circuit (I2C) • Message Queuing Telemetry Transport (MQTT) • Transmission Control Protocol/Internet Protocol (TCP/IP) • MTProto |
IoT Architecture | 4 Layer |
Programming Language | C/C++ |
Arduino Library | • WiFi (default) • Wire (default) • BlynkSimpleEsp32 • ThingsBoard • PubSubClient • CTBot • ArduinoJson • LiquidCrystal_I2C • DHT_sensor_library • ESP_FC28_Library |
Actuators | Submersible pump (x2) |
Sensor | • FC-28: Resistive Soil Moisture (x1) • LDR: Light Dependent Resistor (x1) • DHT22: Air Temperature & Humidity (x1) |
Display | LCD I2C (x1) |
Other Components | • Micro USB cable - USB type A (x1) • Jumper cable (1 set) • ESP32 expansion board (x1) • Breadboard (x1) • Electrical relay 2 channel (x1) • Adaptor DC 5V (x1) • Resistor • Casing box (x1) • Bolts plus (1 set) • Nuts (1 set) |
-
Arduino IDE
https://bit.ly/ArduinoIDE_Installer
-
CP210X USB Driver
https://bit.ly/CP210X_USB_Driver
Hardware Design | |
---|---|
Software Design | |
---|---|
#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
}
-
Open the
Arduino IDE
first, then open the project by clickingFile
->Open
:SistemPerawatanEcheveriaBlynkIoT.ino
orSistemPerawatanEcheveriaThingsboardIoT.ino
-
Fill in the
Additional Board Manager URLs
in Arduino IDEClick
File
->Preferences
-> enter theBoards Manager Url
by copying the following link :https://dl.espressif.com/dl/package_esp32_index.json
-
Board Setup
in Arduino IDEHow to setup the
DOIT ESP32 DEVKIT V1
board• Click
Tools
->Board
->Boards Manager
-> Installesp32
.• Then click:
Tools
->Board
->ESP32 Arduino
->DOIT ESP32 DEVKIT V1
.
-
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
. -
Some things you need to do when using the
ESP32 board
:•
Arduino IDE
information:Uploading...
-> immediately press and hold theBOOT
button.•
Arduino IDE
information:Writing at .... (%)
-> release theBOOT
button.• Wait until the message appears:
Done Uploading
->The program is directly operated
.• Press the
EN (RST)
button and thenRestart
to handle theESP32
board that cannot process theSC
.• Do not press the
BOOT
andEN
buttons at the same time as this may switch toUpload Firmware
mode.
-
If there is still a problem when uploading the program, then try checking the
driver
/port
/others
section.
-
Getting started with blynk :
• Go to the official Blynk website: blynk.io.
• Click
Start Free
untuk mendaftar.• Enter an email.
• Open email for confirmation.
• Log in using the account that has been created.
-
Create a new template :
• Click
Developer Zone
-> then selectMy Templates
option.• Then click
+ New Templates
to create a New Template.• The
NAME
section is filled withSmart Farming
,HARDWARE
selectESP32
,CONNECTION TYPE
selectWiFi
,TEMPLATE DESCRIPTION
is optional.• Click
Done
.
-
Create datastreams :
• Enter
Datastreams
menu -> click+ New Datastreams
-> selectVirtual Pin
.• Input the first data :
NAME
->suhu_udara
PIN
->V0
DATA TYPE
->Double
UNITS
->Celcius, °C
MIN
->0
MAX
->100
DECIMALS
->#.#
DEFAULT VALUE
->0
• Input the second data :
NAME
->kelembaban_udara
PIN
->V1
DATA TYPE
->Integer
UNITS
->Percentage, %
MIN
->0
MAX
->100
DEFAULT VALUE
->0
• Input the third data :
NAME
->kelembaban_tanah
PIN
->V2
DATA TYPE
->Integer
UNITS
->Percentage, %
MIN
->0
MAX
->100
DEFAULT VALUE
->0
• Input the fourth data :
NAME
->cahaya
PIN
->V3
DATA TYPE
->Integer
UNITS
->Lux, lx
MIN
->0
MAX
->100000
DEFAULT VALUE
->0
• Input the fifth data :
NAME
->indikator_pompa1
PIN
->V4
DATA TYPE
->Integer
UNITS
->None
MIN
->0
MAX
->1
DEFAULT VALUE
->0
• Input the sixth data :
NAME
->indikator_pompa2
PIN
->V5
DATA TYPE
->Integer
UNITS
->None
MIN
->0
MAX
->1
DEFAULT VALUE
->0
• Input the seventh data :
NAME
->tombol_siram
PIN
->V6
DATA TYPE
->Integer
UNITS
->None
MIN
->0
MAX
->1
DEFAULT VALUE
->0
• Click
Create
.• Click
Save
.
-
Create a new device :
• Enter
Devices
menu.• Click
+ New Devices
to add new devices.• Select
From Templates
:TEMPLATE
->Smart Farming
DEVICE NAME
->Smart Farming
• Click
Create
.
-
Manage dashboard on the Blynk site :
• Click
3 dot symbol
-> then selectEdit Dashboard
.• Select
the desired widget
thendrag
into the dashboard area.• Click
setting
on the added widget.• Select a datastream that is already available, among others:
suhu_udara
/kelembaban_udara
/kelembaban_tanah
/cahaya
/indikator_pompa1
/indikator_pompa2
/tombol_siram
.• Click
Save And Apply
.
-
Manage dashboards on the Blynk mobile app :
• Open your smart phone -> then in the
Google Play Store
, find the application calledBlynk IoT
-> theninstall
.• Open the application -> then do the configuration as on the Blynk site earlier.
• For the rest, you can search for tutorials on
Google
to enrich your knowledge.
-
Firmware configuration :
• Go to
Devices
menu -> selectSmart Farming
-> clickDevice Info
.• Copy
Template ID
,Template Name
, andAuthToken
.• Then paste it at the very top of the firmware code, for example like this :
#define BLYNK_TEMPLATE_ID "TMPL6ZSHxYC-z" #define BLYNK_TEMPLATE_NAME "Smart Farming" #define BLYNK_AUTH_TOKEN "fw1oXlpe-YfYh7JXQHu4QTS3EqlnM-iw"
-
Getting started with ThingsBoard :
• Go to the official ThingsBoard website: thingsboard.cloud.
• Log in with google account.
-
Create a new device profile :
• Go to
Profiles
menu -> then selectDevice profiles
.• Click
+ (Add device profile)
.• Device profile details:
Name
->MQTT
.• Transport configuration:
Transport type
->MQTT
. Then fill in the MQTT data as shown below :-
Telemetry topic filter:
v1/devices/me/telemetry/fpiotdevan
. This should be the same as the one in the firmware code. -
Attributes publish & subscribe topic filter:
v1/devices/me/attributes/fpiotdevan
. This should be the same as the one in the firmware code. -
MQTT device payload :
JSON
.
• Click
Add
to add.
-
-
Create a new device :
• Go to
Entities
menu -> then selectDevices
->Groups
.• Change the device access groups
All
toPublic
so that it can be used widely.• Open device groups
All
.• Click
+ (Add device)
.• Make 1 device with the following conditions :
Name
->EcheveriaIoT
Label
->EcheveriaIoT
Device profile
->default
-
Create a dashboard :
• Go to
Dashboards
menu ->Groups
->All
.• Change the dashboard access groups
All
toPublic
so that it can be used widely.• Open dashboard groups
All
.• Click
+ (Add dashboard)
.• Then name it
Echeveria Dashboard
-> clickAdd
to add.• Change
title
toSistem Perawatan Echeveria
.• Select
desired widget
-> settings on widgets.
-
Firmware configuration :
• Go to
Entities
menu -> then selectDevices
->Groups
.• Click
EcheveriaIoT
-> copy theDevice ID
andToken
mentioned.• Then paste in the firmware code, for example like this :
#define DEVICE_ID_TB "26001630-a274-11ee-9db5-1fb69bbe078f" #define ACCESS_TOKEN_TB "tovosJJOLHzwc42DSfvM"
-
Open @BotFather.
-
Type
/newbot
. -
Type the desired bot name, for example:
echeveria_bot
. -
Type the desired bot username, for example:
echeveria_bot
. -
Also do it for bot image settings, bot descriptions, and so on according to your needs.
-
Copy
your telegram bot API token
-> then paste it into the#define BOTtoken "YOUR_API_BOT_TOKEN"
section.For example :
#define BOTtoken "5911801402:AAFEEuBYHPmDxlYQxfPpTCZkRpn5d8hV_3E"
-
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].
Device |
---|
Telegram Bot Interface | Monitoring via Blynk Mobile | ||
---|---|---|---|
Monitoring via Thingsboard |
---|
Via Telegram: @echeveria_bot
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 © 2023 - 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.