## 3 Materials and Methods
### Monitoring Device Architecture: Embedded Application  
The embedded application runs in ESP32. Concerning the monitored parameters, as previously mentioned, the device uses a light-dependent resistor (LDR) to determine illuminance changes. The resistance of the LDR decreases as the illuminance increases. The ESP32 analog input pin converts the voltage (between 0 and 3.3 V) into an integer value between 0 and 4095. The embedded application classifies values as follows: less than 40--dark\" (level 1); 40 to 799--\"dim\" (level 2); 799 to 1999--\"light\" (level 3); 2000 to 3199--\"bright\" (level 4); greater than 3200--\"very bright\" (level 5) [31; 36; 37]. This approach is useful because in various activities, such as those related to civil construction, building maintenance, and agriculture, minimum illuminance is required, but at the same time, workers are often exposed to abrupt variations in illuminance that can lead to accidents, such as because of \"temporary blindness\", for example. There is little literature exploring these variations in illuminance that occur when workers move between indoor and outdoor environments several times during the work shift due to the characteristics of professional activities [38]. The illuminance level is not considered to generate alarms. Instead, it will be used by the machine learning model to be developed and will run in the server to identify abrupt changes in illuminance and generate alerts and suggestions to employers. This information may be considered, for example, for reorganizing the flow of workers' activities. Regarding temperature, in heat stress assessments, it is recommended to estimate the metabolic rate with or without exposure to solar radiation and according to the intensity of the activity performed [39]. This is an important factor both in outdoor activities (e.g., agriculture or construction) and indoor activities (e.g., industry sectors using furnaces or freezing chambers). To perform measurements with this standard requires expensive hardware. Because of this limitation, it was decided to consider temperatures lower than 10 \({}^{\circ}\)C and greater than 30 \({}^{\circ}\)C as limits to trigger the alarm [40]. This alarm does not indicate non-compliance with standards but recommends attention be paid by workers to drink water and dress appropriately, for example. If the air's relative humidity is under 50% or above 70%, the same alarm is triggered. The limits for dust, noise, UV radiation, and flammable gases were set by [41; 42; 43; 44]. Measurements are carried out every ten minutes, except for the concentration of flammable gases, which is checked every minute. If the total concentration exceeds the limit, the blue LED turns on to indicate that the worker must leave the location. As with most gas sensors, MQ-2 detects multiple gases but cannot identify them. The description of the monitored parameters, their limits, and alarms are presented in Table 1.  
Monitoring devices communicate with the server through the Internet. For this purpose, it uses message queuing telemetry transport (MQTT) through Wi-Fi. The MQTT protocol was chosen because it is widely used, with very good documentation. Furthermore, there are several free implementations of this protocol ready to use. MQTT is a messaging