<<

applied sciences

Article Smartphones as a Light Measurement Tool: Case of Study

Jose-Maria Gutierrez-Martinez, Ana Castillo-Martinez *, Jose-Amelio Medina-Merodio, Juan Aguado-Delgado and Jose-Javier Martinez-Herraiz Department of Computer Sciences, Polytechnic School, University of Alcala, 28871 Alcalá de Henares, Spain; [email protected] (J.-M.G.-M.); [email protected] (J.-A.M.-M.); j.aguado @edu.uah.es (J.A.-D.); [email protected] (J.-J.M.-H.) * Correspondence: [email protected]; Tel.: +34-918856650

Academic Editor: Christos Bouras Received: 25 April 2017; Accepted: 7 June 2017; Published: 14 June 2017

Abstract: In recent years, smartphones have become the main computing tool for most of the population, making them an ideal tool in many areas. Most of these smartphones are equipped with cutting-edge hardware on their digital , sensors and processors. For this reason, this paper discusses the possibility of using smartphones as an accessible and accurate tool, focusing on the measurement of light, which is an element that has a high impact on human behavior, which promotes conformance and safety, or alters human physiology when it is inappropriate. To carry out this study, three different ways to measure light through smartphones have been checked: the ambient light sensor, the digital and an external Bluetooth luxmeter connected with the smartphone. As a result, the accuracy of these methods has been compared to check if they can be used as accurate measurement tools.

Keywords: Luxmeter; mobile ambient light sensor; ; light sensing

1. Introduction Advances in mobile technology has led to its use in different environments such as intelligent transportation, resource management and usability, environmental monitoring, city management and social services. These advances include computing power enhancement and new measurement systems and sensors, turning them into the cornerstone for interaction between people and digital systems and services [1,2]. This upswing of smartphones combined with pervasive sensing enable the collection of information about mobile users and their surrounding environments. The new available information enhances the awareness of the cyber, physical, and social environment, which provides essential support to our daily lives, in the form of services, applications, and so on. Most recent smartphones are equipped with cutting-edge hardware on their digital cameras, sensors and processors. These kinds of devices are an ideal tool in many areas such as business, education, health or social life, changing dramatically the cultural norms and behavior of individuals. Smartphones are much cheaper than classic tools that they can replace, even high-end devices. These characteristics have led to today’s mobile devices becoming the primary computing platform for many users [3]. Despite manufacturers and aggressive marketing promotion, there is no doubt that smartphones have great features and capabilities [4]. On the other hand, , both artificial and natural, has a high impact on human behavior, promoting comfort and safety, or altering human physiology when inappropriate. Analyzing working tasks related to the office, it is possible to see how most of them are linked to document processing, be it through paper or digital documents. Therefore, these activities have high visual requirements, making lighting an important factor to prevent discomfort and vision problems. Different studies

Appl. Sci. 2017, 7, 616; doi:10.3390/app7060616 www.mdpi.com/journal/applsci Appl. Sci. 2017, 7, 616 2 of 18 attribute migraine headaches, fatigue, medically defined stress, anxiety or decreases in sexual function, among others, to overly intense light [5–8]. To guarantee proper lighting in workplaces, two standards were developed: UNE 12464-1 [9], which is relative to lighting of indoor workplaces, putting special emphasis on the fulfillment of two aspects: the visual comfort and the performance of colors and standards; the second standard is UNE 12464-2 [10], which is related to the lighting of outdoor workplaces. In both regulations, the lighting requirements are established regarding the activity. To improve lighting management, modern buildings have incorporated intelligent control systems, saving energy and money and significantly contributing to creating a comfortable working environment if possible [6]. Another field in which it is important to control the amount of light is , where factors have a high impact on picture quality. Photographers use different techniques to manipulate individual parts of a photograph, removing shadows and highlighting features, among others [11]. Therefore, it is recommended to measure light intensity to adjust the camera characteristics in order to get the best photograph quality [12]. Something similar happens on a movie set, where the circumstances of the ambient light where the camera is located can make the difference between a great shot and a useless one, always according to the director’s criteria about the purpose of the shot. There are other cases where the quantity of ambient light is key, such as art museums or galleries. It is essential that the intensity and quantity of light in the gallery rooms where the paintings are presented is adequate, to ensure the correct visualization and to guarantee an optimal state of conservation [13]. Lighting also has a great impact on enclaves that shelter living beings, such as zoological or oceanographic ones, where inadequate lighting levels could produce adverse conditions that could alter these said living beings [14] and even cause problems with their growth [15]. To measure the amount of light and its quality, a luxmeter is used, a specialized device that measures the intensity of light that impacts a surface. These two lines of reasoning join together if we exploit the advances in smartphones and their processing power and network connectivity [16], to use them as a fairly accurate tool to measure the light through a software development, making this functionality available to any smartphone user. To achieve this goal, the authors ran a study to analyze three different approaches, creating the software, testing it and analyzing the results. The rest of this paper is divided as follows: Section2 presents the prior research where different aspects that have been of relevant to the work are studied; Section3 describes the methodology and the hypothesis that serves as a base for the research; Section4 presents an analysis of the main elements that have been studied; Section5 shows the results obtained through the study and the validation of the hypothesis, and, finally, Section6 contains the conclusions.

2. Prior Research As a first step, it is necessary to review the different options available to measure light amounts and existing research in this field. The key concept to guiding this search is the need for an accurate and quantifiable measurement of light needed to create appropriate and pleasant working spaces, it being necessary in some cases to adapt the environment to the requirements to carry out different types of tasks. As a result of this search, we concluded that light analysis can be performed in two different ways: either virtual scenarios can be created using evaluation software, where we will take lighting information directly from the manufacturers; or real measurements can be taken in real scenarios, where we will use real situations and we will take measurements using different tools. The advantages of a virtual scenario are that you can get a fairly accurate light analysis to work easily and quickly, without any physical deployment and measures. On the other hand, the results will never be as accurate as in real scenarios, as quite a few factors will be omitted. Real scenarios will always be Appl. Sci. 2017, 7, 616 3 of 18 accurate, although more difficult to achieve and with some limitations when performing measurements, and hardware quality will always be essential.

2.1. Light Evaluation Software Programs used to evaluate lighting requirements in different spaces enable a quantitative analysis of scenarios thanks to its capability of creating a 3D virtual world where lighting effects are recreated and analyzed in both artificial lighting and daylighting scenes [17]. In this field, the most important software is called DIALux (DIALux evo 7, Dial, Lüdenscheid, Germany). The main strength of this software is the complete database about lighting products of the main manufacturers, giving more accuracy to the analysis. It also provides information about power consumption of elements to guarantee compliance with the regulations [18]. Similarly, the software called RELUX (version 2017.1.9.0, Relux Informatik AG, Münchenstein, Switzerland) allows us to generate quantitative and qualitative analysis of buildings’ lighting thanks to simulation models created with specific materials; colors; reflection factors; natural and artificial lighting elements in order to get a closer possible view of reality [19]. Another renowned and well-known tool to evaluate energy efficiency is the SEAD (Super-efficient Equipment and Appliance Deployment) Street lighting evaluation toolkit. This tool can help to make better choices regarding street lighting fixtures, which can lead to a maximum of 50% in energy savings [20], by providing an easy way of performing evaluations of light quality, energy consumption, and life cycle costs of efficient street lighting alternatives. This tool is supported by Mexico’s National Commission for Energy Efficiency, India’s Bureau of Energy Efficiency, Natural Resources Canada, the Swedish Energy Agency and the U.S. Department of Energy. Finally, the program BTwin (versión 2.9.5.8, IMventa Ingenieros, Campanillas, Spain) [21] was designed to plan the street lighting installation based on the standard EN 12464-2 [10], as the program can import the manufacturer’s information to give more accuracy to the calculations. In addition, an evaluation of the installation’s energy efficiency to obtain the energy label before carrying out its implementation can be performed by using the extended feature called AEwin. Vertical obstacles can be considered as well, as they can affect the lighting, and, by doing so, it is possible to increase the precision of the program.

2.2. Light Measurement Analysis The most commonly used device for measuring light conditions is the luxmeter, a device that allows for simple measurements quickly and not the subjective illuminance of an environment. This device is composed by an integrating light meter with a circuit that develops a signal representing the logarithm of the light being measured and utilizes a display having a linear f-number scale [22]. These devices are too specialized to be available in many situations where light conditions should be measured. For this reason, some researchers have used CCD (Charge-Coupled Device) cameras to obtain luminance [23,24], glare and illuminance measurements [25]. The utilization of CCD as a luminance meter in order to calculate visibility level has big advantages because it reduces the time required for the measurements. However, there are still limitations concerning the reliability on low levels [26]. In addition, to obtain the illuminance level using this kind of camera, a computer, connections between the computer and the light meter and finally software to collect, store and analyze data are necessary. Due to its high-precision resolution, these cameras are very expensive and are not commercially viable for many image-resolving measuring tasks. To solve this problem, the research conducted by Wuller [27] analyzed the possibility to measure luminance with digital still cameras (DSC). The main advantage of this kind of camera is that it can capture the luminance of an entire scene. Despite this research showing that it is possible to obtain luminance value with a digital camera, the quality of the device used is very important to the accuracy of the values. In this respect, the results show how professional cameras are more qualified for use as a luminance measure camera owing to its high color rendering. Appl. Sci. 2017, 7, 616 4 of 18

Similar principles used by Wuller in the use of digital still cameras are applied to the research carried out by Ismail et al. [12]. This study shows how it is possible to design a webcam based luxmeter that is applicable and suitable for lighting monitoring as well as the ability to be used in an embedded application. The research carried out by Sumriddetchkajorn and Somboonkaew [28], which shows how it is possible to evaluate the illuminance directly to the image obtained by the digital camera of a mobile phone, follows similar criteria. However, another research study that analyzes different mobile applications for different platforms such as Android, iOS and Windows phones, that ensure that they can measure the light directly with the mobile, shows how a serious measurement of illuminance is only possible with professional hardware. This is due to the error found in the measurement compared with a professional luxmeter being very high, and the fact that each mobile phone has different measurement values because of its hardware characteristics.

3. Methodology To guide this study, a set of hypotheses was proposed to help in the evaluation of the different sensors studied and the subsequent presentation of results. These are the hypotheses:

• H1: The ambient light sensor present in mobile devices provide enough quality to be used as a measurement tool. • H2: The digital camera of mobile devices can be used as a lighting measuring tool. • H3: The use of external sensors connected to the mobile device through via Wi-Fi or Bluetooth provides measurements with a quality similar to that obtained by the internal mobile sensors. • H4: Mobile devices can be used by any smartphone user as a fairly accurate light meter tool.

As part of the research, a series of tests were performed with mobile devices where the measures were taken with dimmable lighting situations. The results of these measurements have been compared with others performed in the same situations by a calibrated luxmeter, which has been considered as a reference measurement. Finally, if the hypotheses are all valid, we have to consider the possibility of using the mobile sensors as a replacement of the external devices.

4. Analysis of Sensors in Mobile Devices Over the last few years, smartphones, such as Android products or iPhones, among others, have prevailed as sophisticated multi-function mobile phones. In the case of the Android platform, it provides four different sensors that let users monitor several environmental properties such as humidity, illuminance, ambient pressure and ambient temperature. These sensors are hardware-based and are not available in all of the products due to the fact that their presence depends on the decision of the manufacturer, as happens with other features such as the frontal camera. For this reason, the light measurement performed in this study has been performed in different ways in order to give the option that best fits with each terminal.

4.1. Mobile Ambient Light Sensor Nowadays, most smartphones have a built-in ambient light sensor that is employed to provide information about the intensity of the surrounding illumination. This information is commonly used to adapt screen brightness control based on the surroundings, allowing for saving battery from the screen and at the same time optimizing the visibility [29]. For instance, in outside places where the ambient light is high, screen brightness must be increased to ensure that the device remains readable, whereas, in dark places, the screen is dimmed to reduce eye fatigue [30]. This sensor is usually located on the surface above the screen and may be used for different purposes. For example, it is broadly used in the field of physics, where during teaching practices students are able to use their own smartphone as a light sensor, increasing the interest and motivation in the execution of experiments. Appl. Sci. 2017, 7, 616 5 of 18

Smartphones’ light sensors can obtain accurate readings despite using an easily obtainable technology, but, theoretically, they cannot compare with the accuracy of dedicated hardware devices [29]. One of the main problems of these sensors is that they are located inside the device, allowing for measuring only the light that falls directly on the device, not the ambient light. However, the results obtained in different research studies show how they can be useful in practical cases, as in the undergraduate physics laboratory [31], where a high level of accuracy is not needed. Some operating systems, like Android OS, allows the user to obtain the values from the light sensor through APIs (Application Programming Interface) that collect data during the runtime of the application. These APIs allow applications to register listeners that are notified about changes in sensor values, returning a single value for each data event [32], whereas most motion and static sensors will return a multidimensional array of values. Furthermore, the ambient-light sensor can be accessed without any specific permission, which allows malicious applications to access this sensor information without raising any suspicion. Regarding the period of the measurements, the experiment performed by Spreitzer [30] shows how, in a 10 s period, it was observed that about 750 measurement samples can be gathered per second. This experiment also highlights how these sorts of sensors has a resolution of 1 .

4.2. Mobile Camera Since most smartphones are equipped with digital cameras, the functionality of this tool has been extended beyond taking pictures. Nowadays, these devices are used in areas such as telemedicine [33], microscopy [34], biology [35] or fluorescent imaging [36], among others. For instance, if we pay attention to the field of photography, it is possible to see some relationships between photographs and illuminance factors. Nowadays, it is normal to see photographers measuring light characteristics with external luxmeters to adjust their and depth of field to get best picture quality [12]. This relationship is present in the photographs’ characteristics to the point that it is possible to measure the illuminance through the camera values at the time of taking a picture, as well as the characteristics of the colors of the picture taken. Thus, by using the camera and photographs characteristics, it is possible to calculate the luminance of the scene. For this purpose, an Android application that is able to obtain the luminance of a picture has been developed. This application allows for obtaining the picture directly from the gallery or from the digital camera. Once the image to process has been acquired, the next step is to process the image to evaluate it. The first stage for performing this task of evaluating the luminance of a picture consists of adapting the spectral luminous efficiency of the human eye for photopic vision through the CIE XYZ (Commission Internationale de l'Éclairage) and (λ) curve. Hence, this value is able to make a direct statement about the luminance of colors [27]. It is possible to evaluate the individual luminance of the tints through the main color wheel palette with constant saturation and lightness levels converted to grayscale. As in a photograph, the images obtained are in RGB (Red Green Blue) colors, and they must be converted into greyscale images to ease the computational burden using the formula of a weighted sum of Red, Green and Blue components, as is shown in Equation (1) [37,38]:

Luminance = (0.299 × R + 0.587 × G + 0.114 × B). (1)

This way, the three dimensions of color can be translated into one, where white is represented with the highest value, and black with the lowest. Figure1 shows a chart with the process done by the application to obtain the luminance of a scenario. Appl. Sci. 2017, 7, 616 6 of 18 Appl. Sci. 2017, 7, 616 6 of 18 Appl. Sci. 2017, 7, 616 6 of 18

Figure 1. Flow chart of mobile application to obta obtainin luminance through the digital camera. Figure 1. Flow chart of mobile application to obtain luminance through the digital camera. One of the main drawbacks detected while measuring the illuminance on a concrete surface with One of the main drawbacks detected while measuring the illuminance on a concrete surface with a digital camera is that the illuminance measured will take into account the distance of the device a digitaldigital cameracamera is is that that the the illuminance illuminance measured measured will w takeill take into into account account the distancethe distance of the of device the device from from the surface where the measure is taken. To solve this problem, it is necessary to use a sort of thefrom surface the surface where where the measure the measure is taken. is Totaken. solve To this solv problem,e this problem, it is necessary it is necessary to use a sort to ofuse filter a sort close of filter close to the device to ensure that the measurement is performed at this point. To perform the tofilter the close device to tothe ensure device that to theensure measurement that the measurement is performed is at performed this point. at To this perform point. the To study, perform a Luxi the study, a Luxi device (Extrasensory Devices, Palo Alto, CA, USA) [39] was used. This device is shown devicestudy, a (Extrasensory Luxi device (Extrasensory Devices, Palo Devices, Alto, CA, Palo USA) Alto, [39 CA,] was USA) used. [39] This was device used. isThis shown device in is Figure shown2. in Figure 2. This device is a diffusion dome attachment for a smartphone’s front-facing camera. Thisin Figure device 2. isThis a diffusion device is dome a diffusion attachment dome forattachment a smartphone’s for a smartphone’s front-facing camera.front-facing camera.

Figure 2. Device used as a light diffusor. Figure 2. Device used as a light diffusor. Another issue detected is the camera parameters, where values as such ISO, shutter speed or F- Another issue detected is the camera parameters, where values as such ISO, shutter speed or F- Stop Anothercan change issue the detected values obtained is the camera in the same parameters, lighting where conditions. values For as that such reason, ISO, shutter and in speedorder orto Stop can change the values obtained in the same lighting conditions. For that reason, and in order to F-Stopevaluate can its change use in thelighting values measurement, obtained in the it is same necessary lighting to conditions.take these pa Forrameters that reason, into andaccount. in order to evaluate its use in lighting measurement, it is necessary to take these parameters into account. evaluate its use in lighting measurement, it is necessary to take these parameters into account. 4.3. External Sensor Device 4.3. External Sensor Device The use of lighting information can be useful for multiple applications. For example, with this The use of lighting information can be useful for multiple applications. For example, with this information,The use it of is lighting possible information to check lighting can be effi usefulciency for or multiplelighting regulation’s applications. accomplishment. For example, withDue information, it is possible to check lighting efficiency or lighting regulation’s accomplishment. Due thisto the information, possibilities it of is possiblecommunication to check that lighting smartphones efficiency offer, or lighting the use regulation’s of external accomplishment.devices that can to the possibilities of communication that smartphones offer, the use of external devices that can Dueinteract to the with possibilities our applications of communication is possible. For that this smartphones reason, an offer, analysis the useof the of externaluse of external devices device that can as interact with our applications is possible. For this reason, an analysis of the use of external device as interactmeasurement with our tool applications was conducted, is possible. which Forcan thisbe used reason, with an the analysis smartphone of the usein real of externaltime. To device perform as measurement tool was conducted, which can be used with the smartphone in real time. To perform measurementthis evaluation, tool an external was conducted, device, called which ‘Alcalux can be used’, a luxmeter with the developed smartphone by inthe real University time. To of perform Alcalá, this evaluation, an external device, called ‘Alcalux’, a luxmeter developed by the University of Alcalá, thishas been evaluation, made. an external device, called ‘Alcalux’, a luxmeter developed by the University of Alcalá, has been made. has beenTo choose made. the best option of communication, and taking into account that the battery life is the To choose the best option of communication, and taking into account that the battery life is the mostTo important choose the factor best for option mobile of communication,users [40], the di andfferent taking possibilities into account of data that transmission the battery life and is the most important factor for mobile users [40], the different possibilities of data transmission and the mostenergy important consumption factor of for each mobile one usershas been [40], thestudied. different On possibilitiesthat aspect, ofthe data best transmission option is Bluetooth and the energy consumption of each one has been studied. On that aspect, the best option is Bluetooth energybecause consumption of its low power of each consumption one has been compared studied. Onwith that other aspect, wireless the best communication option is Bluetooth systems, because such because of its low power consumption compared with other wireless communication systems, such ofas itsWi-Fi, low as power is shown consumption in the study compared carried without by other Perrocci wireless et al. communication [41]. Another important systems, suchaspect as to Wi-Fi, take as Wi-Fi, as is shown in the study carried out by Perrocci et al. [41]. Another important aspect to take into account is that Bluetooth is embedded in nearly all smartphones. into account is that Bluetooth is embedded in nearly all smartphones. Appl. Sci. 2017, 7, 616 7 of 18 asAppl. is Sci. shown 2017, 7 in, 616 the study carried out by Perrocci et al. [41]. Another important aspect to take7 intoof 18 account is that Bluetooth is embedded in nearly all smartphones. In order toto enableenable BluetoothBluetooth inin thethe externalexternal device,device, an embeddedembedded module (RN-42 from Roving networks, Los Gatos, CA, USA [42]) [42]) was chosen because of its simplicity and relative low power consumption (about (about 30 30 mA mA during during the the transmis transmission,sion, 3 mA 3 mA when when it is itconnected is connected and 26 and μA 26 inµ sleepA in sleepmode). mode). The datadata transmission transmission process process simulates simulates a pipe a pi ofpe messages of messages where where the Bluetooth the Bluetooth module receivesmodule datareceives from data the from UART the (UniversalUART (Universal Asynchronous Asynchro Receiver-Transmitter)nous Receiver-Transmitter) of the of microcontroller the microcontroller and transmitsand transmits the information the information through thro theugh wireless the wireless connection. connection. Despite the present present study study only only covering covering illuminanc illuminancee measurement, measurement, the the created created device device is able is able to tocontrol control other other factors factors such such as presence as presence or temperature. or temperature. It is Italso is alsopossible possible to set to the set frequency the frequency of data of dataregistration registration and andto store to store thethe data data in inEEPROM EEPROM (Electrically (Electrically Erasable Erasable Programmable Read-Only Memory) memory.memory. To To avoid avoid storing storing excessive excessive information information in the memory,in the memory, a device hasa device been developedhas been withdeveloped the possibility with the of possibility configuring of theconfiguring automated the measures automated tobe measures taken in to a timebe taken range in between a time range 2 and 65,524between s. 2 and 65,524 s. To developdevelop thisthis measurementmeasurement device, device, different different prototypes prototypes were were built built to to improve improve the the final final result result to achieveto achieve the the objectives objectives of theof the project. project. The The prototypes prototypes developed developed are: are:

1. TheThe first first prototype to be built was focused on measuringmeasuring the illuminance.illuminance. To To do it, an LDR (Light-Dependent(Light-Dependent Resistor) Resistor) was was used used as as a a ligh lightt sensor, sensor, which sends the information to a PIC (Programmable(Programmable Interrupt Interrupt Controller) Controller) microcontr microcontroller,oller, which is responsible for sending the informationinformation to the computercomputer throughthrough a a serial serial cable. cable. In In this this case, case, the the LDR LDR used used was was the the NORPS-12 NORPS- 12model model of Silonexof Silonex (Montreal, (Montreal, Canada) Canada) [43], which[43], which is composed is composed of a CdS of photocella CdS photocell with a spectral with a spectralresponse response similar tosimilar the human to the eye.human eye. 2. TheThe second prototype developeddeveloped hashas incorporated incorporated improvements improvements regarding regarding new new sensors sensors such such as asmovement movement or or temperature, temperature, apart apart from from the the use us ofe the of Bluetooththe Bluetooth connection. connection. Figure Figure3 shows 3 shows this thissecond second prototype. prototype.

Figure 3. Alcalux device—second prototype.

33. TheThe third third prototype prototype developed developed was was the thefinal final device device.. The main The difference main difference regarding regarding the previous the prototypeprevious prototypeis the incorporation is the incorporation of a printed of circuit a printed board circuit that elec boardtrically that connects electrically the electronic connects componentsthe electronic using components conductive using tracks, conductive pads and tracks, other pads features and other etched features on copper etched sheets. on copper This characteristicsheets. This characteristicgives the final gives device the finala professional device a professional appearance appearance compared comparedto the previous to the prototypes.previous prototypes. Furthermore, Furthermore, the light sensor the light was sensor encapsulated was encapsulated with a plastic with acylinder plastic cylinderwith an aperturewith an apertureat the top atto thereduce top up to to reduce 500 times up to the 500 sensibility times the of sensibilitythe lighting of sensor, the lighting incrementing sensor, theincrementing accuracy for the a accuracy normal forrange a normal of measurement range of measurement intended for intended the device. for theThe device. final result The final is a device the size of a cellphone, which is able to read some factors of the real world with high precision and send it to our smartphone. In the case of light, it is possible to perform measurements from 1 to 60,000 lux. Figure 4 shows the final device. Appl. Sci. 2017, 7, 616 8 of 18

result is a device the size of a cellphone, which is able to read some factors of the real world with high precision and send it to our smartphone. In the case of light, it is possible to perform measurements from 1 to 60,000 lux. Figure4 shows the final device. Appl. Sci. 2017, 7, 616 8 of 18

Figure 4. Alcalux sensor board.

An important part of the developed device is the energy source that allows it to be used. From An important part of the developed device is the energy source that allows it to be used. From the the beginning, the aim was to create a low consumption device, setting this consumption on 200 mA beginning, the aim was to create a low consumption device, setting this consumption on 200 mA or or 0.1 W to allow it to operate with as much autonomy as possible. The device may use two different 0.1 W to allow it to operate with as much autonomy as possible. The device may use two different energy sources: energy sources: USB connection. This sort of connection can be used to supply energy to the device by connecting USB connection. This sort of connection can be used to supply energy to the device by connecting it to an appropriate power source. Taking advantage of this, an external battery using 4 batteries of a it to an appropriate power source. Taking advantage of this, an external battery using 4 batteries of a 1.2 V and 2100 mA was made, which takes the role of an autonomous energy source. 1.2 V and 2100 mA was made, which takes the role of an autonomous energy source. Solar panel. It has been done with four small solar panels that give a voltage of 4.8 V to the Solar panel. It has been done with four small solar panels that give a voltage of 4.8 V to the device, device, which is enough to supply the developed device. which is enough to supply the developed device. 5. Results and Hypothesis Validation 5. Results and Hypothesis Validation To validate the hypothesis, a series of tests has been run using different methodologies. To make To validate the hypothesis, a series of tests has been run using different methodologies. To make the validation more adequate, we have tested each measure methodology in order to study the the validation more adequate, we have tested each measure methodology in order to study the accuracy accuracy of each one, so we are able to combine all of them in tables to analyze the results and study of each one, so we are able to combine all of them in tables to analyze the results and study the range the range of error and accuracy. of error and accuracy. There is no doubt that data acquisition conditions are very important to properly evaluate the There is no doubt that data acquisition conditions are very important to properly evaluate the accuracy of the different systems analyzed in the study. To ensure that the information obtained is as accuracy of the different systems analyzed in the study. To ensure that the information obtained is as accurate as possible, all of the measurements have been performed in the same scenario, in a dark accurate as possible, all of the measurements have been performed in the same scenario, in a dark room room with a light bulb and a dimmer. The light source is a 220 W dimmable incandescent light bulb, with a light bulb and a dimmer. The light source is a 220 W dimmable incandescent light bulb, and and it has been connected to a dimmer, which controls the light intensity level as desired. As a it has been connected to a dimmer, which controls the light intensity level as desired. As a reference reference value for the measurements, the authors use a standard luxmeter model PCE-174 (PCE value for the measurements, the authors use a standard luxmeter model PCE-174 (PCE Iberia, Tobarra, Iberia, Tobarra, Spain) [44], which has been previously calibrated. Spain) [44], which has been previously calibrated. The results of tests are presented and analyzed separately in the following sections. The results of tests are presented and analyzed separately in the following sections.

5.1. Mobile Ambient Light Sensor The firstfirst methodologymethodology isis basedbased onon the the ambient ambient light light sensor sensor consisting consisting of of capturing capturing the the amount amount of oflight light directly directly from from the the smartphone’s smartphone’s ambient ambient light light sensor. sensor. To check the accuracy of this sensor, a simple application in Android OS was developed to obtain the level of light registered directly by it. This a applicationpplication was executed in a first first step in an LG Nexus 5 smartphone to obtain the information. When we compared the measured data of the smartphone with the informationinformation obtainedobtained toto thethe referenced referenced luxmeter luxmeter (Figure (Figure5), 5), we we obtained obtained an an absolute absolute error error of of39.08%. 39.08%. As As can can be be appreciated, appreciated, the the accuracy accuracy of of this this value value is is not not high, high,but but itit isis possiblepossible to appreciate that the tendency of the measures is similar to the data obtained from the luxmeter. This is a signal that a process of calibration of the sensor is necessary. The calibration method consists of comparing a reference illumination value with the value displayed on the luxmeter that is to be calibrated. Appl. Sci. 2017, 7, 616 9 of 18 that the tendency of the measures is similar to the data obtained from the luxmeter. This is a signal that a process of calibration of the sensor is necessary. The calibration method consists of comparing a referenceAppl. Sci. illumination 2017, 7, 616 value with the value displayed on the luxmeter that is to be calibrated.9 of 18 Appl. Sci. 2017, 7, 616 9 of 18

800 800 700 700 600 600 500 500 400 400 300 300 Iluminance (lux)

Iluminance (lux) 200 200 100 100 0 0 0 5 10 15 20 25 0 5 10 15 20 25 Measurements Measurements Luxmeter Measured Values Luxmeter Measured Values Figure 5. Ambient light sensor vs. luxmeter accuracy. Figure 5. Ambient light sensor vs. luxmeter accuracy. Figure 5. Ambient light sensor vs. luxmeter accuracy. To ensureTo ensure the the calibration’s calibration’s accuracy, accuracy, we use use all all of of the the measured measured points points to have to a have good a sample good sampleof To ensure the calibration’s accuracy, we use all of the measured points to have a good sample of data with different lux levels, which were used in order to find the calibration factor of the device. of datadata with with different lux lux levels, levels, which which were were used usedin order in to order find the to findcalibrati theon calibration factor of the factor device. of the The calibration defines which digital output value relates to which luminance input signal. This device.The Thecalibration calibration defines defines which which digital digitaloutput outputvalue relates value to relates which to luminance which luminance input signal. input This signal. relationship between scene luminance and digital output levels of a digital image’s capture system is Thisrelationship between between scene scene luminance luminance and and digital digital outp outputut levels levels of a digital of a digital image’s image’s capture capture system is system called optoelectronic conversion function (OECF) [10]. This kind of calibration is important to adjust is calledcalled optoelectronic optoelectronic conversion conversion function (OECF) (OECF) [10] [10. ].This This kind kind of calibration of calibration is important is important to adjust to adjust the model developed to the characteristics of the devices. Once the calibrated factor is obtained, to the model developed to the characteristics of the devices. Once the calibrated factor is obtained, to the modelachieve developed the real measured to the data, characteristics it is necessary of to the mu devices.ltiply the Once measured the calibrated value to this factor factor, is as obtained, shows to achieve the real measured data, it is necessary to multiply the measured value to this factor, as shows achieveEquation the real (2): measured data, it is necessary to multiply the measured value to this factor, as shows EquationEquation (2): (2): Luxreal = Luxmeasure × Ccal. (2) LuxrealLuxreal = = LuxmeasureLuxmeasure ×× Ccal.Ccal. (2) (2) After calibrating the measures performed with the calibration factor, the absolute error has been After calibrating the measures performed with the calibration factor, the absolute error has been reducedAfter calibrating to 13.74%, theand, measures as can be appreciated performed in with Figure the 6, calibration the values factor,are closer the to absolute the reference error data. has been reducedreduced to 13.74%, to 13.74%, and, and, as as can can be be appreciated appreciated inin Figure 6,6, the the values values are are closer closer to tothe the reference reference data. data. 800 800 700 700 600 600 500 500 400 400 300 300 Illuminance (lux)

Illuminance (lux) 200 200 100 100 0 0 0 5 10 15 20 25 0 5 10 15 20 25 Measurements Measurements Luxmeter Measured Values Calibrated Values Luxmeter Measured Values Calibrated Values

FigureFigure 6. Ambient 6. Ambient light light sensor sensor vs. vs. calibratedcalibrated ambien ambientt light light sensor sensor vs. vs.luxmeter luxmeter accuracy. accuracy. Figure 6. Ambient light sensor vs. calibrated ambient light sensor vs. luxmeter accuracy. Appl. Sci. 2017, 7, 616 10 of 18 Appl. Sci. 2017, 7, 616 10 of 18

However,However, if we analyze the accuracy of the data data in in depth, depth, it it is is possible possible to to sort sort out out three three different different groups.groups. If If we we divide divide the the measuremen measurementsts in in these these groups groups and and recalculate recalculate calibration calibration factor factor of of each each one one separately,separately, the accuracy of the sensor can be increased.increased. The three groups ofof datadata areare thethe following:following:

1. TheThe first first group of valuesvalues englobesenglobes measurements measurements up up to to 100 100 lux. lux. If weIf we analyze analyze the the accuracy accuracy of this of thisdata data independently independently of theof the global global evaluation, evaluation, it it is is possible possible to to see see how howthe the accuracyaccuracy of the data isis too too low low with with an an absolute absolute error error of of 61.77%. 61.77%. However, However, if if we we analyze analyze these these data data separately separately from from thethe rest rest of of measurements, measurements, performing performing the the calibration calibration of of these these values, values, it it is is possible possible to to see see how how the the errorerror decreases decreases to to 27.01%. 27.01%. 2. The second group of values englobes measurements from 100 to 500 lux. Analyzing once again 2. The second group of values englobes measurements from 100 to 500 lux. Analyzing once again the accuracy of this data separately from the global evaluation, it is shown how the accuracy of the accuracy of this data separately from the global evaluation, it is shown how the accuracy of the data in this section is higher, with an absolute error of 8.20%. However, performing again the data in this section is higher, with an absolute error of 8.20%. However, performing again the the calibration of the system to these values, it is possible to decrease the error to a 5.86%. calibration of the system to these values, it is possible to decrease the error to a 5.86%. 3. The last group englobes measurements higher than 500 lux. Despite the errors obtained in these 3. The last group englobes measurements higher than 500 lux. Despite the errors obtained in these measurements not being high regarding the percentage (4.75%), the problem observed is that measurements not being high regarding the percentage (4.75%), the problem observed is that the the higher the value measured, the higher the difference between real and calibrated values. For higher the value measured, the higher the difference between real and calibrated values. For this this reason, this section has been analyzed separately again to reduce the percentage of error as reason, this section has been analyzed separately again to reduce the percentage of error as much much as possible, obtaining an absolute error of 1.84%. as possible, obtaining an absolute error of 1.84%. As a result, and after this new recalibration, if we evaluate again the accuracy of the light sensor As a result, and after this new recalibration, if we evaluate again the accuracy of the light sensor for all the measurements, and always having in mind the luxmeter as the reference level, the accuracy for all the measurements, and always having in mind the luxmeter as the reference level, the accuracy of the evaluation increases, having an absolute error of 8.41%. Figure 7 shows the final data analysis of the evaluation increases, having an absolute error of 8.41%. Figure7 shows the final data analysis with this new calibration. with this new calibration.

800

700

600

500

400

300

Illuminance (lux) 200

100

0 0 5 10 15 20 25 Measurements

Luxmeter Calibrated Values

Figure 7. Calibrated ambient light sensor vs. luxmeter accuracy. Figure 7. Calibrated ambient light sensor vs. luxmeter accuracy.

ToTo evaluate evaluate the the behavior behavior of of this this sensor, sensor, and and in in order order to toknow know if these if these calibrations calibrations can can be used be used by otherby other devices, devices, we wehave have repeated repeated the the experiment, experiment, with with a aSony Sony Xperia Xperia M2 M2 and and a aBQ BQ Aquaris Aquaris X5 X5 smartphones.smartphones. After After repeating repeating the the experiment experiment in in th thee same same conditions conditions as as in in the the previous previous case, and performing the the initial initial calibration calibration according according to to Equation Equation (2), (2), we we have have obtained obtained an an average average error error of of 10.33% in the first first device and 11.82% in the second. The results are shown in Figure8 8.. Appl. Sci. Sci. 20172017,, 77,, 616 616 1111 of of 18 18

800 700 600 500 400 300 200 Illuminance (lux) 100 0 0 5 10 15 20 25 Measurements

Luxmeter Sony Xperia M2 BQ Aquaris X5

Figure 8. Sony Xperia M2’s Ambient light sensor vs. BQ Aquaris X5’s Ambient light sensor vs. Figureluxmeter 8. accuracy.Sony Xperia M2’s Ambient light sensor vs. BQ Aquaris X5’s Ambient light sensor vs. luxmeter accuracy. To know if the measurement groups used in the previous experiment to recalculate the devices’ To know if the measurement groups used in the previous experiment to recalculate the devices’ calibration factor can be used in other devices, they were used in the new experiments. As a result, calibration factor can be used in other devices, they were used in the new experiments. As a result, we have that the accuracy of the measurements are higher than if we use just one calibration factor, we have that the accuracy of the measurements are higher than if we use just one calibration factor, passing from 10.33% to 7.80% of average error in Sony Xperia M2, and passing from 11.82% to 9.58% passing from 10.33% to 7.80% of average error in Sony Xperia M2, and passing from 11.82% to 9.58% in the case of BQ Aquaris X5. However, to check if those calibration groups can be optimized in each in the case of BQ Aquaris X5. However, to check if those calibration groups can be optimized in each device, an analysis to find the best calibration option in each case was performed. As a result, it is device, an analysis to find the best calibration option in each case was performed. As a result, it is possible to see how, in the case of Sony Xperia M2, the best measurement groups match the case of possible to see how, in the case of Sony Xperia M2, the best measurement groups match the case of the first experiment. However, in the case of BQ Aquaris X5, there are differences in the behavior the first experiment. However, in the case of BQ Aquaris X5, there are differences in the behavior regarding the measurements performed in the initial experiment, which suggest that it is possible to regarding the measurements performed in the initial experiment, which suggest that it is possible to move the group of measurements to perform the recalibration. In this case, it is possible to decrease the move the group of measurements to perform the recalibration. In this case, it is possible to decrease error from 9.58% to 7.87% if we move the barriers of the recalibration in the following groups: 0–100; the error from 9.58% to 7.87% if we move the barriers of the recalibration in the following groups: 0– 101–500 and 501–700. 100; 101–500 and 501–700. 5.2. Mobile Camera 5.2. Mobile Camera The second methodology used to measure the illuminance through the mobile devices is based on the useThe of second the digital methodology camera. As used it does to measure happen the in previous illuminance sections, through in order the mobile to perform devices an accurateis based onmeasurement, the use of the the digital digital camera. camera hasAs it to does be calibrated happen in first previous before usingsections, it for in measuring order to perform luminance. an accurateThis time, measurement, to calibrate the the measurements digital camera obtained, has to be it calibrated is necessary first to before take into using account it for not measuring only the luminance.differences inThis hardware time, tobetween calibrate devices the measurements but also the cameraobtained, settings it is necessary that have to to take be fixed into foraccount all of not the onlymeasurements. the differences These in valueshardware are: between ISO, which devices is the bu levelt also of sensitivitythe camera of settings the camera that tohave available to be fixed light; forShutter all of Speed, the measurements. which is the lengthThese values of time are: a camera ISO, which shutter is the is open level to of expose sensitivity light of into the the camera camera to available light; Shutter Speed, which is the length of time a camera shutter is open to expose light sensor; and , which is a hole within a lens, through which light travels into the camera body. into the camera sensor; and Aperture, which is a hole within a lens, through which light travels into For this reason, the measurements carried out in the experiment keep the same camera characteristics the camera body. For this reason, the measurements carried out in the experiment keep the same fixed throughout the experiments. In this way, it was possible to compare the obtained results. camera characteristics fixed throughout the experiments. In this way, it was possible to compare the To check the accuracy of this method, another Android application was developed to obtain the obtained results. luminance level directly with the digital camera. This application was executed in a first step in a To check the accuracy of this method, another Android application was developed to obtain the Sony Xperia M2 smartphone and a Luxi device was used as a filter to guarantee that the luminance is luminance level directly with the digital camera. This application was executed in a first step in a measured as close as possible to the camera. To perform the picture capture in the same conditions, Sony Xperia M2 smartphone and a Luxi device was used as a filter to guarantee that the luminance the application fixed the camera settings. Before that, the camera captures the picture, the application is measured as close as possible to the camera. To perform the picture capture in the same conditions, developed evaluates it pixel by pixel in order to obtain the RGB values and transforms these values to the application fixed the camera settings. Before that, the camera captures the picture, the application grey scale through Equation (1), which performs the sum of Red, Green and Blue components. developed evaluates it pixel by pixel in order to obtain the RGB values and transforms these values Furthermore, and to ensure the accuracy of the methodology, a calibration phase where we use to grey scale through Equation (1), which performs the sum of Red, Green and Blue components. all of the measured points to find the calibration factor of the device is required. The calibration Furthermore, and to ensure the accuracy of the methodology, a calibration phase where we use all of the measured points to find the calibration factor of the device is required. The calibration Appl. Sci. 2017, 7, 616 12 of 18 Appl. Sci. 2017, 7, 616 12 of 18 defines which digital output value relates to which luminance input signal. After the calibration of defines which digital output value relates to which luminance input signal. After the calibration of the the measures was performed, the absolute error of the measurements became 12.63% (Figure 9). measures was performed, the absolute error of the measurements became 12.63% (Figure9).

800

700

600

500

400

300

Illuminance (lux) 200

100

0 0 5 10 15 20 25 30 Measurements

Luxmeter Camera Luminance

Figure 9. Digital camera vs. luxmeter accuracy. Figure 9. Digital camera vs. luxmeter accuracy.

However,However, if we evaluate the accuracy of the data data in in more more detail, detail, it it is is possible possible again again to to divide divide the the datadata into into three three different groups. Dividing Dividing the the me measurementsasurements in in these these groups groups and and recalculating recalculating the the calibrationcalibration factor ofof eacheach one one separately, separately, the the accuracy accuracy of theof the measurements measurements can becan increased. be increased. The threeThe threegroups groups studied studied are the are following: the following: 1.1. TheThe first first group group of of values values englobes englobes measurements measurements up up to to 100 100 lux. lux. If If we we analyze analyze the the accuracy accuracy of of thisthis portion portion of of data, data, it it is is too too low, low, with with an an absolute absolute error error of of 46.43%. 46.43%. However, However, if if we we perform perform the the calibrationcalibration limited limited to to these these values, values, it it is is possi possibleble to to see see how how the the error error decreases decreases to to 20.35%. 20.35%. 2.2. TheThe second second group group of of values values englobes englobes measurements measurements from from 100 100 to to 500 500 lux. lux. With With an an absolute absolute error error ofof 5.35%, 5.35%, performing performing again again the the calibration calibration of of the the sy systemstem to to these these values, values, it it is is possible possible to to decrease decrease thethe error error to to 4.21%. 4.21%. 3.3. TheThe last last group group englobes englobes measurements measurements higher higher th thanan 500 500 lux. lux. Without Without a a high high amount amount of of error error regardingregarding the the percentage percentage (10.70%), (10.70%), the the problem problem ob observedserved is is that that error error increases increases if if the the value value measuredmeasured is is higher. higher. For For this this reason, reason, this this section section has has been been analyzed analyzed separately, separately, obtaining obtaining an an absoluteabsolute error error of of 2.17%. 2.17%.

AsAs a a result, result, after after this this new new calibration calibration method, method, th thee accuracy accuracy of of the the light light sensor, sensor, compared compared with with a a referencedreferenced luxmeter, luxmeter, increased, having an absolute error of 6.35% (Figure 1010).). To evaluate the behavior of this sensor, and in order to know if these calibrations can be used by other devices, we have repeated the experiment in the same conditions, with an LG Nexus 5 and a BQ Aquaris X5. After repeating the experiment and performing the initial calibration according to Equation (2), we have obtained an average error of 12.93% in the first device and 10.02% in the second. The results are shown in Figure 11. Appl. Sci. 2017, 7, 616 13 of 18

800 700 600 500 400 Appl.Appl. Sci. Sci. 20172017, ,77, ,616 616 1313 of of 18 18 300

Illuminance (lux) 800200 700100 6000 0 5 10 15 20 25 30 500 Measurements 400

300 Luxmeter Camera Luminance Calibrated camera

Illuminance (lux) 200 100 Figure 10. Digital camera vs. calibrated digital camera vs. luxmeter accuracy. 0 To evaluate0 the behavior 5 of this sensor, 10 and in order 15 to know if 20these calibrations 25 can be used 30 by other devices, we have repeated the experimentMeasurements in the same conditions, with an LG Nexus 5 and a BQ Aquaris X5. After repeating the experiment and performing the initial calibration according to Equation (2), we have obtainedLuxmeter an averageCamera error Luminance of 12.93% in Calibratedthe first device camera and 10.02% in the second. The results are shown in Figure 11. Figure 10. Digital camera vs. calibrated digital camera vs. luxmeter accuracy. Figure 10. Digital camera vs. calibrated digital camera vs. luxmeter accuracy. 800 To evaluate the behavior of this sensor, and in order to know if these calibrations can be used by 700 other devices, we have repeated the experiment in the same conditions, with an LG Nexus 5 and a BQ Aquaris600 X5. After repeating the experiment and performing the initial calibration according to Equation500 (2), we have obtained an average error of 12.93% in the first device and 10.02% in the second. The results400 are shown in Figure 11. 300

Illuminance (lux) 800200 700100 6000 500 0 5 10 15 20 25 30 400 Measurements 300 Luxmeter LG Nexus 5 BQ Aquaris X5 Illuminance (lux) 200 Figure 11. LG Nexus 5’s digital damera vs. BQ Aquaris X5’s Digital camera vs. luxmeter accuracy. 100 Figure 11. LG Nexus 5’s digital damera vs. BQ Aquaris X5’s Digital camera vs. luxmeter accuracy. To know0 if the accuracy of the measurements increases if we use the calibration ranges used in 0 5 10 15 20 25 30 the previousTo know experiment, if the accuracy a recalibration of the measurements of the measurement increases if following we use the the calibration same methodology ranges used as in in thethe previous previous experimentexperiment, was a recalibration performed. of As the a result, Measurementsmeasurement the accuracy following of the the measurements same methodology is higher as than in theif we previous used just experiment one calibration was performed. factor, going As from a result, 12.93% the accuracy to 9.24% ofof averagethe measurements error in LG is Nexus higher 5, than and Luxmeter LG Nexus 5 BQ Aquaris X5 ifgoing we used from just 10.02% one calibration to 8.82% in factor, the case going of BQ from Aquaris 12.93% X5. to 9.24% However, of average analyzing error both in LG cases Nexus separately, 5, and goingit is possible from 10.02% to see to differences 8.82% in the in thecase behavior of BQ Aq regardinguaris X5. However, the measurements analyzing performed both cases in separately, the initial it is possible to see differences in the behavior regarding the measurements performed in the initial experiment,Figure 11. which LG Nexus suggest 5’s digital that it damera is possible vs. BQ to Aquaris move X5’s the Digital group camera of measurements vs. luxmeter toaccuracy. perform the experiment,recalibration. which In the suggest case of the that measurement it is possible performed to move onthe LG group Nexus of 5,measurements it was possible to to perform decrease the the recalibration.errorTo up know to 7.26% Inif thethe if accuracy wecase move of the of the measurementthe barriers measurements of the perfor recalibration incrmedeases on LGif in we theNexus use following the 5, itcalibration was groups: possible ranges 0–100; to decrease 101–400used in thetheand previouserror 401–700. up toexperiment, The 7.26% same if we happened a moverecalibration the in barriers case of of the BQ of methe Aquarisasurement recalibration X5, where following in the it was following the possible same groups:methodology to reduce 0–100; the as error101– in theto 7.87%,previous performing experiment the was recalibration performed. according As a result, to the the following accuracy of groups: the measurements 0–50; 51–575; is 576–700. higher than if we used just one calibration factor, going from 12.93% to 9.24% of average error in LG Nexus 5, and going5.3. External from 10.02% Sensor to Device 8.82% in the case of BQ Aquaris X5. However, analyzing both cases separately, it is possibleThe last to methodology see differences studied in the includes behavior the regarding use of the the external measurements sensor device. performed In this situation,in the initial the experiment,mobile phone which does suggest not measure that theit is light. possible It only to receivesmove the the group sensor’s of measurements information about to perform the quantity the recalibration.of light across In a Bluetooththe case of signal. the measurement At first sight, perfor this methodologymed on LG Nexus is expected 5, it was to be possible the most to accurate decrease of the error up to 7.26% if we move the barriers of the recalibration in the following groups: 0–100; 101– Appl. Sci. 2017, 7, 616 14 of 18

400 and 401–700. The same happened in case of BQ Aquaris X5, where it was possible to reduce the error to 7.87%, performing the recalibration according to the following groups: 0–50; 51–575; 576–700.

5.3. External Sensor Device The last methodology studied includes the use of the external sensor device. In this situation, theAppl. mobile Sci. 2017 ,phone7, 616 does not measure the light. It only receives the sensor’s information about14 ofthe 18 quantity of light across a Bluetooth signal. At first sight, this methodology is expected to be the most accurate of the three studied in this paper because it presents a dedicated hardware developed with the three studied in this paper because it presents a dedicated hardware developed with the intention the intention of measuring the light. In this situation, we started from a device that was previously of measuring the light. In this situation, we started from a device that was previously calibrated, calibrated, so that the information received is ready to be used directly in every device connected to so that the information received is ready to be used directly in every device connected to the sensor. the sensor. To perform the study of the accuracy of this device, the same conditions as in the previous To perform the study of the accuracy of this device, the same conditions as in the previous experiments (a dark room with a dimmable light) were used, and the results obtained when the experiments (a dark room with a dimmable light) were used, and the results obtained when the measurements were compared with the reference values obtained from the luxmeter show an absolute measurements were compared with the reference values obtained from the luxmeter show an error of 2.70% (Figure 12). Despite everything indicating that two calibrated sensors should measure absolute error of 2.70% (Figure 12). Despite everything indicating that two calibrated sensors should the same value in the same conditions, the differences in the design could cause differences derived measure the same value in the same conditions, the differences in the design could cause differences from the position and angle misalignments, making the comparison of the values a difficult task to derived from the position and angle misalignments, making the comparison of the values a difficult be performed. task to be performed. 450 400 350 300 250 200 150 Illuminance (lux) 100 50 0 0 2 4 6 8 10 12 14 16 Measurements

Luxmeter Alcalux

Figure 12. External sensor device (Alcalux) vs. luxmeter accuracy. Figure 12. External sensor device (Alcalux) vs. luxmeter accuracy. 5.4. Hypothesis Validation 5.4. Hypothesis Validation Regarding the proposed hypotheses, they can be answered based on the research performed. Regarding the proposed hypotheses, they can be answered based on the research performed. The first hypothesis (H1) stated that the ambient light sensor that is present in most mobile devices The first hypothesis (H1) stated that the ambient light sensor that is present in most mobile provides enough quality to be used as a measurement tool, with the developed Android application devices provides enough quality to be used as a measurement tool, with the developed Android and the measurements performed twice, one with the mobile phone and another with a calibrated application and the measurements performed twice, one with the mobile phone and another with a luxmeter. Once all of the data were obtained and compared, it was possible to check how the accuracy calibrated luxmeter. Once all of the data were obtained and compared, it was possible to check how of the light meter was too low, with an error of 39.08%. However, after a process of calibration, this the accuracy of the light meter was too low, with an error of 39.08%. However, after a process of error was reduced up to 8.41% in the case of the first experiment. Given these results, it is possible to calibration, this error was reduced up to 8.41% in the case of the first experiment. Given these results, assert that this kind of sensor can be used as a measurement tool. However, the average error observed it is possible to assert that this kind of sensor can be used as a measurement tool. However, the suggests that this kind of device can be used only as an orientative tool because you need a luxmeter average error observed suggests that this kind of device can be used only as an orientative tool for calibrating every mobile phone model. because you need a luxmeter for calibrating every mobile phone model. Concerning the second hypothesis (H2), which stated that the smartphones’ digital camera can be Concerning the second hypothesis (H2), which stated that the smartphones’ digital camera can used as a lighting measuring tool, an extra functionality to the previous mobile application, in order to be used as a lighting measuring tool, an extra functionality to the previous mobile application, in capture the required data from the digital camera, was developed. As in the previous hypothesis, the order to capture the required data from the digital camera, was developed. As in the previous precision of the measurements when they are compared with a reference luxmeter was at a medium level, with an absolute error of 12.63%. For this reason, a calibration process was necessary in order to improve the accuracy of the data, having the possiblity to reduce this error up to 6.35%. These results highlight that a smartphone’s digital camera can be used as a light measurement tool, asserting the proposed hypothesis. Furthermore, according to the third hypothesis (H3), the use of external sensors connected to the mobile device through Wi-Fi or Bluetooth provides measurements with a similar quality as Appl. Sci. 2017, 7, 616 15 of 18 that obtained by the internal mobile sensors (ambient light sensor and digital cameras). To check the validation of this hypothesis, other measurements were performed with an external sensor that transferred all of the information directly to the mobile device through a Bluetooth connection. After studying all of the measurements, an average error of 2.70% was noted, meaning this hypothesis cannot be accepted due to the accuracy of the external device being higher than the others. In relation to the last hypothesis (H4), which stated that mobile devices can be used by any smartphone user as a fairly accurate light meter tool, we can assert that it is always possible that a pre-calibration process was performed for each device. However, the process of calibration may result in being difficult to be performed by users due to the fact that it requires the use of a calibrated luxmeter, which is not a common device for users. Furthermore, despite a complete process of calibration requiring an analysis performed by measuring sections, the accuracy obtained with just one calibration factor is enough to be used for a general purpose.

6. Conclusions As a conclusion, this study shows how the smartphones can be used in lighting measurement tasks when high precision of data is not required, being a great tool to have a reference of the luminance levels, but they are not as accurate as professional hardware designed for the task. The results do show how the accuracy of each of the three methods used to perform the evaluation of the luminance is high after calibration. However, if the results are compared between the three methods, it can be seen how the precision of the internal sensors, as ambient light sensor or the digital camera, regarding to an external sensor is lower. This can be caused by the perturbation of ambient light and the fact that the mobile ambient light sensor, due to its physical characteristics, is only able to read direct light, while the luxmeter used on the experiment is able to also measure indirect light. However, a light meter can never be 100% accurate. There will always be slight variances between light meters, even if they are identical models. It is important to take into consideration that luxmeters can also drift over time, making it necessary to calibrate them to eventually ensure readings as accurately as possible. This characteristic that makes it necessary to calibrate each device separately, even in identical models, hinders the use of smartphones as an accurate measurement tool due to the need to perform the calibration on each device separately. On the other hand, the use of an external device not only improves measurements accuracy, but it can also be used by more than one mobile device. During the experiments, it was also showed how the use of more than one calibration’s parameter increases the accuracy of each sensor. However, the lighting section used to perform this calibration can be different in each device, a reason why, before performing this evaluation, it is necessary to determine values that fit better for each case. Nevertheless, the work performed does not stop here. For future directions of study, the use of artificial intelligence is proposed, specifically a multi-agent, to evaluate the values obtained for the external sensor to help in decision-making about lighting. Likewise, the use of both ambient light sensors and digital cameras as tools for home automation control in offices, centers and homes, where the measurements do not need to be as accurate, is also proposed. Finally, creating a collaborative system that allows the combination of measures from more than one mobile phone, with the aim of self-discovering the calibration needed for every device, is proposed.

Acknowledgments: Authors want to thank the support of ESVI-AL EU project, and to the “University Master in Information Technology Project Management” of the University of Alcalá. Appl. Sci. 2017, 7, 616 16 of 18

Author Contributions: Jose-Maria Gutierrez-Martinez and Ana Castillo-Martinez have developed the mobile application used along the experiments and performed the analysis of the results obtained on the different experiments; Jose-Amelio Medina-Merodio and Juan Aguado-Delgado have been in charge of the measurements performed, have perform the measurements and Jose-Javier Martinez-Herraiz have coordinate the work performed and validated the results. Conflicts of Interest: The authors declare no conflict of interest.

References

1. Park, B.S.; Choi, H.H. Design and Implementation of Interactive-typed Bluetooth Device interact with An-droid Platform-based Contents Character. J. Korea Soc. Comput. Inf. 2014, 19, 127–135. [CrossRef] 2. Hong, S.P.; Kang, S.; Kim, J. Design and Implementation of Reliable Content Transaction System in Smartphone Environment. Int. J. Smart Home 2013, 7, 333–342. [CrossRef] 3. Bajad, R.A.; Srivastava, M.; Sinsha, A. Survey on Mobile Cloud Computing. J. Eng. Sci. Emerg. Technol. 2012, 1, 8–19. 4. Sarwar, M.; Soomro, T.R. Impact of Smartphone’s on Society. Eur. J. Sci. Res. 2013, 98, 216–226. 5. Electricity Cost Calculator. Available online: https://play.google.com/store/apps/details?id=com. winterparadox.Watt_Calculator (accessed on 24 April 2017). 6. Koroglu, M.T.; Passino, K.M. Illumination balancing algorithm for smart lights. IEEE Trans. Control Syst. Technol. 2014, 22, 557–567. [CrossRef] 7. Baum, A.; West, R.; Weinman, J.; Newman, S.; McManus, C. Cambridge Handbook of Psychology, Health and Medicine; Cambridge University Press: Cambridge, UK, 1997. [CrossRef] 8. Burks, S.L. Managing Your Migraine; Humana Press: Totowa, NJ, USA, 1994; ISBN 0-89603-277-9. 9. European Committee for Standardization. UNE-EN 12464-1:2012 Light and Lighting—Lighting of Work Places—Part 1: Indoor Work Places; European Committee for Standardization: 2012. 10. European Committee for Standardization. UNE-EN 12464-2:2008. Light and Lighting—Lighting of Work Places—Part 2: Outdoor Work Places; European Committee for Standardization: 2008. 11. Marschner, S.R.; Greenberg, D.P. Inverse lighting for photography. In Proceedings of the Color and Imaging Conference, Scottsdale, AZ, USA, 17–20 November 1997; Society for Imaging Science and Technology: Springfield, VA, USA, 1997; Volume 1, pp. 262–265. 12. Ismail, H.; Azmi, M.S.; Hashim, M.A.; Ayob, M.N.; Hashim, M.S.M.; Hassrizal, H.B. Development of a webcam based lux meter. In Proceedings of the 2013 IEEE Symposium on Computers & Informatics (ISCI), Langkawi, Malaysia, 7–9 April 2013; pp. 70–74. [CrossRef] 13. Pavlogeorgatos, G. Environmental parameters in museums. Build. Environ. 2003, 38, 1457–1462. [CrossRef] 14. Lorne, J.K.; Salmon, M. Effects of to artificial lighting on orientation of hatchling sea turtles on the beach and in the ocean. Endanger. Species Res. 2007, 3, 23–30. [CrossRef] 15. Wise, S. Studying the ecological impacts of light pollution on wildlife: Amphibians as models. In StarLight: A Common Heritage; Marın, C., Jafari, J., Eds.; StarLight Initiative la Palma Biosphere Reserve, Instituto de Astrofısica de Canarias, Government of the Canary Islands, Spanish Ministry of the Environment, UNESCO-MaB: Canary Islands, Spain, 2007; pp. 107–116. 16. Sparks, D.D. The Design and Implementation of a Smartphone Illuminance Meter. Doctoral Dissertation, Massachusetts Institute of Technology, Cambridge, MA, USA, 2013. 17. García García, E. Cálculo de Iluminación en Interiores con el Software Visual Profesional Edition; Universidad Veracruzana 2015. (In Spanish). Available online: https://core.ac.uk/display/33661584? source=3&algorithmId=14&similarToDoc=16308316&similarToDocKey=CORE&recSetID=58cfaae7-a2ae- 4bcc-b3c5-1c66fbe95869&position=4&recommendation_type=same_repo&otherRecs=16306137,54242594, 80118441,33661584,29406445 (accessed on 9 June 2017). 18. Gómez-Llorente, D. A new methodology for calculating roadway lighting design based on a multi-objective evolutionary algorithm. J. Expert Syst. Appl. 2013, 40, 2156–2164. [CrossRef] 19. Raminhos, F.M.; Valdez, M.; Ferreira, C.M.; Barbosa, F.M. Programas de Cálculo Luminotécnico-Uma Análise Comparativa entre O DIALUX e o RELUX. Proceeding of the International Conference on Engineering UBI, Covilhã, Portugal, 28 November 2011; pp. 28–30. 20. SEAD (Super-efficient Equipment and Appliance Deployment) (2014). Available online: http:// superefficient.org/sltool (accessed on 24 April 2017). Appl. Sci. 2017, 7, 616 17 of 18

21. iMventaingenrios. Available online: http://www.imventa.com/btwin-baja-tensi%C3%B3n (accessed on 24 April 2017). 22. Blakeslee, T.; Bryll, E. Integrating Light Meter with Movable Meter Mechanism. U.S. Patent No. 3,709,615, 9 January 1973. 23. Ekrias, M.; Eloholma, M.; Halonen, L.; Song, X.J.; Zhang, X.; Wen, Y. Road lighting and headlights: Luminance measurements and automobile lighting simulations. Build. Environ. 2008, 43, 530–536. [CrossRef] 24. Glenn, J.; Dodds, G.; Robinson, R. Calibration and use of camera-based systems for road lighting assessment. Light. Res. Technol. 2000, 32, 33–40. [CrossRef] 25. Zatari, A.; Dodds, G.; McMenemy, K.; Robinson, R. Glare, luminance and illuminance measurements of road lighting using vehicle mounted CCD cameras. LEUKOS J. Illum. Eng. Soc. N. Am. 2005, 1, 85–106. [CrossRef] 26. Manzano, E.R.; Cabello, A.J. Visibilty measurements with CCD in road lighting. J. Ing. Iliminatilui 2000, 59–63. 27. Wüller, D.; Gabele, H. The usage of digital cameras as luminance meters. In Proceedings of the SPIE 6502, Digital Photography III, 65020U, San José, CA, USA, 28 January 2007. [CrossRef] 28. Sumriddetchkajorn, S.; Somboonkaew, A. Low-Cost Cell phone-based Digital Lux Meter. In Proceedings of the SPIE 7853, Advanced Sensor system and Applications IV, 78530L, Beijing, China, 18 October 2010. [CrossRef] 29. Dhondge, K.; Choi, B.Y.; Song, S.; Park, H. Optical Wireless authentication for smart devices using an onboard ambient light sensor. In Proceedings of the 2014 23rd International Conference Computer Communication and Networks (ICCCN), Shanghai, China, 4–7 August 2014; IEEE: New York, NY, USA, 2014; pp. 1–8. 30. Spreitzer, R. Pin skimming: Exploiting the ambient-light sensor in mobile devices. In Proceedings of the 4th ACM Workshop on Security and Privacy in Smartphones & Mobile Devices, Scottsdale, AZ, USA, 3–7 November 2014; ACM: New York, NY, USA, 2014; pp. 51–62. [CrossRef] 31. Sans, J.A.; Manjón, F.J.; Pereira, A.L.J.; Gómez-Tejedor, J.A.; Monsoriu, J.A. Oscillations studied with the smartphone ambient light sensor. Eur. J. Phys. 2013, 34, 1349–1354. [CrossRef] 32. Corcoba Magaña, V.; Muñoz-Organero, M. Artemisa: Using and android device as an eco-driving assistant. In Proceedings of the IEEE International Conference on Consumer Electronics, Berlin, Germany, 6–8 September 2011; pp. 211–2015. [CrossRef] 33. Preechaburana, P.; Macken, S.; Suska, A.; Filippini, D. Mobile phone analysis of NT-proBNP using high dynamic range (HDR) imaging. Procedia Eng. 2010, 5, 584–587. [CrossRef] 34. Sumriddetchkajorn, S.; Somboonkaew, A.; Chanhorm, S. Mobile device-based digital microscopy for education, healthcare, and agriculture. In Proceedings of the ECTI International Conference, Prajuabkeerekun, Thailand, 12–28 May 2012. [CrossRef] 35. Sumriddetchkajorna, S.; Chaitavonb, K.; Intaravanneba, Y. Mobile-platform based colorimeter for monitoring chlorineconcentration in water. Sens. Actuators B Chem. 2014, 191, 561–566. [CrossRef] 36. Zhu, H.; Mavandadi, S.; Coskun, A.F.; Yaglidere, O.; Ozcan, A. Optofluidic fluorescent imaging cytometry on a cell phone. Anal. Chem. 2011, 83, 6641–6647. [CrossRef][PubMed] 37. Gonzales, R.C.; Woods, R.E.; Eddins, S.L. Digital Image Processing Using MATLAB; Pearson Prentice Hall: New Jersey, NJ, USA, 2014. 38. Negar, N.; Williams, D.; Schwartz, J.; Ahamed, S.I.; Smith, R.O. Smartphone-based Light Intensity Calculation Application for Accessibility Measurement. In Proceedings of the RESNA Annual Conference, Indianapolis, IN, USA, 11–15 June 2014. 39. Extrasensory Devices. Luxi for All. Available online: http://www.esdevices.com/products/luxi (accessed on 24 April 2018). 40. Kumar, K.; Lu, Y.H. Cloud computing for mobile users: Can offloading computation save energy? Computer 2010, 4, 51–56. [CrossRef] 41. Perrucci, G.P.; Fitzek, F.H.P.; Widmer, J. Survey on energy consumption entities on the smartphone platform. In Proceedings of the IEEE 73rd Vehicular Technology Conference (VTC Spring), Budapest, Hungary, 15–18 May 2011; pp. 1–6. [CrossRef] 42. Rouving Networks. RN42/RN42N Class 2 Bluethooth Module. Available online: http://ww1.microchip. com/downloads/en/DeviceDoc/rn-42-ds-v2.32r.pdf (accessed on 25 May 2016). Appl. Sci. 2017, 7, 616 18 of 18

43. NORPS-12 Silonex. Available online: http://docs-europe.electrocomponents.com/webdocs/0034/ 0900766b8003484c.pdf (accessed on 24 April 2017). 44. PCE Instruments. Luxometro PCE-174. (In Spanish). Available online: https://www.pce-instruments.com/ espanol/slot/4/download/91663/hoja-datos-pce-174.pdf (accessed on 24 April 2017).

© 2017 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).