# Smart Tags: IoT Sensors for Monitoring the Micro-Climate of Cultural Heritage Monuments
## 2 System Architecture and Design
### Functionalities and Firmware Integration  
In order to satisfy the extracted system requirements, the functionalities of the smart tag was formed and integrated into the firmware of the device. The functionalities provided from the sensors are presented in Table 2. Furthermore, the process flow diagram of the smart tags' operation during a day is outlined in Figure 2. \begin{table}
\begin{tabular}{l l} \hline \hline Functionality & Description \\ \hline Temperature and humidity measurements and dew point calculation & Record on a frequent basis (every 30 min) the air temperature and humidity and calculate the dew point temperature in the vicinity of the building walls. \\ \hline Dry/Wet condition & Record on a frequent basis (every 30 min) the dry/wet condition of wall surfaces. \\ Data storage formatting and forwarding & Forward the measured data to the middle-ware on a daily basis, providing a daily time series of the data in JSON format. \\ \hline Edge processing capabilities & Provide edge processing capabilities to push notifications to the middle-ware when the collected measurements are outside predefined, pilot-specific thresholds. \\ \hline Multiple network options & Smart Tag support multiple networks and communication protocols : WiFi, Bluetooth and LPWAN networks, such as NB-IoT. \\ \hline Low-power mode & Micro-controller operates on a low-power mode (deep sleep) most of the time to reduce power consumption to some \(\upmu\)A and wake up only to measure or publish data. \\ \hline Power management capability & The smart tag is powered by a rechargeable battery and a solar panel to ensure that they will meet the requirements for autonomy and long operational life. External power source via micro-USB is also possible. \\ \hline Power monitoring capability & The device monitors the battery power level in percent (0–100\%) and set up an alert when it is low. \\ WiFi access point capability for configuration & The smart tag can enter into a WiFi access point for the configuration of its WiFi connection. \\ \hline Over the Air Programming & Automatic and contact less programming and firmware updating via WiFi connection. \\ \hline \end{tabular}
\end{table} 
Table 2: The functionalities provided by the smart tags. Figure 1: System Architecture. As it is presented in the process flow diagram, first, the connected sensors to the micro-controller unit (MCU) are initialized. Then, measurements of the air temperature and humidity are acquired and stored in the flash memory using the SPI Flash Filing System (SPIFFS). The maximum size of the data that can be stored is up to 1.5 MBytes. Next, the dew point is calculated, and the dry/wet condition is determined based on the resistance of the dew point sensor. These data are also stored on the flash memory. When all the new environmental data have been stored, the MCU goes into deep sleep mode for 30 min to achieve very low power consumption. During the deep sleep mode, the CPU and all the digital peripherals, including the WiFi and Bluetooth module, are shut down, and only the ULP co-processor and RTC memory and peripherals are powered on. In correspondence with the process flow diagram, after 30 min, the MCU wakes up from deep sleep and repeats the process of taking new measurements and storing them. When 24 h have passed, the stored data are formatted into a JSON file. The IDs of the smart tag and the building that it is deployed are added to the JSON, as well as the battery power level (0-100%) at the current time, provided by the battery monitor circuit. The MCU establishes a network connection and publishes the JSON file to the middle-ware via the MQTT protocol [12]. Once the data are published successfully, the flash memory with the stored data is cleared, and the chip goes into deep sleep again for the next 30 min. The smart tags support multiple networks and communication protocols, making them able to surpass some network restrictions that are evident in the pilot sites.