Portable Device for Continuous Measurement (DIPORMEC)

Nowadays, the conditions of the workplace are having a very important role in different areas. Therefore, a device was created to measure variables, for the time being, of quantity, of light, Lumens and Lux, temperature and relative humidity. Besides, this device continuously saves these variables in a file on an SD card to be analysed later. Another feature of this device is that it is portable which means it works with built-in batteries or with a universal connector, so that it can work easily in a workplace (offices). For this work it is shown how what we call cloning of the luminosity sensor was performed, for this particular case, with an LDR the amount of Lux is determined, taking as reference the light sensor of the Samsung A7 cell phone, and thus generating the equation that governs the sensor. In the connection diagram, the possibility of connecting other sensors that do not require adjustment work such as the one of brightness is left open, taking full advantage of the Arduino card’s capacity, but for the moment it is not part of the study of this work.


Introduction
Measurements with DIPORMEC can be taken without requiring a PC or other processing and storage device, as it was provided with its own processor (Arduino UNO microcontroller card) and a storage SD card. Therefore, it is expected that its measurements were not greater to that of a lotion box, which makes it truly portable. In addition, it can be monitored through Bluetooth or RF (X-Bee) in case of being required, this in order to see the samplings in real time. However, it should be noted that these samplings are recorded in the SD memory to be able to be analyze in Excel or another program.
The particularity of DIPORMEC is that it is able to make multiple measurements at the time and for long periods. The most important part is to validate the sensors. For this reason, a technique called sensor cloning was used in this part of the project. This technique consists of making simultaneous measurements with a calibrated device and the economic sensor, In addition, it help to find a function that leads the sensor used in DIPORMEC to approach the measurement made with the calibrated equipment, having at least an R2 ratio higher than 0.98. Thus, costs low and multi-sensing equipment is built.

Problem statement
Jobs must meet special characteristics so that workers have specific and optimal conditions for a good performance and to avoid illnesses due to non-compliance with these conditions. The main idea of this project is to create a prototype device that takes information continuously during the day of the amount of light or lumens in a workplace. This information is saved on an SD card to be downloaded and then the data is interpreted on a PC in a program such as Excel. The device can save the information of a week taking data up to every minute or other time period as required. It is also possible to attach other variables such as the amount of noise and even temperature and specific humidity. Therefore, at this point the question arises: How can measurements be acquired continuously of different variables such as lumens or temperature with a low-cost portable device? The following methodology is followed in order to build DIPORMEC at low cost as an initiative to develop equipment and support the provision of UNITECNAR's laboratories with useful tools for teaching -learning and generation of own technology (see figure 1).

Phases implemented to the construction of DIPORMEC
To be able to assemble this project, it is necessary to take into account the configuration steps that the different cards and sensors bring. However, the development of the application is important in order to efficiently and accurately capture the information or data obtained from the sensors.
The main elements used in DIPORMEC are described below, as well as some of the sensors that are integrated into the device, with their respective characteristics.

Arduino Nano Card
The Arduino Nano (see figure 2) is a small, complete and an easy board to use. It is based on the ATmega328P (Arduino Nano 3.x). It has about the same functionality of the Arduino Duemilanove, [3]

Micro SD module for Arduino
The SD and micro SD cards have become a standard which have displaced other data storage media due to their large capacity and small size. For this reason they have been integrated into a large number of devices, being currently frequent components in computers, tablets and smartphones, among others. Within the world of Arduino, it is possible to find low cost readers for both SD and micro SD cards (see figure 3). The first to appear was the SD readers and later the micro SD. Therefore, in general, the modules with micro SD are more modern models than those of SD.
In both types of readers, reading can be done through the SPI bus. Although they may have other interfaces, such as I2C bus or UART, it is usually preferable to use SPI because of its high transfer rate.
Regarding the cards used, SD cards or SDSC (Standard Capacity) or SDHC (High Capacity) can be used, but not SDXC (Extended Capacity). It must be formatted in file system FAT16 or FAT32 [5].  The term RTC was created to differentiate this type of clocks from the usual electronic clocks, which simply measure time by counting pulses of a signal, without having a direct relationship with temporal units.

Real Time Clock or RTC
On the contrary, the RTCs are more similar to the clocks and calendars that we usually use which work with seconds, minutes, hours, days, weeks, months and years.
RTCs are usually formed by a crystal resonator integrated with the necessary electronics to correctly post the passage of time. The RTC electronics take into account the peculiarities of our way of measuring time, such as the sexagesimal system, the months with different days, or the leap years [5].
The RTCs offer the advantage of reducing energy consumption, providing greater precision and freeing Arduino from having to record the time. In addition, RTCs often incorporate some type of battery that allows maintaining the value of time in case of loss of power.
In the world of homemade electronics and Arduino, there are two common RTCs which are the DS1307 and the DS3231, both manufactured by Maxim (formerly Dallas Semiconductor). The DS3231 has a much higher accuracy and can be considered as a substitute for the DS1307.
The temperature variations in the model DS1307, which affect the time measurement of the resonator crystals, translate into errors in an accumulated phase shift. Because of this, the DS1307 suffers a time lag, which can be 1 or 2 minutes a day [5].
To solve this, the DS3231 (see figure 4) incorporates temperature measurement and compensation guaranteeing an accuracy of at least 2ppm, which is equivalent to a maximum delay of 172ms / day or one second every 6 days. In the real world, they usually get higher accuracies equivalent to phase shifts of 1-2 seconds per month.
The communication in both models is done through the I2C bus, so it is easy to obtain the measured data. The supply voltage is 4.5 to 5.5 for the DS1307 and 2.3 to 5.5V for the DS3231 [5].

Bluetooth module HC-06
This module allows you to add wireless connectivity through a serial TTL interface between Microcontrollers (PIC, Arduino) and other devices such as PCs, laptops or smartphones. The Bluetooth module HC-06 (See figure 5) is configured at the factory to work as a slave, that is, ready to listen for connection requests [6].  The DHT11 (see figure 6) is a low cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and displays the data via a digital signal on the data pin (no analog input pins). It is quite simple to use, but requires careful synchronization to take data. The only drawback of this sensor, it is that you can only obtain new data once every 2 seconds, so the readings that can be performed are minimum every 2 seconds [7].

Light intensity sensor module LDR
This module is made up of LDR (see figure 7) or photoresistor, which is sensitive to ambient light intensity exposure, in order to determine the brightness and light intensity of the medium. This module establishes the brightness threshold through a digital output, providing a high or low voltage level, depending on the configuration of the potentiometer. Real information can be taken through the analog output of the module to a microcontroller or Arduino, obtaining more exact values of luminosity [8].  Figure 7. Light intensity sensor module LDR [8] As previously mentioned, more sensors can be added, such as sound, air quality, among others. Nevertheless the prototype is built with those mentioned here for the moment, on a test basis, making clear its expansion in its next stage.

Results
Among the most relevant results so far, such us, the selection of the sensors and other electronic elements, as well as programming strategies, the authors want to highlight the work done to take the values of certain variables, in this case the method used to measure the intensity of light.
As one of the final objectives of DIPORMEC is to make a low-cost but reliable device when taking the measurements, the sensor cloning methodology was worked. This latter is nothing more than trying to deliver the value of lux of the light intensity measurement which it was not taken directly with a photometer, but with another more economic sensor, for this project the LDR module.
The method consists of simultaneously taking values with the two sensors and collecting data for the same measure. In this instance, a controlled environment was built consisting of an internal black box, 40cm on each side which it is the ceiling. A Led lamp was placed which was connected to a power source of 12V, and a rheostat to be able to vary the amount of light delivered. Besides, in the lower part equally distanced, the LDR module was located and the light sensor was used in this exercise and it was incorporated in a Samsung Galaxy A7, which delivers the measurements in lux directly as shown in Figure 8. Some of the improvements that will be made to the prototype, it is to do this same exercise but with a certified photometer, to reach a true approximation of the data.
Then, it is proceeded to start completely dark and the data is taken from the Smartphone in Lux and the LDR module in volts. The light intensity was increased, turning the rheostat until delivering the maximum delivered by the Led lamp. Each time the intensity was left a while, the measures were stabilized and the data was taken which table 1 arose.  With this information a graph of volts Vs Lux was made (see figure 9) and the respective curve adjustment was ready. It was tested with linear, parabolic adjustment but the one that exceeded R2 greater than 0.98 was the third degree polynomial, with a R2 = 0.9998. The behavior of the curve was expected to be linear, but the value of R2 was 0.8677 and the relative error (2), sometimes exceeded 12%, so it was decided to move to a quadratic curve adjustment, which was not bad, without However, the maximum relative error exceeded 6%, and what was wanted was a relative error below 5%, to have an acceptable cloned sensor accuracy.
The relative error was calculated as follows:

RE= ((Vr-Vm)/Vr)*100%
(2) Where: RE: It is the relative error and is given in percentage, %. Vr: It is the real value. Vm: It is the measured value.
For this reason, it is tested with an adjustment of order 3 and a maximum relative error of 2.4% is achieved, well below the desired 5%, and it was observed that the higher the measurement, the relative error decreases, even in Some cases were 0% or 0.1%, and it really is not that it adds more computational cost, for that reason it was decided to take equation (1), and its R2 was 0.9998 very close to 1 which is what you want. The Arduino card was programmed and the exercise was repeated, this time the value was not written in volts delivered by the LDR, but in LUX, doing the treatment in the Arduino card. The data were recorded in table 2. Besides, the error was also calculated relative in percentage, finding as maximum error of measurement of 2.45%, and as the intensity of light is higher, the error decreases. Then, it was proceeded to compare the two curves, and the result at sight is almost identical (see Figure 10). This was done in order to verify that the measurement with the LDR module is a clone or simulates the measurement of the Smartphone's light sensor. In this way a low cost sensor is obtained, but it responds very closely to a specialized sensor and with a much higher cost. It is thought to do the same with the noise sensor.
The connection of the system can be observed in detail figure 11 in order to readers to have a better idea about the assembly of DIPORMEC, making it clear that sensors 3, 4 and 5 are optional, there could even be many more. However, the card is built and programmed according to the needs.  Figure 11. Connection's diagram among the DIPORMEC components

Conclusions
As a first conclusion, the construction of a portable device for the continuous acquisition of data (DIPORMEC) facilitates some tasks. This first prototype confirms this because it measures comfort variables in the workplace, and not only with the typical measurement with specialized instruments, whose measurements are made at a specific time, but also it can be monitored daily, weekly or monthly if necessary, so that preventive actions can be taken as required.
DIPORMEC is a device that at cost price, value of materials one by one, does not exceed 20 USD. Besides, it provides the possibility of having a photometer, a thermometer and a relative humidity meter at the same time, and with a few dollars more, noise measurement can be added and even air quality metering.
In the market some equipment is obtained for up to $ 14, but these only give one variable, and it does not have the possibility of expanding to more variables, DIPORMEC is an ideal solution for measuring multi-simple variables and that allows to expand to new sensors since even There are free analogs and digital input pins, and it will allow you to save to an SD card, and simultaneously transmit via Bluetooth and WiFi. A device of this type exceeds $ 80, and is not expandable to new variables.
The cloning sensor technique turns out to be very relevant in terms of lowering costs. However, these sensors cannot be compared in durability and other characteristics of the sensors of recognized brands.