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

cakraawijaya/Smart-Green-House-Berbasis-IoT-Mobile-Apps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Source Love License: MIT GitHub last commit Project1 Project2 Type

Smart-Green-House-Berbasis-IoT-Mobile-Apps

Edspert.id Final Project: Intensive Bootcamp Internet of Things Batch-10

Green House is a building for plant cultivation that has a translucent roof and wall structure. Farmers are helped by the existence of this Green House, but it still requires certain conditioning in order to achieve what is desired. This is usually done traditionally, so it is considered less effective, especially in an era full of sophisticated technology like today. In addition, theft and building break-ins are topics that need attention in addition to vegetable maintenance. This project was created to help farmers to manage their Green House quickly and precisely both in close and long distances. This project has been carried out and took approximately 1 month. The system can monitor air temperature, air humidity, soil moisture, light intensity, pump status, door status, and security alarms. In addition, this system has also been provided with automatic pump control and automatic door lock features, so that this can increase efficiency in maintaining vegetables and security in the Green House area. This system is based on the Internet of Things (IoT), using HTTP as the communication protocol. The system interface uses the MIT App Inventor application.



Project Requirements

Part Description
Development Board • DOIT ESP32 DEVKIT V1
• NodeMCU V3 ESP8266 Lolin
Code Editor Arduino IDE
Driver • CH340 USB Driver
• CP210X USB Driver
IoT Platform Antares
Communications Protocol • Hypertext Transfer Protocol (HTTP)
• Universal Asynchronous Receiver-Transmitter (UART)
• Serial Peripheral Interface (SPI)
• Inter Integrated Circuit (I2C)
IoT Architecture 4 Layer
Application Support MIT App Inventor
Programming Language C/C++
Arduino Library • WiFi (default)
• HTTPClient (default)
• ESP8266WiFi (default)
• ESP8266HTTPClient (default)
• SPI (default)
• DHT_sensor_library
• LiquidCrystal_I2C
• ESP_FC28_Library
• MFRC522
Actuators • Submersible pump (x1)
• Solenoid Door Lock (x1)
• Piezo buzzer (x1)
Sensor • FC-28: Resistive Soil Moisture (x1)
• LDR: Light Dependent Resistor (x1)
• DHT22: Air Temperature & Humidity (x1)
• SW-420: Vibration (x1)
• RFID Reader (x1)
Display LCD I2C (x1)
Other Components • Micro USB cable - USB type A (x1)
• Jumper cable (1 set)
• Switching power supply 12V 3A (x1)
• Electrical relay 1 channel (x1)
• Step Down LM2596 Adjustable 3A DC-DC (x2)
• Breadboard (x2)
• NodeMCU expansion board (x1)
• Casing box (x1)
• RFID Card (x2)
• Connector male jack DC (x1)
• Bolts plus (1 set)
• Nuts (1 set)



Download & Install

  1. Arduino IDE

    https://bit.ly/ArduinoIDE_Installer
    

  2. CH340 USB Driver

    https://bit.ly/CH340_USB_Driver
    

  3. CP210X USB Driver

    https://bit.ly/CP210X_USB_Driver
    



Project Designs

Infrastructure
infrastructure
Pictorial Diagram for ESP32 Pictorial Diagram for NodeMCU
pd-esp32 pd-nodemcu
Systems Diagram
systems-diagram
Wiring
device-wiring1
device-wiring2



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 :

    Final_Project_Edspert_Batch10_ESP32Project.ino

    Final_Project_Edspert_Batch10_NodeMCUProject.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
    http://arduino.esp8266.com/stable/package_esp8266com_index.json
    

  3. Board Setup in Arduino IDE

    i

    How to setup the DOIT ESP32 DEVKIT V1 board

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

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


    ii

    How to setup the NodeMCU V3 ESP8266 Lolin board

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

    • Then click Tools -> Board -> ESP8266 Boards -> NodeMCU 1.0 (ESP-12E Module).


  4. Change the Board Speed in Arduino IDE

    i

    How to change the speed of DOIT ESP32 DEVKIT V1 board

    Click Tools -> Upload Speed -> 115200


    ii

    How to change the speed of NodeMCU V3 ESP8266 Lolin board

    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. As for program upload, the NodeMCU board is superior because it can generally be done automatically.

  12. 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 "FinalProject_Edspert10"
    #define deviceName "GreenHouse_Device1"


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-Green-House-Berbasis-IoT-Mobile-Apps\Src\MIT App Inventor Project\ directory :

    Smart_Green_House_Device_1.aia

    Smart_Green_House_Device_2.aia


  4. Click the Block button and set the following points :

    • Fill the initialize global url to section with the following format :

    https://platform.antares.id:8443/~/antares-cse/antares-id/[YOUR_APPLICATION_NAME]/[YOUR_DEVICE_NAME]/la


    • Fill the initialize global header to -> make a list section as follows :

    make a list :

    X-M2M-Origin.

    YOUR_ACCESS_KEY.

    Content-Type.

    application/json;ty=4.

    Accept.

    application/json.


  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.

  10. If you want to operate 2 systems at the same time, then you can do so with 2 different devices so that the systems do not clash.



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

Monitoring Device using ESP32 Antares Platform for ESP32
product-esp32 antaresplatform-esp32
MIT App Inventor Configuration for ESP32
mitappinventor-device1
Control Device using NodeMCU
product-nodemcu-ac1 product-nodemcu-ac2
Antares Platform for NodeMCU
antaresplatform-nodemcu
MIT App Inventor Configuration for NodeMCU
mitappinventor-device2
Simulation of Monitoring with Mobile Apps
simulation-1 simulation-2



Notes

There is a Little Bug in the RFID Reading Part.



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