Generic framework for industrial 4.0 applications based on internet of things

Use your smartphone to scan this QR code and download this article ABSTRACT The Internet of Things (IoTs) is a network of interconnected devices, transportations, home appliances, and other devices. They are functionally embedded in electronics, software, sensors, actuators, and connectivity that allows them to connect and exchange information. On the basis of the IoT concept, implementations are gradually being proposed in a range of areas, ranging from smart house, smart office and smart agriculture. In this research paper, a generic framework for smart monitoring applications based on the IoTs network is proposed. In this framework, low-powered sensor nodes are based on the micro:bit platform, providing a multiple footprints for different sensor connections. The wireless capability on micro:bit provides a complete solution to deploy the system in such places that wire is impractical to draw. The data is wirelessly gathered by a basestation node that is powered by Android Things operating systemprovided by Google. This operating system is based on the Android platform for smart devices and Internet of Things products. The approach to this framework indicates a low cost and minimum setup and especially amenable for applications control. To support many applications with minimummodifications, the framework is designed for easy expansion by supporting popular serial connection ports, including the Universal Asynchronous Receiver/Transmitter and Serial Peripheral Interface. With these connections, on one line data bus, several sensors can be added to match the different application requirements. In this paper, our platform is validated for an automatic water monitoring in aquaculture based on the temperature, pH and dissolved oxygen sensory data. Through our framework, the data is uploaded to a cloud for remote monitoring and providing alarms for users whenever the data is out of a predefined safe domain.


INTRODUCTION
The Internet Of Things (IoTs) is the key point in the development of Industry 4.0 which is characterized by the generation of device connected network. They can be mobile phones, transportation, home appliances and up-to-date wearable embedded with sensors and activators connected to the Internet so that these objects can exchange data with each other 1 . Things will be provided with the unique identifiers (UIDs) and with the ability to transfer data over a network without requiring human-to-human or human-to-computer interactions 2 . Technology research firm Gartner estimates that 6.4 billion wireless devices will be used globally in 2019, more than 30 percent from 2018. Gartner also estimates that the figure will increase by more than threefold, to about 20 billion by 2020. The IoTs network especially smart controlling appliances have continuously developed competitively on wide range of fields from home control 3 , parking lot guidance 4 , healthcare system 5 , and military surveillance 6 . The fundamental similarity between these ap-plications is the combination of small sensor nodes using low-power sensing devices, a micro-controller embedded in the system, and a transceiver connected in wireless protocol. They are randomly deployed, to cover the physical area of the application 7 . The purpose of the embedded micro-controller is processing the collected data from the sensors which has been designed to produce a number of measureable changes such as temperature, moisture, pressure and humidity in physical environments. The wireless transceiver gives a medium for the transmission of information derived from the sensors to the base station or by inter-communication between several nodes. Finally, the gathered information at the base station can be uploaded to a cloud server for remote monitoring. The advantages of smart monitoring applications based on IoTs network compared to traditional approach can be summarized as follows: • The system is easily deployed, especially in remote areas, where wire connection is im- practical to draw. The wireless communication of sensor nodes allows a quick deployment of the application, without the need of complex infrastructure 8 . Moreover, the latest developments in micro-electro-mechanical systems (MEMS) technology, wireless radio transceivers and digital electronics have made modest, lowperforming and multi-purpose sensor nodes small in size and efficient for processing and wireless communication 9 . Therefore, a sensor node can support a long system lifetime, which can be up to two years without the battery replacement or maintenance. • Sensory data is updated frequently. According to the Quality of Service (QoS) of the application, the sensory data are able to upload regularly to the server, keeping the system up to date. Moreover, Sensory data may follow a certain pattern and can be expected for some time 10 .
In spite of these issues, a prediction mechanism can be introduced for forecasts. Leveraging predicted data, the sink node decides the usage of forecast data, the coverage and influences of possible events and the creation of these events. This feature especially provides an interest to monitoring applications, where threads can be predicted and handled as soon as possible. • Different low-powered sensors are available to support a wide range of monitoring applications. In the recent years, wireless sensor networks have reached a wide range of applications and devices with various specifications and characteristics 11 .
In this paper, we present an overview of potential monitoring applications based on the IoTs that is utilized from Wireless Sensor Networks (WSNs). Beside a lot of opportunities of these applications, challenges to widely deploy them are also presented. Moreover, a generic platform based on Android Things operating system is also proposed. This platform is well adapted to different applications by easily changing the sensors. In this paper, this platform is deployed to monitor the quality of water in aquaculture environment. The contributions of the paper are listed below: • An overview of smart monitoring applications: Opportunities and Challenges. • A generic framework for smart monitoring applications based on micro: bit MCU and Android Things base station node. • Implementation automatic water monitoring in aquaculture, providing the temperature, pH and dissolved oxygen sensory data.
The rest of this paper is organized as follows. An overview of monitoring applications based on the IoTs network is presented in Section II, followed by their challenges in Section III. In Section IV, a generic IoT platform based on Android Things operation system is proposed and validated in agriculture water monitoring in Section V. Finally, the paper ends with conclusions.

MONITORING APPLICATIONS BASED ON IOT
IoTs has presented a promising opportunity to develop efficient real-time systems and applications using wireless technology and sensor products. An overview of an IoTs architecture for monitoring applications is depicted in Figure 1. It includes sensor nodes, gateways, a server and a smart-phone application. A sensor node normally is a microcontroller-based system that can sense data, which are application-dependent, in real time and that is low energy consumption for long life working. A sensor node transfers the sensory data to the nearest IoT Gateway using wireless technologies such as WiFi, LoRa and Bluetooth Low energy. A gateway is a processor-based system that runs an operating system such as Linux or Android. It can communicate with sensor nodes to obtain sensory data and send the sensory data to a server via WiFi or 2G/3G/4G/LTE mobile communication. A server processes the sensory data and generates useful information to the third party applications through a security interface. The third party applications can render the useful information to the user through a smartphone or a web page. Following the architecture in Figure 1, a wide spectrum of IoT technologies have been developed and implemented over the last year in a number of fields for instance: home automation agriculture [12][13][14] , food production, environmental monitoring, security surveillance and others 15 . Monitoring applications, such as smart healthcare monitoring, intelligent transport system, environmental tracking system, is one of the most active domains.

Smart Healthcare Monitoring
The real-time healthcare monitoring via connected sensors can save lives in events of a medical emergency such as heart attacks, diabetes, and asthma attacks. The IoTs is improving the healthcare services by enabling real-time alerting, tracking, and monitoring to activate hands-on treatments, better accuracy, apt intervention by doctors and improve complete patient care delivery results. Instead of directly monitoring in hospitals, patients can be monitored regularly even at home using smart devices that provide health status information. Moreover, in order to track the condition in real time using a smart medical system internet -connected, sensors can capture medical and other appropriate health data. and then, transfer collected information to a physician. Finally, medical IoT devices capture crucial data and send it to doctors for real-time surveillance, while notifying people about critical factors through smartphone apps and other related devices.

Intelligent Transport System
An intelligent transportation system (ITS) is an advanced and IoTs-enabled application which focuses on achieving transportation quality by avoiding traffic jams and issues 16 . ITS helps citizens be better informed about traffic, local convenience real-time running information and Available seat that eliminates travel time and guarantees the safety and amenity.
There are a few sub systems that belong to an ITS such as Traffic monitoring system, smart parking system, public transport management, and electronic toll collection system. We briefly describes these systems in the following.

Traffic monitoring system
One of the reason for traffic congestion is fixed and long red light delays. So, controlling the traffic light in the intersections and optimizing the green light period is necessary. By interconnecting and fetching data from the intersections via cameras, traffic lights can be synchronously gathered in order to diverge the traffic at the particular conjunctions. The Artificial Intelligence and Machine Learning are also taken into image processing operation to identify the signalized points and make the controller control the traffic light timing, ensure the smooth traffic flow 17 .

Smart parking system
A practical application for inner-city and outer-city in busy developing and developed countries which provides citizens the information and location of the nearest parking lots. The users can reserve the parking area for their vehicles, or even pays the annual parking fee via the supporting applications and electronic wallet (e-wallet).

Public transport management
The information of public transportation such as locations, velocities, arrival time and routes are provided for the user by the mobile application and electronic boards at the stations. The purpose of this solution is to manage properly the transportation's activities and its owners. Besides, the mobile application not only informs the information of each type of public vehicles, but also guides the user to make the suitable selection for their travel based on the construction of sensing system information.

Electronic toll collection system
Electronic toll collection (ETC) system achieves the goals of reducing the toll booth, expands the area for vehicles, especially on high ways. Furthermore, the process of license identification and payment due to each type of vehicle can be saved by automatic plate recognition and simultaneous toll payment calculation. The user can use e-wallet to pay the fee by scanning the QR Code. In the future, the more ETC system is set up, the more spacious the road is.

Environment Tracking System
Transport emission seems to be the main factor that causes air pollution in big cities around the world because it emits the large amount of Particulate Matter (PM) such as Volatile Organic Compounds (VOC) included NOx, CO and SOx. These pollutants harm to human health, atmosphere and also climate. Being formed by process of incomplete combustion, pollutants such as PM and BTEX (Benzene, Toluene, Ethyl, Xylene) are concerned as pollutants that must be controlled and prevented its effect from affecting to human health according to the report of United

MONITORING APPLICATION CHALLENGES Energy Consumption
Energy optimization is a critical issue for monitoring applications, which normally requires a long-system lifetime. When a large number of sensor nodes are deployed to cover the monitor areas, battery maintenance or replacement becomes a burden. Obviously, there are two different approaches to overcome this issue. Firstly, there has been a variety of strategies to scale back the consuming engergy such as using nanowatt wake-up radio receivers 19 and adequate MAC protocols scheduling implementation 20 . Despite the improval in system operation period, the small battery capacity used as storage devices still cripples it. Secondly, a new paradigm for designing sensor nodes is mentioned. In order to consolidate, or even eliminate batteries, environmental energy sources have been integrated. Thanks to advancements in the field of energy harvest, eternal environmental energy can be harvested and fully autonomous WSNs can be built. A large range is provided for the use of WSNs, for example solar photovoltaics 21 , thermoelectric thermal energy 22 and wind generators for airflow power 23 , which are inexpensive, compact and power-rich harvesters.

Adaptive and Autonomous
Event ambient energy such as solar or wind can be scavenged as long as possible, the sensor nodes have to cope with the energy fluctuations from these sources. For instance, solar energy can be reduced significantly in a rainy day compared to a sunny day and wind energy is a kind of unpredictable source 24 . Therefore, a sensor node must be adaptive to its operations, to reach an ideal state, named Energy Neutral Operation (ENO) 25 . In this state, the overall energy expended is equivalent to energy harvested over a long period of time. This approach will have potentially everlasting life (until the hardware is out of date).
The most common solution is to control power transfer 26 as well as using duty-cycling with a shifting wake-up interval, apart from dynamic voltage and frequency scaling 27 . The solution directly affects the MAC protocol, which is the key consumed sources of the WSN node 20 . In fact, environmental behaviors in PM policies should be taken into consideration.
While fluorescent light provides practically continuous power with rare interruptions in hospitals or heat from industrial equipment, solar or indoor light energies are often occasionally absent, accompanied by energy intervals. The PM must propose plans for the reservation of harvested energy before they are available to guarantee continuous operations.

Wireless Data Collection
Data collection is another issue in monitoring applications based on IoTs. In order to cover such a large area, sensor nodes have to forward their data through many intermediate nodes since the range of the wireless communications is limited (e.g. 30m with radio frequency at 2.4GHz). In order to achieve an efficient data collection at a local base station node, an optimized routing or scheduling must be required otherwise, an intermediate node can become a bottle neck if it has to forward data from many nodes. Moreover, the network topology of the network can be regularly changed due to mobility nodes (e.g. monitoring the bus in a smart city), cause a big burden to rescheduling the whole network. However, the scheduling cannot be performed at each sensor nodes due to the limited resource of memory, computation and energy of a low-power and lowcost device. Currently, Software Defined Wireless Sensor Network (SDWSN) architectures offer significant promise to implement complex scheduling algorithms 28 . In SDWSN, the scheduling adaptations are shifted from sensor nodes to the base station, which has more computational and energy resources (typically a base station has a direct power supply).

Quality of Service
As many presumed applications exist in WSNs, their QoS requirements may vary tremendously. For instance, a failure to identify or collect wrong or incorrect information about a physical occurrence may emerge from several causes in applications involving occurrence identification and target surveillance. The location where the incident occurs cannot be protected by active sensors because of deployment and network maintenance. Intuitive, coverage or number of active sensors can be described as QoS measurement parameters in WSNs. However, focusing on the network QoS, following factors are required to characterize 29 : • End-to-end: end-to-end or non-end-to-end performance.
• Criticality: mission critical or non-mission critical.
Among these factors, the end-to-end delay is the most important in monitoring applications as it has directly impact on the system data up-to-date. This factor is normally concerned with the data collection issue in the previous sub-section. When the scheduling algorithm is not optimized, it takes a long time to forward a packet from a node away from the base station. Concurrently, the energy available in the node also has a significant effect on the QoS. If the energy is not adequate, the node cannot perform further to satisfy the QoS while following the state of the ENO 25 .

GENERIC IOT PLATFORM BASED ON ANDROID THINGS
Bach Khoa University -VNU -HCM (HCMUT), specifically in Computer Science and Engineering Department, provides study programs for training and developing popular applications on the Internet such as IoTs application development, etc. Many laboratories have invested equipment to serve students' uses, support research, research and development. This article wants to introduce a research that the group has been analysing. The topic is aimed to build a system to monitor the status of each environment type and river area, and it will accurately record the measured data and display visually. That helps managers monitor and have timely solutions when there are erratic changes. This system is designed for two-way communication, which is how to send information from sensor nodes to the central station (gateway) and to control signals from the central station to the sensor nodes variable or from user (controlled via web or mobile application). The system will be a network of multiple sensor nodes that measure environmental values and deliver data to the gateway as Figure 2. Also, the system also aims at other criteria such as low cost, high stability, convenience, easy to install, easy to repair. In general, the system consists of several main components: • Sensor node: using micro:bit circuit, combined with sensors that measure water environment data and use radio waves for wireless data transmission.
• Central station (base station -gateway): using Raspberry Pi 3 circuit with operating system embedded Android Things and also using radio waves to communicate with sensor nodes. Concurrently, the central station will be connected to the internet with an Ethernet cable or Wifi to connect to the server.
• Servers and applications on mobile devices: using ThingSpeak or MQTT (Remote queue message transmission) for the server; Phone application with Android platform. Sensor nodes are based on micro:bit circuit platform, an embedded system based on ARM hardware designed by BBC for use in computer education in the UK. With its small size and integrated motion detection technology, compass and Bluetooth, micro:bit can help quickly deploy an Android based sensor application. The sensor node is designed to connect with many popular sensor standards on the market such as Vernier, DFRobot or other 4-20mA industry standard sensors. However, in this paper, we mainly focus on building a generic IoT platform that utilizes micro:bit boards 30 as a controller in a sensor node and Raspberry Pi 3 running Android Things operating system 31 . Please note that the micro:bit board is a micro-controller based board that can obtain the sensory data in realtime. In this paper, we do not focus on security and fault tolerance because these features are normally implemented using software. As for the security feature, one can easily apply Public Key Infrastructure (PKI) 32 on Android Things with a PKI supported server in Figure 4. As for the fault tolerance feature, the number of each sensor can be triplicated as well as there is handshaking among sensor nodes and the gateway. All these techniques can be readily implemented in our proposed platform. Meanwhile, the central station is designed to be compatible with Android Things operating system, a very up-to-date operating system issued by Google for universal Internet applications. This operating system is based on the Android platform for smart devices and Internet of Things products (IoTs). This operating system still has SDK, Android Studio, Google Play Services or Google Cloud Platform developers, etc. Android Things is a platform-based operating system that allows smart devices to handle complex tasks instead of relying on some servers, which means that Android Things will fit into large devices and more functions.
Although Android Things and Raspberry PI are proposed for embedded IoTs device, ADC pins are not supported. The lack of this feature prevents deploying the system in a wide range of applications, whose sensors normally support ADC outputs. To overcome this issue, a master Analog to Digital Converter (ADC) chip, named ADS1118, is added. Based on SPI bus of the chip, our system can support up to 40 different sensors. Therefore, with this feature, our gateway can be used as a sensor in a sparse network, where the number of nodes is less than 5 33 . As it is shown in 34 , it is really a high cost if each sensor node and the gateway are equipped with a module for wireless communications. Therefore, to save this cost, the gateway need to plays the roles of a sensors by sensing data directly from the environment. The system now is no longer required the sensor nodes (see Figure 1) and only has the gateway, sending its data to cloud, without the need of sensor nodes. Moreover, multiple wireless standards are supported in our gateway, including from short range such as Zigbee and Wifi to very long range such as LoRa or 3G. Especially, the keywords for long range (LoRa) communications is a trend for applications in a smart  city, such as Intelligent Transport System or Public Transport Management (presented in Section II). The reason is that these applications require mobility networks (e.g. moving car in the city), which a burden for routing algorithms. Therefore, a long range communication is proposed to mitigate this issue since each node in the network can communicate directly with the gateway station, without the need of routing. Therefore, a driver for LoRa communication based on SX1278 chip is implemented in our system. With this driver, popular LoRa modules can be easily integrated in our system. Finally, multiple power supply sources can be used for powering the gateway: a permanent source from grid power line or power extracted from solar cells. Popular output connections such as VGA, DVI or HDMI are also supported by Android Things for visualization the data on a wide screen.

EXPERIMENTAL RESULTS
A prototype -a proposed system is applied into a water for validating the operations of the monitoring application. We use sensors from DFRobot, which helps collect water information such as the temperature, pH and dissolved oxygen (DO). An image of the prototype sensor node is shown in Figure 3. In the case of other applications presented in Section II, appropriate sensors will be used. Sensory data is sent every 30 seconds to the gateway, which is already equipped with a 3G USB in order to upload data to a cloud server. Firstly, the average power consumption of the sensor node and the gateway are 0.07W and 6W, respectively. While the sensor node is very low power, the gateway consumes nearly 100 times higher than a sensor. The main consumed energy source in the gateway is the 3G connection, which is around 2.5W, and the monitor screen, which is 1.4W in average. The power consumption measurements provide a study to choose a solar panel, to prolong the system lifetime for a longterm monitoring application. Secondly, the sensory data is plotted in website for real-time monitoring and is presented in Figure 5. As it can be seen, the temperature is very stable while there are some fluctuations of both pH and dissolved oxygen (DO) values. We found these variations on the measured values of pH and DO when there are some small waves on the water surface. However, considering the average values, our system provides a good accuracy compared to a multi-meter from LeadTec Asia company 35

CONCLUSION
IoTs has opened a novel opportunity for the proliferation of monitoring applications based on sensor nodes. In this paper, an overview of the most interested applications such as smart healthcare monitoring, intelligent transport system and environmental tracking system is presented. Beside of that, the main challenges of these applications, including the energy, wireless data collection, autonomous operations of a node and network QoS, are also discussed. Following the architecture of IoT system, a generic platform based on Android Things is also proposed. This platform is well-adapted for agriculture water monitoring, which provides sensory data concerning the temperature, pH and dissolved oxygen. These sensors are easily replaced to satisfy the requirements of an application. By adding the sensor extension, our gateway provide a complete solution to deploy the system, even in a sparse network with few nodes. In this case, no more sensors or transceivers are required as the gateway will directly collect data by itself. Future works will focus on analyzing the energy consumption of the system and adding additional power from solar cells.

ACKNOWLEDGMENT
This research is funded by Ho Chi Minh City University of Technology (VNU-HCM), under grant number To-KHMT-2019-09.

CONFLICTS OF INTEREST
Song Ngan Pham Le, Trong Nhan Le and Huu Nguyen Nguyen Tran declare that they have no conflict of interest.

HUMAN/ANIMAL RIGHTS
This article does not contain any studies with human or animal subjects performed by the any of the authors.

AUTHOR CONTRIBUTIONS
Song Ngan Pham Le contributes on the system implementations and validations, Trong Nhan Le and Huu Nguyen Nguyen Tran contribute on the related approaches and propose a generic architecture for the platform. Moreover, Huu Nguyen Nguyen Tran also