Arquitectura de software basada en microservicios
aplicados en un entorno Smart Campus
Software architecture based on microservices
applied in a Smart Campus environment
Recibido: enero 18 de 2019 | Revisado: febrero 15 de 2019 | Aceptado: junio 17 de 2019
Eiriku Yamao1,2 Norma
León Lescano1,3 José
Luis Yapor Vallejos 1,4
ABSTRACT
The present work is aimed to describe the microservice
based architecture used in macetamascota, part of a smart
campus project in Universidad de San Martin de Porres
(Peru). A microservice architecture was successfully
implemented in a smart campus environment to improve the
self-sufficiency and sustainability of the flowers and
ornamental plants inside campus. Results show the key
components and interactions for a microservice architecture
for smart campus, setting the groundwork for further studies
and scaling into a larger city- wide implementation
Keywords: Microservice Architecture, Internet of things,
smart campus.
RESUMEN
El presente trabajo tiene como objetivo describir la arquitectura
orientada a servicios utilizada en el proyecto “macetamascota”,
como parte de las soluciones que integra el campus inteligente en
la Universidad de San Martín de Porres (Perú). Se implementó con
éxito una arquitectu- ra de microservicios en un entorno de campus
inteligente para mejorar la autosuficiencia y la sostenibilidad de las
flores y plantas ornamentales dentro del campus. Los resultados
muestran los componentes e interacciones clave de la arquitectura
para el campus inteligente, estableciendo las bases para futuros
estudios y ampliando a una implementación más grande en toda la
ciudad.
Palabras clave: Arquitectura de microservicios, Internet de
las cosas, campus inteligente.
1 Applied Research Laboratory, San Martin de Porres University
Lima, Perú
2 Eyamao@usmp.pe
3 Nleonl@usmp.pe
4 Jose_yapur@usmp.pe
DOI: http://dx.doi.org/10.24039/cv201971330
60 Cátedra Villarreal | Lima, Perú | V. 7 | N. 1 | Enero - Junio | 2019 | e-ISSN 2311-2212
Introduction
Technological convergence demands universities to
apply methods and technologies to transfer knowledge
using practical examples. A popular solution of a
learning platform for IoT and smart cities is the smart
campus approach. Higher Education Institutions are
effectively mini autonomous cities with their own
governance, economy and socio-cultural system (Pavez
& Agrawal, 2019). The smart campus is used to test and
demonstrate the implementation of a smart city solution in a
relatively smaller, more controlled environment to serve as a
mode of transition for a city’s journey to becoming a smart
city (Zhuhadar, Thrasher, tMarklin, &
Ordóñez, 2017), (Bruneo, y otros, 2019).
IOT solutions offer opportunities to create and
capture value for a wide range of people, places and
products, so they must have solid and agile architectures
according to the business problems that are solved and
the creation of real commercial value.
Microservices is a way of decomposing complex,
monolithic applications into tasks running as independent
processes, enabling updates and scaling of the services in
isolation, even to be written in different coding
languages (Banica, Stefan, & Hagiu, 2017). The
microservices approach is considered to help in IoT to deal
with multiple connected devices, handle demand peaks,
allow remote and automated deployment, flexibility in the
technological stack and programming languages
(Banica, Stefan, & Hagiu, 2017) (Götza, y otros, 2018);
are all considered as beneficial, especially in large
scale implementations as in smart cities and smart
campuses, where multiple solutions coexist.
In this paper we present the software architecture
based on microservices for a smart campus solution in
the form of a smart gardening system for the flowerpots
in the Faculty of Engineering and Architecture Campus
of the Universidad de San Martin de Porres.
Related Work
Multiple IoT and smart city projects has been
implemented in a smart campus environment. Studies
about smart grid and energy management (Seidita,
Chella, & Carta, 2016), (Filimonova, Barbasova, &
Shnayder, 2017) smart mobility (idell’Olio, Borda,
& Barreda, 2014), (Lim, eKim, & Maglio, 2018),
sustainability (Hashim, Haron, Mohamad, & Hassana,
2013), (Mehta, y otros, 2017), (Yasin, Rasul, &
Khan, 2017) were presented.
A four-layer model is proposed as a case to
demonstrate the viability and advantages of using a
microservice architecture in IoT. The tasks executed
by the “things” (authentication, data transmission/
reception, interaction with other devices) are handled with
the microservices in a scalable, independent and
collaborative manner (Banica, Stefan, & Hagiu, 2017).
Another microservice based framework is presented
by (Kousiouris, y otros, 2019) for integration of IoT
management, semantic and AI services for supply chain
management. The framework enabled the
integration between diverse and complex systems
using a three-layer system architecture.
In 2019 StoRM, a social, distributed and hybrid
reputation model bases on microservices for IoT is presented
(Kravari & Bassiliades, 2019). The microservice
architecture was used for the implementation of services and
device handling. Each device microservice is related to an IoT
device, where complex devices are represented with multiple
microservices.
Another study is about a Cyber-Physical microservice
and IoT-based framework for manufacturing assembly
system, where a cyber-physical microservice layer is
placed between the application layer and the IoT devices
layer. Microservice architecture provides the
framework with flexibility for the assembly workers
and assembly process in an Industry 4.0 compliant
manufacturing process (Thramboulidis,
C.Vachtsevanou, & Kontou, 2019).
Smart campus FIA USMP
Smart Campus FIA USMP is a Project implemented
in the Faculty of Engineering and Architecture campus of
“Universidad de San Martin de Porres” in Lima, Peru.
It’s a multidisciplinary collaborative project between
researchers, students and faculty members to improve
campus life by developing multiple solutions to achieve
some of the characteristics of a smart city, to carry out
studies and proof of concepts.
Cátedra Villarreal | Lima, Perú | V. 7 | N. 1 | Enero - Junio | 2019 | e-ISSN 2311-2212 61
MascoMaceta
MascoMaceta (pet flowerpot in Spanish) is one of
the projects of the Smart Campus FIA USMP. It is
aimed to make the flowers and ornamental plants
inside the campus self-sufficient and sustainable.
Each flowerpot is equipped with sensors to detect soil
moisture and sunlight. A default parameter for the
sensors is set depen- ding of the type of the plant. When
the moisture level becomes lower than the threshold
level, an automatic watering system is activated. A
similar mechanism is in place for the sunlight sensor,
where a daily required amount of time under sunlight is
set and a motion mechanism for some of the pots are
installed to move within a set perimeter to receive more
sunlight if necessary.
Microservice based architecture
The three-layer, microservice based architecture is
shown in Figure 1. The device layer is composed
of sensors and actuators, controlled by a microcontroller
or a Single board computer; The Application Layer
is hosted in a cloud environment accessed by the
devices via the campus Wi-Fi network; and the
presentation layer consists of the interfaces the end user
can use to interact with the system.
Device Layer
a) Sensor Module
Each flowerpot will be equipped with a YL-69+ YL-38
soil moisture sensor and a Light dependent resistor.
The sensors measure real-time values for soil moisture and
sunlight intensity and is converted by a 10-bit Analog
Digital Converter to values ranging from 0 to 1023. A
manual calibration of the sensors upon installation on the
flowerpots is required to assure proper func- tioning.
An error detection mechanism for the sensors is also
programmed to detect unexpected values registered to send
alerts to the user for possible sensor failure.
b) Motion and collision detection module
Some of the smaller flowerpots is placed on top of a
moving platform with collision detection mechanism
using HC-SR04 ultrasonic sensors. During daytime it
will search for the best place to spend the established
amount of time under sunlight and at late
afternoon/ evening it will go back to an assigned space.
In the initial versions of the project the movement are
relatively simple (forward and backward for a limited
distance) and is planned for a later instance a geo space
localized platform using GPS to improve the control of
the movement inside an established perimeter.
Figura. 1. The three layer microservice based architecture
62 Cátedra Villarreal | Lima, Perú | V. 7 | N. 1 | Enero - Junio | 2019 | e-ISSN 2311-2212
c) Watering and battery charging module
To improve self-sufficiency and sustainability of
each plant, an automated watering system is under
development, activated when the soil moisture of the plant
reaches a threshold value. The first version of the
watering device is a small container of water activated
by a solenoid valve equipped in each flowerpot.
Also, in the works is an automated battery charging
system with two options being considered. First, a solar
panel based recharging system, given that most of the
plants are outdoors or in a place where sunlight is
present, is the most obvious one; second, a wireless
battery charging system, similar to what is found for
mobile phones is being studied as an alternative for
indoor plants with low sunlight requirement.
Application layer
The application layer is where the business logic and
algorithms are executed inside the cloud. Given the
continuous growth of IoT, from the number of devices to
be connected and the different types of things that can be
turned into an IoT application, a traditional, monolithic
software architecture, where one of the main issues is
the scalability is inadequate for these kinds of solutions.
A Microservice based architecture has been
selected based on that many of the advantages of this
architecture: easy to scale, easy to deploy, ability to
use different technologies; are a great fit for IoT and
smart campus projects. For mascomaceta, a service is
implemented for each of the main entities of the
system: plant, flowerpot, location and adopter. The
microservices are deployed in the Microsoft azure
cloud environment using a serverless deployment.
Presentation layer
There are three ways the end user can interact
with mascomaceta. First, a mobile app is used for the
registration of new plants by the adopters, where the
plant type, flowerpot code, location and information
of the adopting parent is registered. Upon registration
the default parameter according to the plant type is set
for the flowerpot and data collection begins. In
case of any trouble happens to the flowerpot, the
user is alerted via this app with the type of error.
Secondly, there is a web app for the system
administrators where they can perform data
management operations for plant, flowerpot,
location and adopter.
The default parameter of sensor values is also
configured via this app which can also be set to have
specific values for each flowerpot if necessary. A
simple alert tracing option is also included where the
administrator can see the current state of the flowerpot
present inside the campus and handle error alerts,
which can be fixed remotely via this app or might require
sending someone to physically check on the sensors.
Finally, a business intelligence and analytics option
give each person access to the current state of their plant
and its location in campus. Historic data of sensor values is
also accessible if the user requires some deeper analysis,
with a detailed view of any active or past alerts. The
business intelligence app is developed with Microsoft
Power BI, accessible through the university office 365
account, as shown in Figure 2.
Conclusions
This paper presented a microservice based
architecture for IoT applied in a smart campus context.
A microservice approach was successfully implemented
for the mascomaceta, a project aimed to automate the
flowers and ornamental plants maintenance
process. The main functionalities of the three-layer
architecture used is presented, with the elements of
each of the layers: device application and presentation
layers are described.
The microservice implementation lays the
groundwork for future works inside the smart campus,
where projects for access control with facial
recognition, library administration with RFID, Virtual
reality and augmented reality powered campus touring
system, and others are in the works.
Finally, it is planned to apply machine learning and
artificial intelligence algorithms to all the generated
data inside the smart campus to improve the campus life
experience for students, teachers and faculty staff.
Also, a cooperation agreement with a local municipality
is being explored.
Cátedra Villarreal | Lima, Perú | V. 7 | N. 1 | Enero - Junio | 2019 | e-ISSN 2311-2212 63
Figura 2. Sample of BI report in macetamascota
References
Banica, L., Stefan, C., & Hagiu, A. (2017). leveraging
the microservice architecture for next-generation
iot applications. Scientific Bulletin: Economic
Sciences,, 26-32.
Bruneo, D., Distefano, S., Giacobbe, M. L., Longo, F.,
Merlino, G., Mulfari, D., ... Tapasa, N. (2019). An
IoT service ecosystem for Smart Cities: The
#SmartME project. Internet of Things, 12-33.
Filimonova, A., Barbasova, T., & Shnayder, D. (2017).
Outdoor Lighting System Upgrading Based on
Smart Grid Concept. Energy Procedia, 678-688.
Götza, B., Schela, D., Bauera, D., Henkela, C.,
Einbergera, P., & Bauernhans, T. (2018).
Challenges of Production Microservices. Procedia
CIRP, 167-172.
Hashim, R., Haron, S., Mohamad, S., & Hassa- na,
F. (2013). Assessment of Campus Bus Service
Efficacy: An Application towards Green
Environment. Procedia - Social and Behavioral
Sciences, 294-303.
idell’Olio, L., Borda, M., & Barreda, R. (2014). A
Methodology to Promote Sustainable
Mobility in College Campuses. Transportation
Research Procedia, 838-847.
Kousiouris, G., Tsarsitalidis, S., Psomakelis, E.,
Koloniaris, S., Bardaki, C., Tserpes, K., ...
Anagnostopoulos, D. (2019). A microservice-based
framework for integrating IoT management
platforms, semantic and AI services for supply
chain management. ICT Express, 141-145.
Lim, C., eKim, K.-J., & Maglio, P. (2018). Smart
cities with big data: Reference models,
challenges, and considerations». Cities, 89-99.
Mehta, P., Zhang, D. X., Thomas, R., hJadhav, N.,
Lee, J., Conaghan, C., & Rawte, R. (2017).
Harvesting 3D Multiphysics Modeling
Techniques for Smart and Sustainable
University Campus. Energy Procedia, 851-858.
Parvez, N., & Agrawal, A. (2019). Assessment of
sustainable development in technical higher
education institutes of India. Journal of Cleaner
Production, 975-994.
64 Cátedra Villarreal | Lima, Perú | V. 7 | N. 1 | Enero - Junio | 2019 | e-ISSN 2311-2212
Seidita, V., Chella, A., & Carta, M. (2016). A Biologically
Inspired Representation of the Intelligence of a
University Campus. Procedia Computer Science,
185-190.
Yasin, G., Rasul, M., & Khan, M. (2017). The Integration
of Day Light with Advance Fuzzy Based
Controllers for Institutional Buildings in the
Region of Central Queensland, Australia. Energy
Procedia, 2429-2437.
Zhuhadar, L., Thrasher, E., tMarklin, S., & Ordóñez,
P. (2017). Leyla Zhuhadara Evelyn Thrasher a,
Scarlett Marklin b, Patricia Ordóñez de Pablos c.
Computers in Human Behavior, 273-281.
Cátedra Villarreal | Lima, Perú | V. 7 | N. 1 | Enero - Junio | 2019 | e-ISSN 2311-2212 65