Design and Implementation of Smart City Applications Based on the Internet of Things

—Since the emergence of the Coronavirus and its declaration as a global pandemic, the world has changed all sectors radically. Covid-19 has caused a very strong effect on daily life and adaptation to new ways of learning, working, and communicating. The smart city is one of the most important solutions that enable us to go on with daily life during the pandemic and beyond. The smart city employs the current technology and smart solutions to serve the community, and improve the services provided to the people, particularly in vital sectors such as health, education, electricity, transportation, communications, and others. This article deals with two innovative applications for the Internet of things in smart cities: The first refers to designing an intelligent health monitoring system, which aims to reduce the spread of Coronavirus infection from people to the medical staff, as well as reduce work pressure on the medical staff. The second application refers to monitoring electrical energy consumed by measuring and monitoring electrical parameters and energy consumption. In addition, it helps us to know the power line trespasser. Both systems are implemented by using sensors to gather data in real-time and then transmit it to the server.


Introduction
construction of the smart city, like Ningbo, Shanghai, Harbin, and Dalian [14]. The smart city is one that makes use of information and communication technologies, services, monitoring, and management more aware, interactive, and efficient. The emerging Internet of Things drives and enables a city's smartness technologically [15][16][17].
The meaning of the internet of things is connecting everything embedded with electronics, software, and sensors to the internet by enabling them to collect and exchange data [18]. The main structure of IoT depends on the data sensed by sensors or actuators and sent during the gateway to the server [19][20][21][22]. Interaction in the IoT incorporates types from device to device, thing to the device or thing to think [20]. There is no single consensus on architecture for IoT, which is agreed universally because of each company, organization, and user [23,24]. It Can be divided into simple three layers in the IoT architecture, the first layer is the sensing "Perception" layer that contains a set of nodes that can be used for monitoring, sensing, gathering data, and swapping information with other objects over the Internet [25]. This information can be passed to the second layer communication "Network" layer which responsible for transmitting the data collected from the sensing layer to the application layer [26]. The main aim of responsibility is the application in itself delivers this information to the end-user or to the platform for that matter [27]. The third layer is the services of the "Application" layer aims for receiving and processing the sensing data from the lower layers depending on the type of application to complete the requirements of the application [28]. This paper focuses on the implementation of two sectors of the smart city based on the internet of things.

Literature Review
Design and implementation of a framework for a smart city based on Internet of Things Applications is a topic of rising importance in numerous researches and studies. Consequently, a huge number of theoretic and experiential researches have been achieved by a lot of scholars to cover this topic. Several works and researches are introduced, for two applications implemented in the intelligent city based on the internet of things (IoT). Bowen and Yanjing proposed an adaptive representation and reinforcement learning phases, the graph embedding technique is used. By depending on a pair of real-life datasets, the results demonstrate that their system can helpfully decrease the epidemiological reproduction rate of the infection. Current technology has the potential of assisting in the early identification of COVID-19 cases [29]. To limit the spread of coronavirus, the authors have designed a system that can detect the coronavirus automatically from the thermal image using a smart helmet with a thermal imaging system mounted on it. The smart helmet's thermal camera technology is combined with IoT technology to monitor the screening process and obtain real-time data. Furthermore, the proposed system is equipped with facial-recognition technology and can display the pedestrian's personal information, allowing pedestrians temperature to be taken automatically [30]. The author Malik has used IoT-based sensors to sense the pitch of a voice and to check if the patient has abnormal fluctuations [31]. The embedded Thermal Imaging sensor also senses the temperature of a person and sends the attention to family iJIM -Vol. 15, No. 13, 2021 persons and the government also. In this method, the focus on deep learning techniques will help the government to screen for coronavirus infection in a large population. The automatic sensor detection and diagnosis system will help to control the spread of this virus. The author Chuyuan Wei et al presented and evaluated the information technology in building energy-saving [32]. To saving and monitoring the electrical energy for intelligent building energy monitoring. They proposed a framework system based on the Internet of Things, which has some insight into building energy consumption and can be used to achieve real-time monitoring, control, and improvement of intelligent building energy savings. A new method named Home Energy Management as a Service (HEMaaS) was proposed by the authors Chinmaya Mahapatra et al which is based on a neural network-based Q-learning algorithm. The authors proposed a self-learning and adaptive advanced Neural Fitted Q-learning method. For home energy management, the proposed method provides an agile, flexible, and energy-efficient decision-making system. In order to test the proposed method, they used a typical Canadian residential dwelling model [33]. Based on the findings, the proposed method provides a quick and feasible solution for reducing demand and conserving energy during peak periods. It also contributes to a reduction in the carbon footprint of residential buildings. By reducing or shifting their energy demand during peak periods, major residential dwellings can significantly reduce total energy consumption. Due to the curtailment of peak demand, this would assist local power distribution companies in optimizing their resources and maintaining low tariffs [34,35]. Fahad Khan et al describe an IoT-based power monitoring system that can measure and analyze electrical parameters like voltage, current, active power, and load energy consumption. To obtain real-time electrical data from consumers, the IoT-based software application 'Thing Speak' is used. Consumers and electric power companies in the SG (smart grid) paradigm can effectively manage their consumption based on this data, lowering billing costs [36,37].

Proposed Work
The proposed work to implement Internet of things technology in both electrical and health applications using the Internet of things is:

Proposed wireless smart metering system design
The smart metering unit and monitoring module are two essential parts of the intelligent wireless metering scheme. The smart metering unit is represented via the sensor nodes linked with the microcontroller unit. The sensor nodes gather the data from the physical environment. The microcontroller unit transmits the data collected by the sensor nodes to the server through the Wi-Fi using the MQTT protocol. The server will process and visualize the data collected from the sensor nodes and present them on the platform that was designed on the server. Figure (1) shows the Proposed wireless smart metering system design. In figure (1) the microcontroller unit used with sensors nodes is ESP32, the sensor used is PZEM-004t.In addition, the ESP32 was connected to a relay which acts as a switch to control 220v from a microcontroller ESP32 5v. Relay is an electrically operated switch that can be turned on or off, allowing the current to pass through or not. It can be controlled at low voltages like 3.3v or 5v provided by ESP32 or control high voltages such as 12v-24v or main voltage (120v,220v.230v).
ESP32 Microcontroller is used in many IoT projects because It is extremely powerful, with a dual-core CPU that can be locked at 80, 160, or 240 MHz. in addition, it has a ULP or ultra-low power co-processor and this represents a much slower processor that can be used to achieve slighter tasks while the big dual-core CPU in a sleep mode. ESP32 has 512 KB of on-chip as RAM used for data and program instruction. Besides this, there is also support for external memory dependent on the board used. The ESP32 is capable of handling more demanding tasks such as connecting to cameras and recognizing speech while streaming data from the internet. The biggest reason for use ESP32 is that has built-in Wi-Fi and Bluetooth. So, no need for additional radio modules likes on most Arduino boards. There is 12 ADC like shown in figure (2) which can be used to read external voltages. It has up to 34 programmable GPIO pins. Figure (3) shows the block diagram of the ESP32.  Microcontroller ESP32 takes data from the sensor nodes by using serial data communication (12C protocol).
PZEM-004t is an electrical device that measures electrical parameters of voltage, current, active energy, and energy measurement. Because of its ability to store data when power is cut off in addition to storing energy data accumulated before the power failure. So, it is very easy to use. The maximum current that the sensor can measure is 100A, while the AC voltage range can detect is from 80-260 V.

Proposed monitoring system for covid-19 patients
Remote monitoring of patients has become easier with the advent of the internet of things technology. This provides access to real-time knowledge of the patient's physiological data such as temperature, the oxygen level in the blood, etc.  (6) shows the connection between the control unit and the sensors through the logic level converter since the sensors operate at 3.3v while the micro-controller operates at 5v. Where the logic level converter allows changing between different logic voltage levels. The data is collected in the micro-controller after being collected by the sensors and then transferred to the server by Wi-Fi. The ML90614 device was used to measure the body temperature while the MAX30100 was used to measure the oxygen level in the blood and the number of heartbeats.

Results
After the data reaches the server that was collected by the microcontroller via Wi-Fi, the server will procedure and imagine the data collected using the web portal that was designed on the server. For the electrical application, the electrical parameters of current, frequency, and power are measured and shown as in figure (7).   As for health application, because the main symptoms that a person infected with Coronavirus are exposed to are high body temperature, tachycardia, and decreased oxygenation, this system monitors the health standards of the infected person and visualized the results in the web-portal. Figure (10) shows measurements of the health parameters of a person infected with this virus. The measurements in Figure 10 can be compared with the measurements in Figure  11, which shows the results of health standards for a person without coronavirus. By comparing, we observe that the affected person suffers from a high temperature and a decrease in the percentage of oxygen with a slight irregularity in the heart rate compared to the uninfected person.

Conclusion
About 10 years ago, citizens were hearing about smartphones and smart things during a series of rapid technological developments around the world. At present, the concept of smart cities is arising to its highest categorization and every country wants to go along with it. Where information and communication technology is extremely important since the smart use of these technologies is invaluable in dealing with smart city challenges. In this paper, an Internet of things application for smart cities was presented to implement a smart monitoring system to monitor the consumed electrical energy and monitor COVID-19 patients and implement it by using sensors.