Edspert.id Final Project: Intensive Bootcamp Internet of Things Batch-10
Greenhouse is a building for plant cultivation that has a translucent roof and wall structure. Farmers are helped by the existence of this Greenhouse, 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 Greenhouse 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 Greenhouse 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.
| Part | Description |
|---|---|
| Development Board | • DOIT ESP32 DEVKIT V1 • NodeMCU V3 ESP8266 Lolin |
| Code Editor | Arduino IDE 1.8.19 (Stable Legacy Version) |
| 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 by Adafruit (Version: 1.4.4) • LiquidCrystal_I2C by Frank de Brabander (Version: 1.1.2) • ESP_FC28 by cakraawijaya (Version: 1.0.0) • MFRC522 by GithubCommunity (Version: 1.4.10) |
| Actuators | • Submersible pump (x1) • Solenoid Door Lock (x1) • Piezo buzzer (x1) • Electromechanical relay 1-channel (x1) |
| Sensor | • FC-28: Resistive Soil Moisture (x1) • LDR: Light Dependent Resistor 12mm (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) • 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) |
-
Arduino IDE
https://bit.ly/ArduinoIDE_Installer
-
CH340 USB Driver
https://bit.ly/CH340_USBdriver
-
CP210X USB Driver
https://bit.ly/CP210X_USBdriver
| Infrastructure |
|---|
![]() |
| Pictorial Diagram for ESP32 | Pictorial Diagram for NodeMCU |
|---|---|
![]() |
![]() |
| Systems Diagram |
|---|
![]() |
| Wiring |
|---|
![]() |
![]() |
/*
=====================================================
I2C Scanner for Arduino / ESP32 / ESP8266
by: Devan Cakra Mudra Wijaya, S.Kom.
=====================================================
Functions:
- Detects all connected I2C devices
- Displays device addresses in HEX format
- Displays the total number of detected devices
=====================================================
SDA and SCL Pins for Arduino / ESP32 / ESP8266
=====================================================
Arduino I2C Connection (default):
- Arduino Uno / Nano (ATmega328P)
SDA -> A4
SCL -> A5
- Arduino Mega 2560
SDA -> D20
SCL -> D21
- Other Arduino boards
SDA -> SDA pin
SCL -> SCL pin
(Refer to the datasheet or board pinout)
ESP32 I2C Connection (default):
SDA -> GPIO 21
SCL -> GPIO 22
ESP8266 I2C Connection (default):
SDA -> GPIO 4 (D2)
SCL -> GPIO 5 (D1)
*/
// Include the Wire library for I2C communication
#include <Wire.h>
// Constant that defines the delay between scans (5000 ms = 5 seconds)
const uint32_t SCAN_INTERVAL = 5000;
// Function to initialize I2C communication
// SDA and SCL pin configuration will be adjusted automatically based on the board being used
void initI2C() {
// If the board being used is ESP32:
#if defined(ESP32)
// Enable I2C communication
// SDA = GPIO21
// SCL = GPIO22
Wire.begin(21, 22);
// If the board being used is ESP8266:
#elif defined(ESP8266)
// Enable I2C communication
// SDA = D2 (GPIO4)
// SCL = D1 (GPIO5)
Wire.begin(D2, D1);
// If the board is neither ESP32 nor ESP8266
// Examples: Arduino Uno, Nano, Mega, Leonardo, etc.
#else
// Enable I2C communication using the board's built-in hardware pins
Wire.begin();
#endif
}
// The setup() function runs once when the board is powered on or reset
// It is used to initialize hardware, serial communication, sensors, modules, and the program's initial configuration
void setup() {
// Start Serial communication at 115200 baud rate
Serial.begin(115200);
// Check whether the board uses native USB
// Examples: Arduino Leonardo, Arduino Micro, some ESP32-S2/S3 boards
#if defined(USBCON) || defined(ARDUINO_USB_CDC_ON_BOOT)
// If yes:
// The program will wait until the Serial Monitor is connected before continuing execution
while (!Serial);
#endif
// Wait for 2 seconds before starting the program
delay(2000);
// Display program header
Serial.println("====================================");
Serial.println(" I2C DEVICE SCANNER ");
Serial.println("by: Devan Cakra Mudra Wijaya, S.Kom.");
Serial.println("====================================");
// Print an empty line
Serial.println();
// Initialize I2C communication
initI2C();
}
// The loop() function runs continuously after setup() has finished
// The main program logic is typically placed inside this function
void loop() {
// Variable to store the error code returned from I2C communication
uint8_t error;
// Variable to store the I2C address currently being checked
uint8_t address;
// Counter variable for the number of detected devices
uint8_t deviceCount = 0;
// Display information indicating that the scan process has started
Serial.println("------------------------------------");
Serial.println("Scanning I2C bus...");
Serial.println("------------------------------------");
// Loop through addresses from 1 to 126
// Valid I2C addresses range from 0x01 to 0x7E
for (address = 1; address < 127; address++) {
// Start communication with the address currently being tested
Wire.beginTransmission(address);
// End the transmission and store the result
// 0 = success
// 1 = data too long
// 2 = NACK received when address was sent
// 3 = NACK received when data was sent
// 4 = other error
error = Wire.endTransmission();
// If no error occurs:
if (error == 0) {
// Display information that a device was found
Serial.print("[FOUND] Device at address 0x");
// If the address is less than 16:
// Add a leading zero to keep HEX formatting aligned
if (address < 16) {
Serial.print("0");
}
// Display the address in HEX format
Serial.println(address, HEX);
// Increment the detected device count
deviceCount++;
}
// If an unknown error occurs:
else if (error == 4) {
// Display an error message
Serial.print("[ERROR] Unknown error at address 0x");
// If the address is less than 16:
// Add a leading zero to keep HEX formatting aligned
if (address < 16) {
Serial.print("0");
}
// Display the problematic address in HEX format
Serial.println(address, HEX);
}
// If the error is neither 0 nor 4:
// Ignore it, as this usually means no device exists at that address
}
// Print an empty line
Serial.println();
// If no devices were found:
if (deviceCount == 0) {
// Display a message indicating that no devices were found
Serial.println("No I2C devices found.");
}
else { // If at least one device was found:
// Display the total number of detected devices
Serial.print("Total devices found: ");
// Display the value of deviceCount
Serial.println(deviceCount);
}
// Display information about the next scan
Serial.print("Next scan in ");
// Convert milliseconds to seconds
Serial.print(SCAN_INTERVAL / 1000);
// Display the unit in seconds
Serial.println(" seconds.");
// Empty line
Serial.println("\n");
// Wait 5 seconds before performing the next scan
delay(SCAN_INTERVAL);
} |
-
Open the
Arduino IDEfirst, then open the project by clickingFile->Open:•
Final_Project_Edspert_Batch10_ESP32Project.ino•
Final_Project_Edspert_Batch10_NodeMCUProject.ino
-
Fill in the
Additional Board Manager URLsin Arduino IDEClick
File->Preferences-> enter theBoards Manager Urlby copying the following link :https://dl.espressif.com/dl/package_esp32_index.json http://arduino.esp8266.com/stable/package_esp8266com_index.json
-
Board Setupin Arduino IDEi
How to setup the
DOIT ESP32 DEVKIT V1board• Click
Toolssection ->Board->Boards Manager-> Installesp32.• Then selecting a board by clicking:
Tools->Board->ESP32 Arduino->DOIT ESP32 DEVKIT V1.ii
How to setup the
NodeMCU V3 ESP8266 Lolinboard• Click
Toolssection ->Board->Boards Manager-> Installesp8266.• Then selecting a board by clicking:
Tools->Board->ESP8266 Boards->NodeMCU 1.0 (ESP-12E Module).
-
Change the Board Speedin Arduino IDEi
How to change the speed of
DOIT ESP32 DEVKIT V1boardClick
Tools->Upload Speed->115200ii
How to change the speed of
NodeMCU V3 ESP8266 LolinboardClick
Tools->Upload Speed->115200
-
Install Libraryin Arduino IDEDownload all the library zip files. Then paste it in the:
C:\Users\Computer_Username\Documents\Arduino\libraries
-
Port Setupin 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:• If
ESP32 boardcannot processSource Codetotally -> PressEN (RST)button ->Restart.• If
ESP32 boardcannot processSource Codeautomatically then :-
When information:
Uploading...has appeared -> immediately press and hold theBOOTbutton. -
When information:
Writing at .... (%)has appeared -> release theBOOTbutton.
• If message:
Done Uploadinghas appeared ->The previously entered program can already be operated.• Do not press the
BOOTandENbuttons at the same time as this may switch toUpload Firmwaremode.
-
-
If there is still a problem when uploading the program, then try checking the
driver/port/otherssection.
-
Getting started with Antares :
• Please Sign Up first.
• Then please Sign In to access the service.
-
Activate Access Key :
• Go to
Accountmenu.• Click
Get Access Keyto 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
Applicationsmenu.• Click
+ Create an Application.• In the
Add Applicationmenu, 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 createdmenu.• 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
Accountmenu.• Copy
Access Keymentioned.• Paste in the firmware code, for example like this :
#define ACCESSKEY "1444e88d02acb758:b996115b1c2f6f0f"
• Then, the
Project nameandDevice namemust match what was created earlier. For example :#define projectName "FinalProject_Edspert10" #define deviceName "GreenHouse_Device1"
-
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-Green-House-Berbasis-IoT-Mobile-Apps\Src\MIT App Inventor Project\directory :•
Smart_Green_House_Device_1.aia•
Smart_Green_House_Device_2.aia
-
Click the
Blockbutton and set the following points :
• Fill theinitialize global url tosection 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 listsection as follows :make a list :X-M2M-Origin.YOUR_ACCESS_KEY.Content-Type.application/json;ty=4.Accept.application/json.
-
Then click
Connect-> next selectAI Companion. -
Open your smartphone, then in the
Google Play Storesearch for theMIT AI2 Companionapplication, then install it. -
Open the
MIT AI2 Companionapp. -
Select
Scan QR Codemethod. -
Point your smartphone at the
QR Codearea on theMIT App Inventorsite. -
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.
-
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].
| Monitoring Device using ESP32 | Antares Platform for ESP32 |
|---|---|
![]() |
![]() |
| MIT App Inventor Configuration for ESP32 | |
![]() |
|
| Control Device using NodeMCU | |
|---|---|
![]() |
![]() |
| Antares Platform for NodeMCU | |
![]() |
|
| MIT App Inventor Configuration for NodeMCU | |
![]() |
|
| Simulation of Monitoring with Mobile Apps | |
|---|---|
![]() |
![]() |
There is a Little Bug in the RFID Reading Part.
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.














