0% found this document useful (0 votes)
24 views5 pages

Smart Greenhouse Application With MERN and AES-128 CBC Data Encryption Based On IoT

Uploaded by

yudhiwb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views5 pages

Smart Greenhouse Application With MERN and AES-128 CBC Data Encryption Based On IoT

Uploaded by

yudhiwb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Smart Greenhouse Application With MERN and

AES-128 CBC Data Encryption Based on IoT


Muhammad Alvito Aditya Nur Rokhman Rin Rin Nurmalasari
Department of Electrical Engineering Department of Electrical Engineering Department of Electrical Engineering
UIN Sunan Gunung Djati UIN Sunan Gunung Djati UIN Sunan Gunung Djati
Bandung, Indonesia Bandung, Indonesia Bandung, Indonesia
[email protected] [email protected] [email protected]

Sugih Gumilar Padlan Alqinsi Nanang Ismail


Department of Hardware Engineer Department of Hardware Engineer Department of Electrical Engineering
PT. Kreasi Rekayasa Indonesia PT. Kreasi Rekayasa Indonesia UIN Sunan Gunung Djati
Bandung, Indonesia Bandung, Indonesia Bandung, Indonesia
[email protected] [email protected] [email protected]

Abstract — The greenhouse is a building construction used for MERN is a collection of frameworks with the same
2023 9th International Conference on Wireless and Telematics (ICWT) | 979-8-3503-0502-9/23/$31.00 ©2023 IEEE | DOI: 10.1109/ICWT58823.2023.10335284

growing crops. Many farmers still use traditional methods for the primary programming language, javascript, consisting of
greenhouse data monitoring process, making it inefficient in terms MongoDB, Express JS, React/Next JS, and Node JS
of time and energy spent. Farmers need an attractive, fast, and frameworks. Each framework has different functions,
secure application for an efficient greenhouse data monitoring including MongoDB acting as a database, Express JS acting
process. Farmers can use a website-based application connected as a backend component, React JS/Next JS acting as a
to the greenhouse's IoT system. This research discusses a website- frontend component related to the user interface, and Node JS
based smart greenhouse application for the greenhouse data acting as a runtime environment to run javascript coding on
monitoring process. The application was developed using the
the backend [2], [3]. The research discusses the MERN
Scrum Agile Development method, where each stage has an
iterative and structured process. The technology combines
framework applied to IoT systems, namely the RESTFul IoT
MongoDB, Express JS, React, and Node JS, known as the MERN service system as a fast communication between IoT devices
framework, the MQTT protocol, and data encryption techniques and the cloud, using the MERN Stack by Preston Porter et al.
with AES-128 CBC. Testing this application uses the black box in 2019 [3].
testing method by testing 14 types of REST API services and 9 In addition, the application must also have a data security
application services. The duration of testing results varies system by utilizing data encryption technology and an
depending on the number of services to be tested. In addition to
authentication system. Sensor data generated by greenhouse
being tested with a black box, the application was tested with
plants is essential because if the data amount to thousands or
GTMetrix, which gave an "A" grade with a score of 99%, and the
total page size was 519kb. This test proves that MERN has good
even millions, machine learning models can be made, such as
enough application performance to be implemented as an IoT- forecasting weather, plant conditions, and crop yields, which
based smart greenhouse application. The encryption results of can benefit several parties or large industries. Data stored in
sensor data stored in the MongoDB database have a level of the database can be encrypted using the AES-128 CBC
randomness that is very difficult to break, so the data cannot be cryptographic technique.
processed or used to create machine learning models if the The operating mode of the AES-128 CBC cryptographic
developer's key and Initialization Vector (IV) are not known.
technique uses a unique initialization vector or array called an
Keywords — Green House, MERN, MQTT Protocol, AES-128
IV, the size of the plaintext block (n bits or one plaintext
CBC, Black Box Testing, GTMetrix block) to initialize the first block XOR operation [4].
Previously, the plaintext will be divided into several blocks,
I. INTRODUCTION and later each block can be encrypted with a note that the first
plaintext has been encrypted. By using this encryption
The greenhouse is a building made of glass or thick plastic
technique, it is expected to be able to protect large amounts of
material applied to a plant, with translucent construction to
sensor data in the database in the form of JSON so that others
manipulate and avoid environmental conditions that are not
do not easily read it. The research discusses data encryption
desired by plants so that plants can produce optimally
using AES-128 CBC on IoT systems, with the longest
regardless of the season [1]. However, many farmers still use
encryption time of 398 microseconds and the smallest
traditional methods in the greenhouse system for monitoring
throughput of 301507.538 bits/second [5].
greenhouse data that affect plants, making it inefficient in
terms of time and energy spent. In addition, many farmers still In previous research, in 2020, Rafi Dhega Ramanda et al.
do not pay attention to data security, the speed of the data conducted research with a tool designed for an Internet of
transmission process, and a fast and attractive application Things-based smart greenhouse interface application on
platform for monitoring plant conditions. Therefore, to solve Android mobile devices [6]. In 2020, Agus Sofwan et al.
this problem, farmers can use a web-based application with an conducted research with a tool designed for a greenhouse plant
Internet of Things (IoT) system in the greenhouse, using system using an Internet of Things system based on the MQTT
MERN framework technology (MongoDB, Express JS, protocol [7]. In 2019, Dania Eridani et al. researched the
React, Node JS), MQTT protocol, and data encryption MQTT protocol's performance by implementing a monitoring
techniques with AES-128 CBC. and controlling system on a Green House Chili plant prototype
[8].

979-8-3503-0502-9/23/$31.00 ©2023 IEEE

Authorized licensed use limited to: Universitas Indonesia. Downloaded on November 09,2024 at 06:30:49 UTC from IEEE Xplore. Restrictions apply.
From the above review, we designed a smart greenhouse
system with MERN and AES-128 CBC data encryption based
on the IoT. The application development process uses the
agile scrum development method, where each software
development process can be done iteratively and structured in
each part, such as application design, code development, and
quality assurance. This system consists of MERN (MongoDB,
Express JS, React / Next JS, Node JS), which acts as a
framework for creating IoT websites (frontend, backend, and
database), MQTT publish-subscribe protocol as a data
communication path, and AES-128 CBC data encryption for
sensor data security. The microcontroller used in this research
is Raspberry Pi 3B, with several components such as a soil
moisture sensor, Soil PH, DHT11, oxygen sensor, TDS, water
level, lamp, valve, blend, and pump. Thus, this system is
expected to produce a secure, attractive, fast IoT website for Fig. 2. Cipher Block Chaining (CBC) AES-128 encryption.
monitoring and controlling plant data.

II. SYSTEM DESIGN


A. System Design of Smart Green House Application
The system design in this research is shown in Fig 1. Based
on MERN frameworks, the smart greenhouse system consists
of 2 main parts: the front and backend. Frontend is the
interface application part that users can access using a
browser. The backend is the system part that deals with the
data behind the screen. Some other parts that work on the
backend side are the database and system hardware. The
backend has a critical role in performing the data transfer
process, authentication system, providing MQTT topics, real-
time data connection features with socket io, connection with Fig. 3. Usecase diagram application.
MongoDB database, and API. All sensor data is stored in the
MongoDB database and can be displayed on the frontend side B. Data Encryption with AES-128 CBC in IoT Systems
by performing a data description process based on predefined
keys and initialization vectors (IV). This process will pass
through the REST API as a link between the database and the The encryption technique in this research uses the AES-
front end, provided on the backend side containing the syntax 128 method with the Chiper Block Chaining (CBC) operation
for the data transfer process. Data from the sensor is encrypted mode. The AES-128 encryption and description process
using the AES-128 CBC data encryption scheme and sent to algorithm consists of 4 main transformation functions in each
the sensor using the MQTT publish-subscribe protocol. The round: RoundKey, SubBytes, ShiftRows, and MixColoumn
frontend and backend communicate through a runtime [9]. Fig 2 [4] shows the algorithm of the CBC technique in
environment that serves as a code execution process on the AES-128, where each block generated from the plaintext will
frontend and backend using javascript code. be XORed with the encrypted data result, the previous block's
ciphertext. The advantage of this technique is that this mode
of operation uses an initialization vector IV that is the size of
the plaintext block (n bits or one plaintext block) to initialize
the first block XOR operation [3]. This makes every cipher
message encrypted with CBC unique.

C. Usecase Diagram Application


The use-case diagram for this application is shown in Fig
3. This diagram describes the functionality of the system and
the actors who can access the system. This system has login
functions, soil monitoring, water monitoring, air monitoring,
controlling, Create, Read, Update, and Delete (CRUD) plant
data, and CRUD users. There are 2 actors in this application,
namely admin and farmers, who have their respective roles in
using it. Actors who want to access information through the
API and application dashboard must pass the login system
with the middleware process so that the jwt token for API
Fig. 1. Design of smart green house application.

Authorized licensed use limited to: Universitas Indonesia. Downloaded on November 09,2024 at 06:30:49 UTC from IEEE Xplore. Restrictions apply.
access will be obtained and the actor's role will be known.
Farmers can access all plant information, sensor data, and
control system components such as lights and pumps.
Meanwhile, besides being able to access the functions above,
the admin actor also plays a role in carrying out the user
CRUD process. If the user does not have the admin or farmer
status role, the page after the login page will directly redirect
to the welcoming page, and the data on the API cannot be
displayed as JSON data.

III. RESULTS AND ANALYSIS


The smart greenhouse application that has been made is
shown in Fig 4, which contains a login page, a dashboard
menu containing a recap feature of various sensor data, and a
component control page for the smart greenhouse system.

Fig. 5. Application menu structure.

The page menu structure in this application is shown in


Fig 5, which contains all pages with various services. The
number of web pages in this application is 15 pages. To
access the dashboard page, a user must enter the login page
first to get a token and access the dashboard middleware. On
the CRUD farmer and plant pages, there are 2 additional
pages, namely the create page and the edit data page, to add
and edit plant data or user data.
Every page view in the application can be accessed
publicly because it is hosted with VPS and Vercel. Hosting
on VPS adds NGINX and SSL-certified features to add
security to the backend system (HTTPS). In addition, to limit
access to applications and APIs, there is a middleware system
in the form of JWT tokens and admin or farmer roles to
maintain and secure application access.
Two aspects are reviewed in this study, namely the
MERN-based website aspect, which is tested using the black
box testing method, and the data security aspect by
comparing the original data from the sensor with the
encrypted data using the AES-128 CBC method.

A. Black Box Unit Testing Using Katalon and GTMetrix


The application testing process uses Katalon and
GTMetrix tools. Katalon tools are used to test application
system functionality, while GTMetrix in Fig 6 is used to
measure website performance based on existing features and
components.

Fig. 4. Website-based smart greenhouse application. Fig. 6. Performance of application with GTMetrix.

Authorized licensed use limited to: Universitas Indonesia. Downloaded on November 09,2024 at 06:30:49 UTC from IEEE Xplore. Restrictions apply.
TABLE I. SENSOR TEST RESULTS WITH DATA ENCRYPTION

TDS Sensor
No Original Data Encrypt Data (AES-128 CBC)
1 4.0 c386f8b9621ef9cc7be95e16cbfe860d
2 2.0 43e65f1428781c6288ea0f8216d2e236
3 8.0 3f51a5c14684d9cd0e192531e4ad8cf0
Oxygen Sensor
No Original Data Encrypt Data (AES-128 CBC)
1 0.1 b67ee0f7787785b6b6ae00aa8f1a74d5
2 19.0 24c1899c151010e38f3cb212626fd8c4
Fig. 7. REST API test results with Katalon. 3 10.0 f15931093862045b388b9fa948705259
Water Level Sensor (Ultrasonic)
No Original Data Encrypt Data (AES-128 CBC)
1 33.0 5d4eceb84ce3a1d7288a9b3029d1abd0
2 33.0 5d4eceb84ce3a1d7288a9b3029d1abd0
3 34.0 fe3582dace50230e84ae33c39496d5af
Humidity (DHT11)
No Original Data Encrypt Data (AES-128 CBC)
1 28.9 89425c7ad543d122b55fdc0684a05310
2 29.3 948a7fc633e00cefa64d61e1dba1174a
3 29.3 948a7fc633e00cefa64d61e1dba1174a
Celcius (DHT11)
No Original Data Encrypt Data (AES-128 CBC)
Fig. 8. Application service test results with Katalon. 1 58.0 b0aeadb147c4af2df85d95564036cf1a
2 58.0 b0aeadb147c4af2df85d95564036cf1a
The results of the summary execution and test run status 3 58.0 b0aeadb147c4af2df85d95564036cf1a
of the application using Katalon are shown in Fig. 7 and Fig. PH Soil PH Sensor
8. From this data, it can be seen that the results of application No Original Data Encrypt Data (AES-128 CBC)
testing that was done previously using the black box testing 1 9.86 fae34dd19e8e3c7d80b3f3bf3f07c80d
method, based on the stored repository object records. This 2 9.85 dd2f5acad550bc9dbddb8eab1b200de2
tool can store input data, buttons, navigation, etc. so that 3 9.84 d168c72551770465bbf3bd28b865084e
when running, the website can run automatically based on the Soil Moisture Sensor
repository. If it matches the repository object and status code No Original Data Encrypt Data (AES-128 CBC)
responses, the application testing process runs smoothly 1 166.0 9f1539f0f25c071bacfea4823780fbe9
(successfully). 2 225.0 ffe85f19ad0e6af48401890383cc0eae
3 224.0 48fc63aa4c059591594b1ec6077f3a89
This application testing process uses the black box testing
method by testing 14 types of REST API services and 9 IV. CONCLUSIONS
application services. The test results show a passed or
This research has succeeded in developing the smart
successful status, as shown in Fig 7 and Fig 8. The duration
greenhouse application with MERN And AES-128 CBC data
of the testing results varies depending on the number of
encryption based on IoT. The developed system can provide
services to be tested. In addition to being tested with a black
plant information on the dashboard application, and farmers
box, this application is tested with the GTMetrix tool in Fig
can monitor and control data using convenient, fast, and safe
6, which gives an "A" grade with a score of 99%, and the total
applications. The results of testing the application using the
page size is 519kb. Several things, such as page rendering,
black box testing method against 14 types of REST API
image size, and website algorithm code structure, influence
services and 9 application services were declared successful.
application performance. Farmers can directly use this
The duration of testing results varies depending on the number
application to monitor and control greenhouse data because
of services to be tested. In addition to being tested with a black
the black box testing process is successfully carried out.
box, the application was tested with GTMetrix, which gave an
B. The Results of Encyption and Description with AES-128 "A" grade with a score of 99%, and the total page size was
CBC 519kb. This test proves that MERN has good enough
The results of security testing of data from sensors in this application performance to be implemented as an IoT-based
study are shown in Table I. Data from the original sensor is smart greenhouse application. Sensor data stored in the
sent using the AES-128 CBC data encryption scheme. Sensor database has been appropriately encrypted using the AES-128
data will be stored in the form of encrypted data in the CBC method. Furthermore, we would like to convey that this
MongoDB database, which later, this data can be displayed research will be further developed so that research data
in the form of original data (data has been encrypted) on the analysis will be developed.
smart greenhouse website so that farmers can monitor and ACKNOWLEDGMENT
control data. All stored data cannot be used for other needs,
such as forecasting if it does not have the key and iv of the On this opportunity, we thank the Chairperson of LP2M
AES-128 CBC algorithm. By implementing AES-128 CBC and the Dean of the FST of UIN SGD Bandung for supporting
data encryption, the data generated by the smart greenhouse this research and publication.
system can be more secure from data thieves.

Authorized licensed use limited to: Universitas Indonesia. Downloaded on November 09,2024 at 06:30:49 UTC from IEEE Xplore. Restrictions apply.
REFERENCES [6] R. Dhega Ramanda, A. Sofwan, and D. M. Arfan, “Perancangan
Aplikasi Antarmuka Smart Greenhouse Berbasis Internet Of Things
[1] M. Sc. Ir. Siti Bibah Indrajati, Persyaratan Teknis Pembangunan (Iot) Pada Perangkat Bergerak Android,” TRANSIENT, vol. 9, no. 1,
Green House Sarana Budidaya Florikultur. Jakarta: Direktorat Buah pp. 2685–0206, 2020, [Online]. Available:
dan Florikultura Direktorat Jenderal Hortikultura Kementerian https://ejournal3.undip.ac.id/index.php/transient
Pertanian Tahun 2022, 2022.
[7] A. Sofwan, S. Sumardi, A. I. Ahmada, I. Ibrahim, K. Budiraharjo,
[2] V. Subramanian, Pro MERN Stack. Apress, 2019. doi 10.1007/978- and K. Karno, "Smart Greetthings: Smart Greenhouse Based on
1-4842-4391-6. Internet of Things for Environmental Engineering," in Proceeding -
[3] P. Porter, S. Yang, and X. Xi, "The Design and Implementation of a ICoSTA 2020: 2020 International Conference on Smart Technology
RESTful IoT Service Using the MERN Stack," in Proceedings - 2019 and Applications: Empowering Industrial IoT by Implementing
IEEE 16th International Conference on Mobile Ad Hoc and Smart Green Technology for Sustainable Development, Institute of
Systems Workshops, MASSW 2019, Institute of Electrical and Electrical and Electronics Engineers Inc., Feb. 2020. doi:
Electronics Engineers Inc., Nov. 2019, pp. 140–145. doi 10.1109/ICoSTA48221.2020.1570614124.
10.1109/MASSW.2019.00035. [8] D. Eridani, "MQTT Performance as a Message Protocol in an IoT-
[4] M. Vaidehi, B. Justus, and R. Principal, "Design and Analysis of based Chili Crops Greenhouse Prototyping," in 2019 4th
AES-CBC Mode for High-Security Applications," in International International Conference on Information Technology, Information
Conference on Current Trends in Engineering and Technology, Systems and Electrical Engineering (ICITISEE), Yogyakarta, 2019.
ICCTET'14, International Conference on Current Trends in [9] S. Arrag, "Design and Implementation A different Architectures of
Engineering and Technology, ICCTET'14, 2014. mix column in FPGA," International Journal of VLSI Design &
[5] R. Kurniawan Endrayanto, A. Muttaqin, and R. A. Setyawan, Communication Systems, vol. 3, no. 4, pp. 11–22, Aug. 2012, doi:
"Advanced Encryption Standard (AES) pada Modul Internet of 10.5121/vlsic.2012.3402.
Things (IoT) Advanced Encryption Standard (AES) on Internet of
Things (IoT) Module," TELKA, vol. 5, no. 2, pp. 103–113, 2019.

Authorized licensed use limited to: Universitas Indonesia. Downloaded on November 09,2024 at 06:30:49 UTC from IEEE Xplore. Restrictions apply.

You might also like