<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>A comparative analysis among three commercial temperature sensors</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Ioannou Konstantinos</string-name>
          <email>ioannou.konstantinos@gmail.com</email>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Emmanouloudis Dimitrios</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Xenitidis Kleanthis</string-name>
          <email>kleanthis.xenitidis@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Mathematician, MSc in Mathematics (Analysis-Algebra-Geometry)</institution>
          ,
          <addr-line>Drama, Kerasountos 5</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Professor, Eastern Macedonia Institute of Technology, Department of Forestry and Natural</institution>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Researcher, Eastern Macedonia Institute of Technology, Department of Forestry and Natural</institution>
        </aff>
      </contrib-group>
      <fpage>824</fpage>
      <lpage>836</lpage>
      <abstract>
        <p>Temperature sensors are used in a large number of applications and in a variety of working environments. The quality of these sensors vary depending on the building material, the firmware used to register them, the soldering quality etc. In this paper we compare three different commercial temperature sensors which are connected on a ARM based computer platform. The three sensors monitor temperature for a period of 17 days (one measurement per minute) and their measurements are stored in a remote MySQL database. Additionally, for the calibration and testing of the setup we measure every 30 minutes the temperature using an infrared thermometer and data from the Hellenic National Meteorological Service. Custom build software in PYTHON was used for communicating with the MySQL database, registering the sensors and recording their values.</p>
      </abstract>
      <kwd-group>
        <kwd>Temperature Sensor</kwd>
        <kwd>PYTHON</kwd>
        <kwd>ARM platform</kwd>
        <kwd>MySQL</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>There is a constant need for all field sciences (Forestry, Geology, Agriculture, etc.) to
receive, store and analyze field data. Many researches have been made in this field.
Hart and Martinez, 2006 suggest the creation of Environmental Sensor Networks
(E.S.N.) which can be used to study fundamental processes and additionally be used
for the development of hazard response systems. They also underline the need for
this type of networks and their belief that they will become the standard research tool
for future Earth System and Environmental Science. Additionally, ESNs provide new
opportunities for improving our understanding of the environment. In contrast to
remote sensing technologies where measurements are made from large distances (e.g.
satellite imagery, aerial photography, airborne radiometric surveys), ESNs focus on
measurements that are made in close proximity to the target environmental
phenomenon (Zerger et al, 2010). These types of networks produce large data
streams from diverse sensors using proprietary protocols which are incompatible
with international storage and representation standards. Rettig et al, 2015 suggest the
usage of open source Representational State Transfer (REST) services created
specifically for environmental monitoring. OGC standards are suggested to help
guide future community development for sensor description and registration. In
Greece Ioannou, (2012;2013) Zaimes, et al. 2016 and Kosmadakis et al, 2015
propose the creation of environmental networks that could be used for erosion
monitoring purposes on the suburban forest of Seich Sou in Thessaloniki, Greece.</p>
      <p>Sensor networks developed vary greatly in the form of measurements they take as
well as their mobility. Furthermore, there are a vast selection of sensors measuring a
variety of physical phenomena. So there is an increasing need of testing them and
selecting the optimal for each application. In this paper we will demonstrate a
methodology for selecting the optimal sensor based on its accuracy. For this reason,
we compare the measurement accuracy of 3 temperature sensors available
commercially from various vendors. These sensors can easily be installed in sensor
networks and transmit or store their measurements in a variety of storage media
including cloud. The measurements taken for a period of 17 days and they are
compared with a typical mercury thermometer as well as with measurements taken
from the Hellenic National Meteorological Service (H.N.M.S.).
2</p>
    </sec>
    <sec id="sec-2">
      <title>Materials and Methods</title>
      <p>The sensors used are the mcp9808, the BMP180 and the DHT22 sensors. The
following data are gathered from the datasheets accompanying each sensor.</p>
      <p>Microchip Technology Inc.’s MCP9808 digital temperature sensor converts
temperatures between -20°C and +100°C to a digital word with ±0.25°C/±0.5°C
(typical/maximum) accuracy. The MCP9808 comes with user-programmable
registers that provide flexibility for temperature sensing applications. This sensor has
an industry standard 400 kHz, 2-wire, SMBus/I2C compatible serial interface,
allowing up to eight or sixteen sensors to be controlled with a single serial bus.</p>
      <p>BMP180 digital temperature and pressure sensor converts temperatures between
40°C and +85°C with a typical accuracy of 0.1°C. The BMP180 is designed to be
connected directly to a microcontroller of a mobile device via the I2C bus. The
pressure and temperature data has to be compensated by the calibration data of the
E2PROM of the BMP180.</p>
      <p>DHT22 digital temperature and humidity sensor converts temperatures between
40 °C and +80 °C with a typical accuracy of 0.5°C. Every sensor of this model is
temperature compensated and calibrated in accurate calibration chamber and the
calibration-coefficient is saved in type of programme in OTP memory, when the
sensor is detecting, it will cite coefficient from memory</p>
      <p>All of the aforementioned sensors were installed in the same location and
connected to a Raspberry Pi 3 platform. Additionally, for local reference reasons a
typical mercury thermometer was also installed in the same location. A camera
module was used to take snapshots every thirty minutes of the temperature reading
from the mercury thermometer. The measurements were stored locally as well as to a
remote database server for a period of 17 days (Table 1). After this period, we
performed extensive statistical analysis in an effort to determine the most accurate
sensor array.</p>
      <p>In order to propose the most accurate sensor we compared each of the sensors
with measurements taken from the mercury thermometer as well as measurements
taken from the H.N.M.S.</p>
      <p>Initially, the correlation between the temperature values of the BMP180 sensor
and the mcp9808 sensor is going to be tested. Regression among all paired values of
BMP180 and mcp9808 sensors are shown in figure 1. Moreover, pvalue of the
regression is equal to 0.000%, thus we can reject the null hypothesis that the
coefficient is equal to zero. Therefore, it is acceptable that there is a significant effect
between the values of two sensors. In addition, standard error of estimate has been
computed and it is equal to 0.219, computed using equation 1, which means that
there is a high accuracy of predictions. The line that best fits the data is given by the
equation 2.</p>
      <p>error =
1 n !</p>
      <p>∑(Y i − Yi )2
n i=1</p>
      <p>
        (
        <xref ref-type="bibr" rid="ref1">1</xref>
        )
⋮
1
-0.3
0.2
11.6
8.8
7.2
-0.2
0.3
11.6
9
7.4
4.3
3
3.5
13.9
11.4
10
y = 0.973x + 0.2813
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        )
Residuals, which describe the difference between the data and the line, are also
shown in the figure 1.
      </p>
      <p>A two-sided t-test has also been conducted to check, whether there is a difference
between the two population means.</p>
      <p>Ho: There is no difference between the mean values of the two given sensors.</p>
      <p>H1: There is difference between the mean values of the two given sensors.
P-value of this test is 83.16%, thus we cannot reject the null hypothesis.</p>
      <p>Moreover, it has been tested if there is a significant difference among the mean
value, the maximum value and the minimum value of each day, between the two
sensors. Besides current temperature value, it is crucial to take valid values for mean,
maximum and minimum value of each day. P-value for each test is presented in table
2.</p>
      <p>Therefore, there is no significant difference between the mean values of the two
sensors. In figure 2 mean, maximum and minimum values per day of BMP180 and
mcp9808 sensors are shown.</p>
      <p>Finally, in the below box plots (figure 3), median and quartiles of temperature
values for each sensor per day are shown. We can see that the degree of dispersion is
almost the same for each sensor.
3.2 MCP9808 and DHT22</p>
      <p>Initially, the correlation between the temperature values of the mcp9808 sensor
and the DHT22 sensor is going to be tested. Regression between all paired values of
mcp9808 and DHT22 sensors are shown in figure 4. Moreover, pvalue of the
regression is equal to 0.000%, thus we can reject the null hypothesis that the
coefficient is equal to zero, which means that there is a significant effect between the
values of two sensors. Additionally, the standard error of estimation has been
computed and found to be equal to 1.034. Residuals, which describe the difference
between the data and the line, are also shown in figure 4. The line that best fits the
data is given by the equation 3.</p>
      <p>
        y = 0.9642x − 2.366 (
        <xref ref-type="bibr" rid="ref3">3</xref>
        )
      </p>
      <p>A two-sided t-test has also been conducted to check, whether there is a difference
between the two population means.</p>
      <p>Ho: There is no difference between the mean values of the two given sensors.</p>
      <p>H1: There is difference between the mean values of the two given sensors.</p>
      <p>P-value of this test is 0.000%, thus we reject the null hypothesis, which means that
there is a significant difference between the means of temperature values of the two
sensors.</p>
      <p>The difference between the two sensors is examined further by taking the
difference between each pair and then computing the mean and the standard
deviation of all those differences. The mean of the differences of the paired values
(DHT22 - mcp9808) equals to 2.83 and the standard deviation equals to 1.053. A
chisquared test was conducted to test whether the differences of paired values follow a
normal distribution. Interpreting test results, we can assume that pvalue = 0.000%,
therefore Ho is rejected, as the set of differences are not normally distributed. The
kurtosis of the distribution of the values is equal to 9 and it is leptokurtic, as can be
seen in figure 5.</p>
      <p>In figure 6 (a) mean, maximum and minimum values per day of mcp9808 and
DHT22 sensors are shown. It is obvious that DHT22 sensor returns greater values
than mcp9808. This can also be seen in figure 6 (b), in which the box plots of
temperature values are plotted.
3.3</p>
      <p>BMP180 and DHT22</p>
      <p>Similarly, to the previous sections, the regression line between the temperature
values of the BMP180 and DHT22 sensors is y = x - 2.926 with pvalue = 0.000% and a
standard error estimation equal to 0.375 (fig 7). Moreover, the t-test has shown that
the values of the two sensors have different average values. It was calculated that the
differences of paired values returned by the two sensors follow a normal distribution
with mean value equal to 2.921 and a standard deviation equal to 0.375.</p>
      <p>Fig 7. Regression line and residuals for temperature values of BMP180 and DHT22 sensors.
3.4</p>
      <sec id="sec-2-1">
        <title>Comparison with a typical mercury thermometer</title>
        <p>In this section, a comparison among real temperature and temperature computed
by BMP180, mcp9808 and DHT22 will be done. Real temperature has been
recorded, using a camera module v2, connected to raspberry pi 3, to take pictures of
the mercury thermometer every 30 minutes.</p>
        <p>To determine whether the distribution of the BMP180, mcp9808 and DHT22
sensor values is statistically identical to the distribution of actual values, a series of
appropriate tests were conducted for each day separately. In cases where the sensor
values follow a normal distribution, an Oneway ANOVA test was conducted,
otherwise a Kruskal-Wallis H-test was carried out when the sensor values were not
normally distributed.</p>
        <p>The test results showed that the BMP180 sensor returns values whose distribution
more closely approximates the distribution of the actual values compared with the
values returned by the mcp9808 sensor. Moreover, the distribution of the DHT22
sensor values less closely approximates the distribution of a typical mercury
thermometer compared with sensors BMP180 and mcp 9808.</p>
        <p>In the below box plots (figure 8), median and quartiles of temperature values for
each sensor compared with data from a typical mercury thermometer per day are
shown.</p>
        <p>Furthermore, a regression analysis for each sensor values was conducted to find
the correlation with the temperature from the mercury thermometer (figure 9).
Mercury
BMP</p>
      </sec>
      <sec id="sec-2-2">
        <title>Comparison with the data of the Hellenic National Metereological Service</title>
        <p>Finally, a comparison was made among the values published on the website of the
Hellenic National Meteorological Service (HNMS). Observed values were counted
over a period of 17 days at a rate of one value every three hours. The average and the
standard deviation of the differences of paired values are shown in Table 4. Finally,
for each sensor, a regression was made, whose data are shown in Table 5 and results
in Figure 10.</p>
        <p>H.N.M.S. - BMP
H.N.M.S. - mcp
H.N.M.S. - DHT</p>
        <p>Mean
0.173
1.218
Fig 10. Regression lines for each sensor values and H.N.M.S. Data</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>4 Discussion</title>
      <p>The analysis presented is an effort to estimate the accuracy of three low cost
commercial temperature sensors when compared to a typical mercury thermometer
and H.N.M.S data. Although temperature measurement accuracy is not of great
importance for agriculture and forestry usage (meaning that normally a difference of
0.5 or 1 degree Celsius does not have a measurable effect on crops or forests), its
measurement is of great importance when we try to determine the quality of the
sensors and select the best.</p>
      <p>All the aforementioned sensors were installed on the same location and data were
gathered using PYTHON code and stored to a local MySQL database.</p>
      <p>From the extensive statistical analysis, it was found that the sensor which presents
the most accurate readings and therefore it is suggested for usage is the BMP180
sensor array which provides a standard error of estimation of 1,3 degrees Celsius
when compared to data from H.N.M.S. Thus it can be used for any type of
application that requires temperature accuracy of 1,3 degrees from the real H.N.M.S
measurements.</p>
      <p>The accuracy of the sensor might be proved to be even higher if we could use
H.N.M.S. data from a station located in the same area as the sensor. However, the
closest H.N.M.S. station to our sensors was located in Doxato approximately 11 Km
away, at an altitude of 86.91 meters, thus the temperature data might vary.</p>
      <p>In the future, testing could also be performed in a controlled environment in order
to determine the sensors accuracy near the end of the measurement scale.</p>
      <p>Finally, there is also the capability to use a constant inside the PYTHON code in
order to correct the differences between measurements from sensors and H.N.M.S.
Acknowledgments. The AgroComp Project is funded by the Eastern Macedonia and
Thrace Institute of Technology in the framework of Stavros Niarchos Foundation
Fellowships.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Jane</surname>
            <given-names>K.</given-names>
          </string-name>
          <string-name>
            <surname>Hart</surname>
          </string-name>
          , Kirk Martinez,
          <article-title>Environmental Sensor Networks: A revolution in the earth system science?</article-title>
          ,
          <string-name>
            <surname>Earth-Science</surname>
            <given-names>Reviews</given-names>
          </string-name>
          , Volume
          <volume>78</volume>
          ,
          <string-name>
            <surname>Issues</surname>
          </string-name>
          3-4,
          <year>October 2006</year>
          , Pages
          <fpage>177</fpage>
          -
          <lpage>191</lpage>
          , ISSN 0012-8252.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>A.</given-names>
            <surname>Zerger</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.A.</given-names>
            <surname>Viscarra Rossel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.L.</given-names>
            <surname>Swain</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Wark</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.N.</given-names>
            <surname>Handcock</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.A.J.</given-names>
            <surname>Doerr</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.J.</given-names>
            <surname>Bishop-Hurley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.D.</given-names>
            <surname>Doerr</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.G.</given-names>
            <surname>Gibbons</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Lobsey</surname>
          </string-name>
          ,
          <article-title>Environmental sensor networks for vegetation, animal and soil sciences</article-title>
          ,
          <source>International Journal of Applied Earth Observation and Geoinformation</source>
          , Volume
          <volume>12</volume>
          ,
          <string-name>
            <surname>Issue</surname>
            <given-names>5</given-names>
          </string-name>
          ,
          <year>October 2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Rettig</surname>
            ,
            <given-names>J. Andrew.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sumit</surname>
            <given-names>Khanna</given-names>
          </string-name>
          , Richard A. Beck,
          <article-title>Open source REST services for environmental sensor networking</article-title>
          ,
          <source>Applied Geography</source>
          , Volume
          <volume>60</volume>
          ,
          <string-name>
            <surname>June</surname>
            <given-names>2015</given-names>
          </string-name>
          , Pages
          <fpage>294</fpage>
          -
          <lpage>300</lpage>
          , ISSN 0143-6228.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Zaimes</surname>
            ,
            <given-names>G.N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ioannou</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Iakovoglou</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kosmadakis</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Koutalakis</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ranis</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Emmanouloudis</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schultz</surname>
          </string-name>
          , R.C.
          <article-title>Improving soil erosion prevention in Greece with new tools (2016) Journal of Engineering Science</article-title>
          and Technology Review,
          <volume>9</volume>
          (
          <issue>2</issue>
          ), pp.
          <fpage>66</fpage>
          -
          <lpage>71</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Kosmadakis</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tsardaklis</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ioannou</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zaimes</surname>
            ,
            <given-names>G.N.</given-names>
          </string-name>
          <article-title>A novel fully automated soil erosion monitoring system (</article-title>
          <year>2015</year>
          ) CEUR Workshop Proceedings,
          <volume>1498</volume>
          , pp.
          <fpage>80</fpage>
          -
          <lpage>84</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Ioannou</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          <article-title>On the design of environmental protection networks (2013) Agris On-line Papers in Economics</article-title>
          and Informatics,
          <volume>5</volume>
          (
          <issue>4</issue>
          ), pp.
          <fpage>105</fpage>
          -
          <lpage>113</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Ioannou</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          <article-title>Development of a pilot soil erosion measuring system in the area of the sub urban forest of Thessaloniki (</article-title>
          <year>2012</year>
          ) Aristotle University of Thessaloniki, Post-Doctoral Scholarship for Excellence.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>