# Optimizing Ambiance: Intelligent RGB Lighting Control in Structures Using Fuzzy Logic
## 4 Results  
### System Design and Operating Parameters  
Temperature, relative humidity, acoustic pressure, and UV radiation are the determining factors of the system as they directly impact people's emotional reactions and behavioral tendencies [42].  
The NODEMCU development board operates at a voltage of 3.3 volts and has only one ADC channel. Considering these parameters, sensors with digital communication capability are preferred to optimize ADC conversion, the final design can be seen in the Figure 7. Another crucial consideration is determining the sensors' response speed according to the LPT times, which have a reaction time of 100 ms to control a condition or disturbance of the measured environmental variables. Therefore, it was decided that the temperature sensor used should have digital connectivity. Thus, a sensor based on the I2C protocol was selected [43].  
The AM2315C sensor is used to measure temperature and relative humidity. It includes a small microprocessor responsible for converting the signals from the internal thermistor and capacitive humidity sensor into calibrated digital form [44]. Among others, the sensor is suitable for outdoor use, with an I2C address of 0 \(\times\) 38, and the following specifications: Power supply: 2.5 to 5.5 V, consumption: up to 10 mA, humidity accuracy: 2% from 0% to 100%, temperature range: -40 \({}^{\circ}\)C to 80 \({}^{\circ}\)C with an accuracy of \(\pm\)0.1 \({}^{\circ}\)C, and sampling frequency: 0.5 Hz.  
Figure 6: Lighting control based on AIoT technology.  
The MAX9814 acoustic pressure sensor is capable of measuring frequencies in the audible spectrum between 20 and 20 kHz. It has a peak voltage of 2 Vpp with a bias of 1.25 V and is compatible with an ADC up to 3.3 V. Due to the sensor's analog response, the Nyquist-Shannon sampling theorem is implemented in the code; in this case, the ADC component of the NodeMCU has sufficient speed to read the values [45].  
UV radiation was measured using the S12 SD ultraviolet light sensor, which can measure wavelengths between 240 and 370 nm. It can fully measure UVB wavelengths and most UVA wavelengths directly and proportionally without the need for converting or adapting a light sensor or photocell [46]. Powered between 2.7 and 5.5 V, the test socket response is calculated as \(IndUV=ADCvoltage/0.1v\) to determine the UV index measurement. This sensor is capable of detecting power levels of around 9 mW/cm\({}^{2}\).  
Two criteria must be met for connecting analog and digital sensors to the system. Analog sensors require an ADC input, and since the NodeMCU has only one channel, the analog inputs must be multiplexed. This involves switching the signal with a 2-to-1 multiplexer (74 HC4053D) acting as a relay and obtaining the output samples to the NodeMCU's ADC [47].  
UV measurements are obtained through input 0, with a very low rate of variation requiring a sample every 5 s for this variable. Input 1 is dedicated to acoustic power measurements, requiring a higher sampling speed to analyze signals in the audible spectrum, considering a maximum signal frequency of 25 kHz. Measurements are taken at a sampling frequency of 50 kHz [48].  
Temperature and relative humidity measurements are transmitted in a single frame from the sensor to the microprocessor via I2C, using the sensor's 7-bit address (0 \(\times\) 38). In this frame, temperature data are represented by 12 bits and relative humidity data by 8 bits.  
Power transistors are used to generate the PWM signal for each output, providing 8 bits of control (0-255). This output allows modulation of the intensity of each color output in the RGB [49].  
The tape used has a total power of 10 W. With a minimum activation power of 20% and a range of (50-255), the intensity control signal allows for modulation of the lighting intensity for all color outputs [50]. The output power device can be adjusted to accommodate any type of AC or DC load source without affecting its behavior, for higher or lower power systems depending on the area to be illuminated [51].