## 3 UV Exposure Amount Calculation Algorithm  
In this paper, a function was developed to provide the necessary UV dose through the indoor UVB LED lighting based on the UV exposure amount by sunlight in order to support the optimal daily UV dose required by the user. The UV exposure amount calculation algorithm calculates the optimal UVB dose necessary for a day according to the characteristics of an individual, such as the age and skin type of the user, performs smartphone-based BLE scanning, and then searches UVB LED lighting to judge whether a user is indoors or outdoors at present. Outdoors, the lighting system judges if the UV dose is optimal to the individual according to the cumulative EUV by exposure to the sunlight. Indoors, if it judges that the UV exposure amount of a subject is short while outdoors, the irradiation time by indoor UVB lighting is calculated to meet the daily UV dose by individual, and then the appropriate UVB dose is provided. Figure 6 shows the flow chart of the UV exposure amount calculation algorithm. Figure 5: Mobile App on Notice: (**a**) outdoor; (**b**) indoor; (**c**) indoor, vitamin D sufficient; (**d**) when erytmal UV dose exceeds minimum erytmal UV dose. Figure 6: UVB LED general lighting and block diagram of UVB LED general lighting. In the UV exposure amount calculation algorithm, firstly, the daily Recommended Vitamin D UV Dose (_RVUID_) required for the users was calculated. For that, Equation (3) was derived to calculate _RVUID_ using the calculation in Equation (2) of the estimated vitamin D synthesis amount (_VitD_) proposed in the study by [PERSON]. In Equation (2), the _STF_ is the skin type factor. In the case of skin type II, the STF is 3.2/3, for skin type III, it is 3.2/4, for skin type IV, it is 3.2/5.25, and for skin type V, it is 3.2/7.5 [23]. _PBE_ is the percentage of body exposure upon referring to the Lund and Browder chart and differs according to the season and user's age [23,24]. _AF_ is the age factor and has a value of 1.0 for the user aged lower than 21 years old, 0.83 for the user older than 22 and younger than 40, 0.66 for the user older than 41 and younger than 59, and 0.49 for the user older than 60 [25]. Lastly, _SPF_ is the sun protection factor which equals 1 if sunscreen is not used. \[VitD\ [\text{IU}]=49\ VUD[\text{J}/\text{m}^{2}]\frac{STF\cdot PBE\cdot AF}{SPF}, \tag{2}\]  
\[RVUID[\text{J}/\text{m}^{2}]=\frac{1}{49}RVA\ [\text{IU}]\frac{SPF}{STF\cdot PBE \cdot AF}. \tag{3}\]  
In order to calculate _RVUID_ by individual in Equation (3), information of the daily individual recommended vitamin D amount (_RVA_) is needed and is differentially applied according to the user's age. In this paper, the daily recommended vitamin D intake standard suggested by the Korean Ministry of Health and Welfare (KMOHW) is applied [26] and _RVA_ by each user as 200 IU under 11 years old, 400 IU for under 11 years old and 65 years old, and 600 IU for over 65 years old. After calculating the _RVUID_, the cumulative UV dose was calculated by exposure to the sunlight in case the user is outdoors after judging the current location of the user. The status of satisfaction for the _RVUID_ was informed to the user. Erythermal UV outdoor (_EUVout_) was calculated from Equation (1), and Erythermal UV Dose (_EUD_) was calculated by accumulating _EUVout_ per second. In addition, Vitamin D producing UV radiation (Vitamin D UV Dose, _VUD_) was calculated by accumulating Vitamin D UV irradiance outdoors (_DUVout_) over time. The equation to obtain _VUD_ is as shown in Equation (4). \[ \begin{array}{l}VID=\int_{0}^{t_{c}}DUV(t)\ dt,\\ \cong\sum\limits_{t=0}^{t_{c}}DUV(t)\cdot\Delta t=\sum\limits_{t=0}^{t_{c}}DUV.\end{array}  \tag{4}\]  
Equation (4) was used to obtain _VUD_ from the moment of measuring _EUV_ until current time \(t_{c}\). Here, \(\Delta t\) is for 1 s, the _EUV_ was measured every second with the IoT UV measurement device, and the _VUD_ could be calculated by Equation (4) using the numerical integration method. _DUVout_ was measured using Equation (5).