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

devancakra/Sistem-Perawatan-Echeveria-Peacockii-Berbasis-Bot-of-Things

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Source Love License: MIT GitHub last commit Project

Sistem-Perawatan-Echeveria-Peacockii-Berbasis-Bot-of-Things

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.



Project Requirements

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)



Download & Install

  1. Arduino IDE

    https://bit.ly/ArduinoIDE_Installer
    

  2. CP210X USB Driver

    https://bit.ly/CP210X_USB_Driver
    



Project Designs

Hardware Design
pictorial-diagram
Software Design
flowchart-blynk flowchart-thingsboard



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
}



Arduino IDE Setup

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

    SistemPerawatanEcheveriaBlynkIoT.ino or SistemPerawatanEcheveriaThingsboardIoT.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 :

    https://dl.espressif.com/dl/package_esp32_index.json
    

  3. Board Setup in Arduino IDE

    How to setup the DOIT ESP32 DEVKIT V1 board

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

    • Then click: Tools -> Board -> ESP32 Arduino -> DOIT ESP32 DEVKIT V1.


  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. Some things you need to do when using the ESP32 board :

    Arduino IDE information: Uploading... -> immediately press and hold the BOOT button.

    Arduino IDE information: Writing at .... (%) -> release the BOOT button.

    • Wait until the message appears: Done Uploading -> The program is directly operated.

    • Press the EN (RST) button and then Restart to handle the ESP32 board that cannot process the SC.

    • Do not press the BOOT and EN buttons at the same time as this may switch to Upload Firmware mode.


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



Blynk Setup

  1. 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.


  2. Create a new template :

    • Click Developer Zone -> then select My Templates option.

    • Then click + New Templates to create a New Template.

    • The NAME section is filled with Smart Farming, HARDWARE select ESP32, CONNECTION TYPE select WiFi, TEMPLATE DESCRIPTION is optional.

    • Click Done.


  3. Create datastreams :

    • Enter Datastreams menu -> click + New Datastreams -> select Virtual 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.


  4. 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.


  5. Manage dashboard on the Blynk site :

    • Click 3 dot symbol -> then select Edit Dashboard.

    • Select the desired widget then drag 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.


  6. Manage dashboards on the Blynk mobile app :

    • Open your smart phone -> then in the Google Play Store, find the application called Blynk IoT -> then install.

    • 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.


  7. Firmware configuration :

    • Go to Devices menu -> select Smart Farming -> click Device Info.

    • Copy Template ID, Template Name, and AuthToken.

    • 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"



ThingsBoard Setup

  1. Getting started with ThingsBoard :

    • Go to the official ThingsBoard website: thingsboard.cloud.

    • Log in with google account.


  2. Create a new device profile :

    • Go to Profiles menu -> then select Device 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.


  3. Create a new device :

    • Go to Entities menu -> then select Devices -> Groups.

    • Change the device access groups All to Public 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

  4. Create a dashboard :

    • Go to Dashboards menu -> Groups -> All.

    • Change the dashboard access groups All to Public so that it can be used widely.

    • Open dashboard groups All.

    • Click + (Add dashboard).

    • Then name it Echeveria Dashboard -> click Add to add.

    • Change title to Sistem Perawatan Echeveria.

    • Select desired widget -> settings on widgets.


  5. Firmware configuration :

    • Go to Entities menu -> then select Devices -> Groups.

    • Click EcheveriaIoT -> copy the Device ID and Token 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"



Telegram Bot Setup

  1. Open @BotFather.

  2. Type /newbot.

  3. Type the desired bot name, for example: echeveria_bot.

  4. Type the desired bot username, for example: echeveria_bot.

  5. Also do it for bot image settings, bot descriptions, and so on according to your needs.

  6. 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"



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

Product
product
Telegram Bot Interface Monitoring via Blynk Mobile
interfacebot-1 interfacebot-2 interfacebot-3 blynk-mobile
Monitoring via Thingsboard
thingsboard



Demonstration of Application

Via Telegram: @echeveria_bot



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 has been created by including third-party sources. Third parties here are service providers, whose services are in the form of libraries, frameworks, and others. I thank you very much for the service. It has proven to be very helpful and implementable.



LICENSE

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.

Releases

No releases published

Packages

No packages published

Languages