Establishment of Smart Living Environment Control System

1School of Urban and Environmental Science, Huaiyin Normal University, No. 111, ChangJang West Road, Huai'an City, Jiangsu Province 223300, China 2Department of Civil Engineering, Chung Hua University, Hsinchu, No. 707, WuFu Road, Section 2, Hsinchu 30012, Taiwan 3Department of Architecture and Urban Planning, Chung Hua University, No. 707, WuFu Road, Section 2, Hsinchu 30012, Taiwan 4Department of Landscape Architecture, Chung Hua University, No. 707, WuFu Road, Section 2, Hsinchu 30012, Taiwan 5Department of Construction Management, Chung Hua University, No. 707, WuFu Road, Section 2, Hsinchu 30012, Taiwan 6College of Engineering, Chung Hua University, No. 707, WuFu Road, Section 2, Hsinchu 30012, Taiwan

The development of technologies such as the Internet of Things (IoT) and cloud computing has greatly improved the living environment. The Building Research Institute of the Ministry of the Interior of Taiwan also utilizes smart building data to improve the intelligence and humanity of buildings and meet the needs of modern people in the smart-life era. The greenhouse effect, extreme weather, and smog make people more susceptible to weather conditions. To satisfy the health/comfort specifications required for buildings in Taiwan to be awarded smart building marks, technologies such as IoT, AI, and big data are imported to meet people's needs for a comfortable indoor living space. A temperature and humidity sensor, air quality sensor, and gas sensor are used to obtain the indoor physical environment index. An environmental control system for a smart household is established through Arduino in this study to provide a low-cost and highly smart environmental monitoring and sensing system. A micro-algorithm mechanism is used to start adjustable devices, and mobile phone interface apps are utilized to convey the environmental conditions in real time and regulate the operation of household appliances so as to improve the comfort of the indoor space and provide a comfortable and protective environment for work and living.

Foreword
Located in the subtropical zone, Taiwan features the weather patterns of tropical and temperate zones. As an island state, Taiwan has a moist and high-temperature climate because the main stream and branches of Kuroshio Current flow towards the north from the eastern and western seas of Taiwan, transporting large amounts of heat, salt, and water from the south to the north. The climate in Taiwan is diverse in general, which greatly affects the indoor living environment. In a broad sense, 90% of a person's lifetime is spent indoors, so the comfort of the indoor environment greatly affects people's health and comfort, and working and learning efficiency.
With the development and evolution of science and technology, the emergence of new hightech products can meet people's needs and provide a more convenient life. Large quantities of resources are required to produce new products, causing environmental pollution. The large amount of human activity is affecting the earth's climate, resulting in the greenhouse effect, extreme weather, and smog, causing considerable harm to health, such as a reduced ability of the human body to adjust to temperature and humidity, allergies, and cancer.

Motive and purposes of this study
Science and technology are developing rapidly in a manner similar to Moore's law of semiconductors: new information communication technologies are being developed to provide better audio and video information for sharing and use; network connections are evolving from people-to-people connection to Internet of Things (IoT) connection; information is being rapidly produced in large quantities; and new data computing and processing technologies such as big data, cloud computing, and AI are continually emerging. This trend has greatly changed people's use of information, making a livable environment and activity space more likely to be realized than before.
The Building Research Institute of the Ministry of the Interior, Taiwan, established a system of smart building marks in 2003 and increased the seven evaluation indicators to eight so that our smart building officially entered the graded evaluation stage. By employing quantitative indicators of smart buildings, the intelligence and humanity of buildings can be improved by applying specific data so as to meet the needs of modern people for a living space and a smart life. However, as indicated by the actual number of buildings satisfying the indicators of smart evaluation (Fig. 1), the acceptable level, which is the most basic level, accounts for most buildings (66.9%), followed by the bronze level (11.5%), silver level (14%), gold level (3.8%), and the highest diamond level (3.8%). (1) This shows that there is still a long way to go before the widespread adoption of smart buildings. Therefore, more effort must be made to fully apply the advantages of the information and communications technology (ICT) industry to smart buildings.
The following are the purposes of this study. A. To examine the Evaluation Manual of Smart Buildings (2016), (2) compile relevant information of health and comfort indicators of smart buildings in eight modules, and import technologies such as IoT, AI, and big data to solve people's needs for a comfortable living space. B. A smart home environment control system comprising an Arduino software and hardware system, sensing components, and controllable facilities is constructed to provide a lowcost, high-intelligence environmental monitoring and sensing system. The microcomputing mechanism is used to activate the relevant adjustment facilities to change the environmental conditions to achieve high comfort in an indoor space, so that users can enjoy a comfortable environment that protects them from the adverse effects of weather and pollution at any time.
A literature review of this article is given in Sect. 2, in which concepts such as IoT, smart buildings, thermal comfort, and building systems based on Arduino are discussed. The research design is presented in Sect. 3. The results of the study are given in Sect. 4. A discussion and conclusions are given in Sect. 5.

IoT
IoT technology is an information-carrying network comprising the internet and the traditional telecommunication network and enables all normal objects that can perform independent functions to communicate with each other. An IoT usually is a wireless network. Since there could be 1000 to 5000 devices around a person, an IoT may include 500 million to 1000 million objects. Each person on an IoT can connect a real object to the internet via an electronic label and look for its specific position on the IoT. A central computer can be used for centralized management and control of the IoT. The IoT can also be used to remotely control household devices and automobiles, look for their locations, and prevent theft. Similarly to an automatic operation system, it can ultimately collect a huge amount of information by collecting such fragmentary data. Potential applications include the redesign of roads to reduce car accidents, urban renewal, disaster prediction, crime prevention, epidemic control, and other significant social applications. The IoT will achieve broad application through the realization of worldwide digitalization. The IoT integrates scattered information and transmits digital information between objects. It has broad market and application prospects and it is mainly applied in transportation and logistics, industrial manufacturing, the health and medical field, smart environments (households, offices, factories), and individual and social fields. (3) As communication and hardware technologies have rapidly developed in recent years, many services and applications integrating these technologies into daily life have come to form the IoT. (4,5)

Smart buildings
One of the ideals pursued by the construction industry is to create a more humanized space and make building users feel physically and psychologically satisfied. The Ministry of the Interior has long been promoting smart buildings, (6) i.e., taking the realization of human space as the starting point, making good use of the strengths of the information and communication industry in Taiwan, and combining building, information, and communication technologies so as to further develop cutting-edge building technology with forward-looking and epochal characteristics which promoting the development of science and technology in Taiwan at the same time. Smart buildings combine the active sensing and active control technologies of building design and information and communication technologies so as to realize human living spaces providing safety, health and comfort, convenience, and energy efficiency. Today, smart houses and smart cities are equipped with various types of wireless sensor networks (WSNs). (7,8) The automatic devices in smart buildings are connected by a network system so that they can perform a high-efficiency service to ensure living safety while providing a healthy, comfortable, convenient, and humanized living environment.
Smart buildings have different definitions depending on the age and needs of users, research topic, and industrial product characteristics. With the advent of the ubiquitous computing era, smart building space platforms integrating electronic and information and communication technologies into living spaces have gradually gained the attention of the information and communication industry and the building industry. The applications of cloud computing will further accelerate the development of smart service technologies in buildings. Smart buildings, office spaces, and cities have become key areas of development in industry and academic research.

Thermal comfort
When the ambient temperature is too high, various functions of the human body are affected. Poor heat dissipation leads to physiological symptoms such as higher body temperature, higher heart rate, angiectasis, and dizziness. When the ambient temperature is too low, symptoms such as lower body metabolism and slower breathing occur. Therefore, when the body temperature is within a certain range, people can feel acceptable comfort.
The Danish professor P. O. Fanger (9) proposed a thermal comfort theory model in 1970. This model described the thermal balance relationship between net heat within the human body, four environmental factors (indoor temperature, relative humidity, heat radiation, and wind speed), and two human factors (amounts of clothing and work). According to the standard ISO 7730 formulated by the International Standards Organization (ISO) in 1984, thermal comfort is defined as the state when a person's subconscious feels satisfied with its local thermal environment. (10,11)

Building systems based on Arduino software
Arduino (12) software was originally designed for students who could not write programs, did not understand electronics, and had no technical background. The first group of Arduino users was students from Interaction Design Institute Ivrea in northern Italy. Massimo Banzi, one of the co-developers of Arduino, once said, "We gave these students two to four weeks to prepare a physical processing unit. However, most of the tools on the market assume engineers as the design object, so there are a large number of accessories, jumpers, and joints. This is too complicated for students and they do not know how to address the issue." To solve this problem, Arduino came into being in 2005. Now, as a company making computer hardware and software, Arduino designs and manufactures single-board microcontrollers and microcontroller kits. Moreover, the original codes of the hardware and software are freely available to build digital devices and interactive objects so as to sense and control objects in the physical and digital worlds. Three pieces of literature on hardware and software devices developed on the Arduino system to meet our design purposes will be discussed in the following: A. Air quality system with Raspberry Pi and Arduino used for the implementation. (13) A data computing and processing platform with Raspberry Pi and Arduino is proposed and an air quality sensing system is formed together with sensors. This system mainly covers five modules, i.e., a Raspberry Pi 3 module, an Arduino Uno rev3 module, a dust sensor module, a temperature and humidity sensor module, and a gas sensor. In this paper, factors affecting thermal comfort and air quality are input to the sensors and processed, and then the relevant control is output. B. Wi-Fi remote control of home appliances by Arduino. (14) Arduino and Wi-Fi are applied to remotely control the switching of home appliances. In this paper, Arduino is mainly utilized to control machine switching. C. Study on maintaining home temperature with temperature-sensing technology. (15) Arduino technologies used to develop a temperature-sensing and app phone warning system are integrated to realize a room-temperature warning system for households of elderly people.

Software and hardware used in this study
The following sensing elements are used in this study. A. Arduino Different microprocessors and controllers are used in Arduino circuit boards. Such boards are provided with series of digital and analog input/output pins to connect various expansion boards, sensors, and other controllable elements. These boards have serial ports, including some general serial buses, and programs can also be loaded from a personal computer. Usually C/C++ programming language is used by the microcontroller for compiling.
In addition to its use as a traditional compiling tool, Arduino also provides an integrated development environment, Arduino Integrated Develop Environment (IDE), based on a processing language project (Fig. 2). B. Temperature and humidity sensor module The DHT-22 temperature and humidity sensor module used in this study is shown in Fig. 3. It is used for general temperature and humidity detection devices. C. Dust sensor module The dust sensor module used in this study is a Sharp GP2Y1014AU0F optical dust sensor (Fig. 4), which is an optical air quality sensor designed to sense dust particles in the air. An infrared light-emitting diode (LED) and a phototransistor are installed diagonally inside so that it can detect light reflected by dust in the air. It can mainly detect tiny particles larger than 0.8 μm and is particularly sensitive to smoke, smog, and pollen, so this sensor is often used in air purifier systems.

D. Noxious gas sensor module
The MQ135 sensor (Fig. 5) is highly sensitive to ammonia gas, sulfide, and benzene series steam. It is also suitable for monitoring smog and many other noxious gases. This low-cost sensor is applicable to many fields.

Smart controllable mechanism used in this study
In a smart building, various kinds of sensing elements are applied to measure indicator values in the living environment, and a control board and software are employed to turn on the controllable mechanism so as to respond to warnings and modify the physical indicator values and create a safe, comfortable, and pleasant living environment. The elements and facilities used to control the hardware environment and issue warnings in this study include the following. A. Electric window opener An electric window opener (Fig. 6) starts to open the window to exchange air when the system detects that the outdoor air temperature is too low or the noxious gas concentration is too high. B. Electric sun shield An electric sun shield will be switched on when the system detects a rapid temperature increase of the outdoor air to block the sun horizontally and reduce the increase in air temperature at the window inlet (Fig. 7). C. Air conditioner and electric fan When the above two physical air exchange and temperature reduction methods cannot satisfy the indoor comfort requirements, equipment will be turned on to reduce the temperature. An air conditioner rapidly reduces the indoor temperature through refrigerant heat exchange, whereas an electric fan is designed to increase the circulation of indoor air. Working together, they can improve the cooling efficiency of the air conditioning equipment and improve the indoor comfort.

D. Dehumidifier
When the indoor air humidity or the temperature is too high, the humidity can be reduced by a dehumidifier to improve the indoor comfort. E. Air purifier When the indoor air quality is poor, in addition to opening the window for air exchange, an air purifier can be turned on to filter the pollutants. It captures 99.9% of allergens and germs and effectively removes undesirable odors from the air. F. "If this then that" (IFTTT) IFTTT, (16) an automatic network connection service platform, decides whether to execute the next command depending on the conditions of different platforms. IFTTT is a condition trigger based on the task and is similar to a programing language, i.e., if XXX performs YYY, then execute ZZZ. Each website that can be triggered or considered as a task is called a channel, and the trigger condition is called the trigger. Then, the executed task is called an action, and the set of processes combining all the above is called a task. G. Line communication system The convenient connection of networks and groups via Line (17) communication has become very popular worldwide in recent years. This communication platform can be used to transmit words, pictures, and movies, as well as for communication between members of a group, resulting in a tool widely applicable to group interchange, communication, and management. An IFTTT platform is used in this study to compile information measured by sensing elements of the smart building to be transmitted in a timely manner to relevant Line users/groups.

H. Blynk control interface
To give Arduino a better network control platform, many companies (Particle, ThingSpeak, Temboo, IFTTT, and App Inventor 2) have provided software interface services. Blynk (18) is a user-friendly operational monitoring platform and is also compliant with open-source MIT licenses.
Blynk is a platform for iOS and Android applications that control the hardware of microcontrollers or microprocessors such as Arduino, Raspberry Pi, and ESP8266. It is a digital dashboard that allows users to quickly build new platforms for controlling and monitoring hardware. Graphical interfaces for projects can be constructed using simple drag-and-drop buttons, control bars, charts, and other tools. Using these tools, one can switch the hardware pins or view the data from a sensor.  I. Cloud data module To make the control system provide a microclimate close to the current environment, the cloud data introduced in this study include weather forecast information from the Central Meteorological Bureau of the Ministry of Communications, (19) the weather history information of the area, and the air quality monitoring network, such as timely PM2.5, PM10, and air quality indices, from the Environmental Protection Department of Executive Yuan. (20) At present, meteorological information and air quality data are stored on an open platform of meteorological data and an open platform of environmental resource data, respectively. These platforms aggregate the sensory data collected by each weather station and provide the information to the public to improve the efficiency of environmental resource utilization and implement environmental information sharing.
The open format of the data is diverse, and the common data exchange formats are CVS, XML, and JSON. After the data are collected, the system developer directly extracts the data from the original machine to the developer's machine and then uses an added value application. The data format captured in this study from the Internet is based on JSON (JavaScript Object Notation), which is a lightweight data exchange format. It uses JavaScript's object syntax, which is based on text that is easy to read. It is used to transfer data objects consisting of attribute values or serial values. J. Google Cloud hard drive When the sensing component needs to be further used after detecting environmental information, it must upload and store data to the cloud through the network module. The environmental data read by the sensor are written into a Google spreadsheet in Google Cloud Drive via a JavaScript-based Google Apps Script (21) and accessed via an HTTPS GET/POST request.

Results
The structure of the environmental control system for a smart household established in this study is shown in Fig. 8.
In this study, the structure of the environmental control system for a smart household is proposed and the system is developed. IoT and ICT technologies are integrated to construct the system. A temperature and humidity sensor, dust sensor, and noxious gas sensor are used to detect the environmental status. Controllable devices such as the electric window opener, sun shield, air conditioning, electric fan, dehumidifier, and air cleaner are used to improve the living physical environment. When the physical conditions are adjusted to the desired values, the system stops the operation of the relevant controllable devices. Through the connection of relevant sensing elements, the control board, and the controlled facilities; the development of management software and the app operation interface (Fig. 9); and message notification transmission via Line in real time, a monitoring mechanism for the overall comfort of the household environment is provided.
After wiring and testing the control board, the sensor, and the control mechanism, when the monitoring value of the sensor is too high, it means that the air quality is poor and physical window opening is executed to exchange the air. When the outdoor air condition or the air exchange is poor, the air cleaner is started to clean the air.
When the indoor temperature exceeds 26 ℃, if the outdoor temperature is low, the electric window opener is first operated (Fig. 10) to introduce outdoor air. When the outdoor temperature keeps increasing, then the electric sun shield is activated to reduce the temperature at the inlet window (Fig. 11). When the overall temperature reduction is insufficient, the electric fan can be turned on to increase the airflow, or the dehumidifier can be started to remove the excess moisture (Fig. 12). When the resulting temperature reduction is still insufficient, the      air conditioning equipment can be turned on to reduce the temperature rapidly (Fig. 13). The effect of such environment monitoring can be known and controlled via the app, and the current environment state can also be known from a Line message (Fig. 14).

Discussion and Conclusions
Since the value provided by the MQ-135 sensor is not a ppm value, it must be calculated by a mathematical formula. Moreover, MQ-135 is not a special CO 2 detection sensor and is designed for a general noxious gas sensor module (10-1000 ppm ammonia, benzene, and alcohol), so its accuracy may be doubted when the value is used directly. However, the special CO 2 detection sensor does not have a state-fixed price and is expensive, increasing the cost of such systems in their early development.
We focus on building a system for providing comfort in indoor spaces with a low unit price, real-time monitoring, and control for smart buildings. Microclimate information of the environment is read from the front-end sensor, the information is transmitted to the cloud end by Arduino, the current state of the environment is displayed on the app and Line, and the home appliances are controlled by a remote controller.
Comparing this study with Ref. 13 (A in Sect. 2.4), we see that both studies concern an air quality sensing module composed of sensors. However, only arithmetic operations were performed on the sensed values in Ref. 13, whereas a judgment is made on these values in this study, which is used to control back-end home appliances to achieve the goal of a system providing a comfortable indoor space.
Comparing this study with Ref. 14 (B in Sect. 2.4), we see that both studies use Arduino and a Wi-Fi environment to remotely open and close power outlets to control home appliance switches. However, in addition to using Wi-Fi to control home appliance power switches, here we also use infrared remote control to activate and deactivate appliances.
Finally, comparing this study with Ref. 15 (C in Sect. 2.4), we see that both studies employ temperature sensing in combination with an app to provide a mobile phone warning system. Since the target users of the previous study were elderly people, there was an actual test involving them. We have also incorporated an instant notification system of the commonly used Line to inform users of the latest environmental conditions.
Possible future research directions include the incorporation of the meteorological forecast of the Central Weather Bureau and the PM2.5 air quality data of the Environmental Protection Agency into our system. Integrating such external information with the data measured by the sensors is expected to result in a more precise and intelligent home environment control system.