<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing with OASIS Tables v3.0 20080202//EN" "journalpub-oasis3.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:oasis="http://docs.oasis-open.org/ns/oasis-exchange/table" dtd-version="3.0">
  <front>
    <journal-meta>
<journal-id journal-id-type="publisher">DWES</journal-id>
<journal-title-group>
<journal-title>Drinking Water Engineering and Science</journal-title>
<abbrev-journal-title abbrev-type="publisher">DWES</abbrev-journal-title>
<abbrev-journal-title abbrev-type="nlm-ta">Drink. Water Eng. Sci.</abbrev-journal-title>
</journal-title-group>
<issn pub-type="epub">1996-9465</issn>
<publisher><publisher-name>Copernicus Publications</publisher-name>
<publisher-loc>Göttingen, Germany</publisher-loc>
</publisher>
</journal-meta>

    <article-meta>
      <article-id pub-id-type="doi">10.5194/dwes-9-37-2016</article-id><title-group><article-title>Application of machine learning for real-time evaluation of salinity (or
TDS) in drinking water using photonic sensors</article-title>
      </title-group><?xmltex \runningtitle{Application of machine learning for real-time evaluation of salinity}?><?xmltex \runningauthor{S.~K.~Roy and P.~Sharan}?>
      <contrib-group>
        <contrib contrib-type="author" corresp="yes" rid="aff1">
          <name><surname>Roy</surname><given-names>Sandip Kumar</given-names></name>
          <email>sandipr@hotmail.com</email>
        </contrib>
        <contrib contrib-type="author" corresp="no" rid="aff2">
          <name><surname>Sharan</surname><given-names>Preeta</given-names></name>
          
        </contrib>
        <aff id="aff1"><label>1</label><institution>Department of ECE, AMET University, Chennai, 603112, India</institution>
        </aff>
        <aff id="aff2"><label>2</label><institution>Department of ECE, Bangalore, 560068, India</institution>
        </aff>
      </contrib-group>
      <author-notes><corresp id="corr1">Sandip Kumar Roy (sandipr@hotmail.com)</corresp></author-notes><pub-date><day>26</day><month>September</month><year>2016</year></pub-date>
      
      <volume>9</volume>
      <issue>2</issue>
      <fpage>37</fpage><lpage>45</lpage>
      <history>
        <date date-type="received"><day>2</day><month>May</month><year>2016</year></date>
           <date date-type="rev-request"><day>13</day><month>June</month><year>2016</year></date>
           <date date-type="rev-recd"><day>12</day><month>September</month><year>2016</year></date>
           <date date-type="accepted"><day>12</day><month>September</month><year>2016</year></date>
      </history>
      <permissions>
<license license-type="open-access">
<license-p>This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit <ext-link ext-link-type="uri" xlink:href="http://creativecommons.org/licenses/by/3.0/">http://creativecommons.org/licenses/by/3.0/</ext-link></license-p>
</license>
</permissions><self-uri xlink:href="https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016.html">This article is available from https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016.html</self-uri>
<self-uri xlink:href="https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016.pdf">The full text article is available as a PDF file from https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016.pdf</self-uri>


      <abstract>
    <p>The world is facing an unprecedented problem in safeguarding 0.4 % of
potable water, which is gradually depleting day-by-day. From a literature
survey it has been observed that the refractive index (RI) of water changes
with a change in salinity or total dissolved solids (TDS). In this paper we
have proposed an automatic system that can be used for real-time evaluation
of salinity or TDS in drinking water. A photonic crystal (PhC) based ring
resonator sensor has been designed and simulated using the MEEP (MIT
Electromagnetic Equation Propagation) tool and the finite difference time
domain (FDTD) algorithm. The modelled and designed sensor is highly sensitive
to the changes in the RI of a water sample. This work includes a
real-time-based natural sequence follower, which is a machine learning
algorithm of the naive Bayesian type, a sequence of statistical algorithms
implemented in MATLAB with reference to training data to analyse the sample
water. Further interfacing has been done using the Raspberry Pi device to
provide an easy display to show the result of water analysis. The main
advantage of the designed sensor with an interface is to check whether the
salinity or TDS in drinking water is less than 1000 ppm or not. If it is
greater than or equal to 2000 ppm, the display shows “High Salinity/TDS
Observed”, and if ppm are less than or equal to 1000 ppm, then the display
shows “Low salinity/TDS Observed”. The proposed sensor is highly sensitive
and it can detect changes in TDS level because of the influence of any
dissolved substance in water.</p>
  </abstract>
    </article-meta>
  </front>
<body>
      

<sec id="Ch1.S1" sec-type="intro">
  <title>Introduction</title>
      <p>Drinking water (or potable water) is considered to be safe enough to consume
by humans or to use for domestic and medical purposes with a low risk of
immediate or long-term harm. In most countries, the salinity of drinking
water is restricted to less than 1000 ppm. Salinity is the measure of
concentration of salts in water. Greater concentration of salts in water not
only affects the taste of the water, but also causes health hazards. TDS
include inorganic salts and organic matter dissolved in water, and a TDS
level between 300 and 600 mg L<inline-formula><mml:math display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> is considered to be good (Fawell et
al., 1996). Hence there is a necessity for evaluation of water before it is
allowed to be consumed (Walker and Newman, 2011). TDS are water quality
parameters which can be measured by water purity measuring devices.</p>
      <p>There are several methods of measurement used for drinking water; however, we
have studied the following methods for measuring water purity.</p>
<sec id="Ch1.S1.SS1">
  <title>Electrical conductivity (EC) method for measurement of TDS in
water</title>
      <p>The electrical conductivity method is basically used in conventional TDS
measurement devices. In this type of TDS meter, voltage is applied between
two or more electrodes. Positively charged ions like sodium (Na<inline-formula><mml:math display="inline"><mml:mrow><mml:msup><mml:mi/><mml:mo>+</mml:mo></mml:msup><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>,
calcium (Ca<inline-formula><mml:math display="inline"><mml:mrow><mml:msup><mml:mi/><mml:mrow><mml:mo>+</mml:mo><mml:mo>+</mml:mo></mml:mrow></mml:msup><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, and magnesium (Mg<inline-formula><mml:math display="inline"><mml:mrow><mml:msup><mml:mi/><mml:mrow><mml:mo>+</mml:mo><mml:mo>+</mml:mo></mml:mrow></mml:msup><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> will get attracted towards the
negatively charged electrode. Negatively charged ions like chloride
(Cl<inline-formula><mml:math display="inline"><mml:mrow><mml:msup><mml:mi/><mml:mo>-</mml:mo></mml:msup><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, sulfate (SO<inline-formula><mml:math display="inline"><mml:mrow><mml:msubsup><mml:mi/><mml:mn mathvariant="normal">4</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mo>-</mml:mo></mml:mrow></mml:msubsup><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, and bicarbonate (HCO<inline-formula><mml:math display="inline"><mml:mrow><mml:msubsup><mml:mi/><mml:mn mathvariant="normal">3</mml:mn><mml:mo>-</mml:mo></mml:msubsup><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> will get
attracted towards the positively charged electrode. A moving charge produces
an electrical current. Neutral molecules remain unaffected by the electrical
attraction of the electrodes. The meter then measures the generated current.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F1"><caption><p>Anions (green) with a negative charge get attracted toward the
positively charged electrode; cations (red) with a positive charge get
attracted toward the negatively charged electrode. Neutral molecules (blue)
remain without any electrical influence.</p></caption>
          <?xmltex \igopts{width=241.848425pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016-f01.png"/>

        </fig>

      <p>The measured current is a function of the following constituents of water
under investigation.
<list list-type="bullet"><list-item>
      <p>Quantity and types of ions actually present in the sample water</p></list-item><list-item>
      <p>Ions with higher charges tend to have higher conductivity.</p></list-item><list-item>
      <p>Larger ions will have lower conductivity as because of their size they will
have a “drag” effect.</p></list-item><list-item>
      <p>Conductivity of ions in water depends upon temperature.</p></list-item></list></p>
      <p>TDS meters internally convert the measured current into parts per million
(ppm). Such devices, however, have limitations as detailed below.
<list list-type="bullet"><list-item>
      <p>Because most of the devices used the conductivity method, these devices do not
measure all dissolved solids like sugar, alcohol, organic contents, silica,
ammonia, carbon dioxide, iron oxide, dissolved bacteria and viruses.</p></list-item><list-item>
      <p>Different units of measurement used even though all are referred to as ppm
(parts per million).</p></list-item><list-item>
      <p>The meters come with a factory calibration; sometimes it may require
calibrating the meter using a standard solution.</p></list-item><list-item>
      <p>Using a TDS meter (pen type) is specific to one type of dissolved solid
solution and must not be transferred from one type of dissolved solid
solution or sample to the next, as this may result in some serious errors.
This is because TDS meters are calibrated by correlating the conductivity of
the solution with the ppm of dissolved solids, and this correlation varies
considerably from one species of dissolved solid to the other.</p></list-item><list-item>
      <p>When the TDS meters are not carefully calibrated, it is not clear whether
they refer to the ppm of sodium chloride equivalents, or to something else,
maybe potassium chloride (KCl).</p></list-item><list-item>
      <p>In order to compensate for temperature effect, ATC (automatic temperature
compensation) is required to be part of the device to provide a value that is
“corrected” at a standard temperature (25 <inline-formula><mml:math display="inline"><mml:msup><mml:mi/><mml:mo>∘</mml:mo></mml:msup></mml:math></inline-formula>C).</p></list-item></list></p>
</sec>
</sec>
<sec id="Ch1.S2">
  <title>Optical refractive index method</title>
      <p>Light passing through water tends to bend at a particular angle, depending on
the effective RI of water due to dissolved elements. Thus a method of liquid
refractometry is useful in the detection of the variation in the salinity/TDS
of water. The proposed device in this work is based on the detection of
variation of the effective RI of water because of the TDS. In subsequent
sections we have detailed the working of the proposed device. The following
are the advantages of the PhC sensor-based device presented in the current
work.
<list list-type="bullet"><list-item>
      <p>Immune to electromagnetic interferences as the measurement is based on RI
change, not on electrical conductivity</p></list-item><list-item>
      <p>Higher sensitivity, compact sized sensing unit (nearly size of a coin),
higher safety in hazardous environments</p></list-item><list-item>
      <p>The possibility of processing the signal at large distances from the sensor
with little degradation</p></list-item><list-item>
      <p>A non-invasive method used resulted in no material influence on the sample water
as no probe was inserted into the water.</p></list-item><list-item>
      <p>Requires simple circuitry and highly accurate methods of sensing.</p></list-item><list-item>
      <p>The inorganic compound NaCl or KCl can be differentiated on the basis of
the respective indices.</p></list-item></list></p>
      <p>The sensing element of the proposed sensor is designed using PhCs. PhCs are
periodic structures and consist of a band gap that restricts the propagation
of the specific frequency range of light. This property enables one to
control light and produce effects that are impossible with conventional
optics.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F2"><caption><p>Evaluation of salinity/TDS in water.</p></caption>
        <?xmltex \igopts{width=241.848425pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016-f02.png"/>

      </fig>

</sec>
<sec id="Ch1.S3">
  <title>pH sensing method</title>
      <p>From the literature survey it has been observed that pH sensors are
electrochemical devices used for the detection of hydrogen ions. The pH
factor is used to measure the acidity or alkalinity of water. The pH value is
determined by the combination of all the acids and bases present, but this is
also influenced by the buffering capacity of the water and temperature. The
main limitation of this method is that pH change due to a particular
acid/base cannot be measured. This method is less suited for detection of
general water quality. There are several other methods of study like
CaCo<inline-formula><mml:math display="inline"><mml:msub><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msub></mml:math></inline-formula>, CEC and SAR. The Co<inline-formula><mml:math display="inline"><mml:msub><mml:mi/><mml:mn mathvariant="normal">3</mml:mn></mml:msub></mml:math></inline-formula> of water is evaluated in conjunction
with bicarbonates for several important evaluations such as alkalinity, the
sodium adsorption ratio (SAR) (Hossain et al., 2016), adjusted sodium
adsorption ratio (SAR adj.), and residual sodium carbonate (RSC). Carbonates
will not be a significant component of water at a pH below 8.0, and will
likely dominate at a pH above 10.3.</p>
</sec>
<sec id="Ch1.S4">
  <title>Theory</title>
<sec id="Ch1.S4.SS1">
  <title>Light propagation in PhC</title>
      <p>EM propagation through a medium is dependent on the permittivity of the
medium. It is furthermore dependent on the RI of the material. As the RI
changes, the permittivity changes; as a result, the EM propagation also gets
impacted.</p>
      <p>The propagation of light in the PhC (sensing element) is described by
Maxwell's electromagnetic (EM) equations as given below:

                <disp-formula specific-use="align" content-type="numbered"><mml:math display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="Ch1.E1"><mml:mtd/><mml:mtd/><mml:mtd><mml:mrow><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>×</mml:mo><mml:mi>E</mml:mi><mml:mfenced open="(" close=")"><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi></mml:mfenced><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mi mathvariant="italic">μ</mml:mi><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>)</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>H</mml:mi><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E2"><mml:mtd/><mml:mtd/><mml:mtd><mml:mrow><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>×</mml:mo><mml:mi>H</mml:mi><mml:mfenced open="(" close=")"><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi></mml:mfenced><mml:mo>=</mml:mo><mml:mi mathvariant="italic">σ</mml:mi><mml:mfenced open="(" close=")"><mml:mi>r</mml:mi></mml:mfenced><mml:mi>E</mml:mi><mml:mfenced open="(" close=")"><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi></mml:mfenced><mml:mo>+</mml:mo><mml:mi mathvariant="italic">ϵ</mml:mi><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>)</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>E</mml:mi><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E3"><mml:mtd/><mml:mtd/><mml:mtd><mml:mrow><mml:mi mathvariant="normal">∇</mml:mi><mml:mi>E</mml:mi><mml:mfenced open="(" close=")"><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi></mml:mfenced><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="italic">ρ</mml:mi><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mi mathvariant="italic">ϵ</mml:mi><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E4"><mml:mtd/><mml:mtd/><mml:mtd><mml:mrow><mml:mi mathvariant="normal">∇</mml:mi><mml:mi>H</mml:mi><mml:mfenced close=")" open="("><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi></mml:mfenced><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            where <inline-formula><mml:math display="inline"><mml:mrow><mml:mi>E</mml:mi><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the time-varying electric field, <inline-formula><mml:math display="inline"><mml:mrow><mml:mi>H</mml:mi><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the
time-varying magnetic field, <inline-formula><mml:math display="inline"><mml:mrow><mml:mi mathvariant="italic">ϵ</mml:mi><mml:mfenced close=")" open="("><mml:mi>r</mml:mi></mml:mfenced></mml:mrow></mml:math></inline-formula> is the permittivity,
<inline-formula><mml:math display="inline"><mml:mrow><mml:mi mathvariant="italic">μ</mml:mi><mml:mfenced close=")" open="("><mml:mi>r</mml:mi></mml:mfenced></mml:mrow></mml:math></inline-formula> is the permeability, and <inline-formula><mml:math display="inline"><mml:mrow><mml:mi mathvariant="italic">σ</mml:mi><mml:mfenced open="(" close=")"><mml:mi>r</mml:mi></mml:mfenced></mml:mrow></mml:math></inline-formula> is
the conductivity of the medium. Considering the propagation of an EM wave in
any medium, the equations in the Cartesian co-ordinate system for electric
and magnetic fields are given by

                <disp-formula specific-use="align" content-type="numbered"><mml:math display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="Ch1.E5"><mml:mtd/><mml:mtd/><mml:mtd><mml:mrow><mml:mi>E</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>E</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover><mml:mo>+</mml:mo><mml:msub><mml:mi>E</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mover accent="true"><mml:mi>y</mml:mi><mml:mo stretchy="false" mathvariant="normal">^</mml:mo></mml:mover><mml:mo>+</mml:mo><mml:msub><mml:mi>E</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mover accent="true"><mml:mi>z</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E6"><mml:mtd/><mml:mtd/><mml:mtd><mml:mrow><mml:mi>H</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>H</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mover accent="true"><mml:mi>x</mml:mi><mml:mo stretchy="false" mathvariant="normal">^</mml:mo></mml:mover><mml:mo>+</mml:mo><mml:msub><mml:mi>H</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mover accent="true"><mml:mi>y</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover><mml:mo>+</mml:mo><mml:msub><mml:mi>H</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mover accent="true"><mml:mi>z</mml:mi><mml:mo stretchy="false" mathvariant="normal">^</mml:mo></mml:mover><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            The Bloch–Floquet theorem states that an EM wave propagating in a varying
dielectric structure is modulated by the periodicity of the structure. The
periodic variation is given by
            <disp-formula id="Ch1.E7" content-type="numbered"><mml:math display="block"><mml:mrow><mml:mi mathvariant="italic">ϵ</mml:mi><mml:mfenced close=")" open="("><mml:mi>r</mml:mi><mml:mo>+</mml:mo><mml:mi>p</mml:mi></mml:mfenced><mml:mo>=</mml:mo><mml:mi mathvariant="italic">ϵ</mml:mi><mml:mfenced close=")" open="("><mml:mi>r</mml:mi></mml:mfenced><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula> is the period of the crystal. The EM field is given by
            <disp-formula id="Ch1.E8" content-type="numbered"><mml:math display="block"><mml:mrow><mml:mi mathvariant="normal">Ψ</mml:mi><mml:mfenced open="(" close=")"><mml:mi>r</mml:mi><mml:mo>+</mml:mo><mml:mi>p</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi></mml:mfenced><mml:mo>=</mml:mo><mml:mi mathvariant="normal">Ψ</mml:mi><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:msup><mml:mi>e</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mi>i</mml:mi><mml:mi>k</mml:mi><mml:mo>,</mml:mo><mml:mi>p</mml:mi></mml:mrow></mml:msup><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math display="inline"><mml:mrow><mml:mi mathvariant="normal">Ψ</mml:mi><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the electric or magnetic field. <inline-formula><mml:math display="inline"><mml:mi>K</mml:mi></mml:math></inline-formula> is the propagation
constant and <inline-formula><mml:math display="inline"><mml:mi>a</mml:mi></mml:math></inline-formula> is the period of a crystal.</p>
      <p>The proposed sensor uses the FDTD (finite difference time domain) algorithm,
which solves Maxwell's EM equations (Yee, 1996). For the proposed structure,
a Gaussian pulse is used as a source and the fields are updated at each point
of the Yee grid according to the finite difference Maxwell curl equations,
and the obtained output samples are normalized with respect to the input
signal.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F3"><caption><p>Design of the two-dimensional PhC line defect.</p></caption>
          <?xmltex \igopts{width=241.848425pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016-f03.png"/>

        </fig>

      <?xmltex \floatpos{t}?><fig id="Ch1.F4" specific-use="star"><caption><p>Salinity vs. RI of water. The figure shows variation of the RI with
a change in the salinity of water. </p></caption>
          <?xmltex \igopts{width=369.885827pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016-f04.png"/>

        </fig>

<?xmltex \floatpos{t}?><table-wrap id="Ch1.T1"><caption><p>Different types of sensors and target substances for detection.</p></caption><oasis:table frame="topbot"><oasis:tgroup cols="2">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="left"/>
     <oasis:thead>
       <oasis:row rowsep="1">  
         <oasis:entry colname="col1">Sensor type</oasis:entry>  
         <oasis:entry colname="col2">Target substance</oasis:entry>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>  
         <oasis:entry colname="col1">pH</oasis:entry>  
         <oasis:entry colname="col2">Acids and  bases</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">Oxidation reduction potential (ORP)</oasis:entry>  
         <oasis:entry colname="col2">Redox active species</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">Electrical conductivity (EC)</oasis:entry>  
         <oasis:entry colname="col2">Salts (TDS)</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">Turbidity</oasis:entry>  
         <oasis:entry colname="col2">Particles</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">UV/Vis absorption</oasis:entry>  
         <oasis:entry colname="col2">Aromatic substances</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">Photonic sensor</oasis:entry>  
         <oasis:entry colname="col2">All substances</oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup></oasis:table></table-wrap>

<?xmltex \floatpos{t}?><table-wrap id="Ch1.T2"><caption><p>Shows variation of RI with % of salinity of water.</p></caption><oasis:table frame="topbot"><oasis:tgroup cols="2">
     <oasis:colspec colnum="1" colname="col1" align="right"/>
     <oasis:colspec colnum="2" colname="col2" align="right"/>
     <oasis:thead>
       <oasis:row>  
         <oasis:entry colname="col1">Salinity of water</oasis:entry>  
         <oasis:entry colname="col2">RI of water</oasis:entry>
       </oasis:row>
       <oasis:row rowsep="1">  
         <oasis:entry colname="col1">sample (%)</oasis:entry>  
         <oasis:entry colname="col2"/>
       </oasis:row>
     </oasis:thead>
     <oasis:tbody>
       <oasis:row>  
         <oasis:entry colname="col1">0.01</oasis:entry>  
         <oasis:entry colname="col2">1.329701796</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">0.05</oasis:entry>  
         <oasis:entry colname="col2">1.329701806</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">0.1</oasis:entry>  
         <oasis:entry colname="col2">1.329701818</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">0.2</oasis:entry>  
         <oasis:entry colname="col2">1.329701843</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">0.5</oasis:entry>  
         <oasis:entry colname="col2">1.329701918</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">0.75</oasis:entry>  
         <oasis:entry colname="col2">1.329701981</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">2.5</oasis:entry>  
         <oasis:entry colname="col2">1.329702418</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">3.5</oasis:entry>  
         <oasis:entry colname="col2">1.329702668</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">10</oasis:entry>  
         <oasis:entry colname="col2">1.329704293</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">20</oasis:entry>  
         <oasis:entry colname="col2">1.329706793</oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1">30</oasis:entry>  
         <oasis:entry colname="col2">1.329709293</oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup></oasis:table></table-wrap>

      <?xmltex \floatpos{p}?><fig id="Ch1.F5" specific-use="star"><caption><p>Transmitted spectrum for (a) 500 ppm saline water, (b) 52000 ppm
saline water, and (c) 35 000 ppm saline water. The above figures depict
transmission spectra with distinct shifts in peak frequencies for different
salinities. In (a) a nascent curve of the transmission spectrum until
20 % of the outcome is exited immediately, with a dip being followed.
These curves indicate that the light intensity drops abruptly around 25 %
of the frequency range of the input light wave. These lines of frequency
again tend to achieve maxima and do so at exactly 50 % of the frequency
spectrum. This is an indication of the highest possible absorption of the
intensity of an input light wave that may be a cause of polarization in the
vicinity of the waveguide of the proposed structure. This velocity of
intensity increase will again tend to become sluggish and abruptly embraces
an exponential decay, for which the trapping of light in the waveguide begins
to throw off a certain frequency of harmonic wave that tends to create a
disruptive interference of the travelling pulse of Gaussian mode. In (b) we
can observe that the salinity of water, being an analyte as compared against
(a), is increased in concentration by 300 %. Here the entire spectrum is
exactly the reciprocal of (a) in that the dip has happened in the first phase
of the frequency shift, while here the same has happened in the second. Also,
as against (a), the light intensity abruptly decreases before the center of
the frequency spectrum is achieved. Thereby the absorption and reflection
that have taken place before the identification of light intensity at the
output become noticeable; only after the frequency of the spectra are over
the central frequency of operation will the light intensity become noticeable
twice. The curve remains nascent for around 30 % of the applied frequency
and vigorously excites until 60 %. This excitement is immediately damped
with a scattering time of under 0.5 units of intensity and remains nascent
throughout. This signature curve of the transmission spectrum is incorporated
into the database of the application.</p></caption>
          <?xmltex \igopts{width=483.69685pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016-f05.png"/>

        </fig>

      <?xmltex \floatpos{t}?><fig id="Ch1.F6"><caption><p>Transmitted spectrum for water with various salinity levels. The
figure shows the overlapping of all the previous spectra to highlight the
shift in the frequency and amplitude.</p></caption>
          <?xmltex \igopts{width=241.848425pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016-f06.png"/>

        </fig>

      <?xmltex \floatpos{t}?><fig id="Ch1.F7" specific-use="star"><caption><p>Workflow of the developed system.</p></caption>
          <?xmltex \igopts{width=341.433071pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016-f07.png"/>

        </fig>

      <?xmltex \floatpos{t}?><fig id="Ch1.F8" specific-use="star"><caption><p><bold>(a)</bold> Integrated device display with Raspberry Pi (red
circle), <bold>(b)</bold> the 2000 ppm salinity result (yellow circle), and
<bold>(c)</bold> the 1000 ppm salinity water result (blue circle).</p></caption>
          <?xmltex \igopts{width=455.244094pt}?><graphic xlink:href="https://dwes.copernicus.org/articles/9/37/2016/dwes-9-37-2016-f08.png"/>

        </fig>

      <p>In a PhC, RI is periodically modulated where periodicity is in the order of
wavelength. PhCs are periodic structures of dielectric material which allow
the propagation of a certain frequency range of light (Joannopoulos et al.,
1995, 1997) and stop others (forbidden band gap). This unique behaviour of a
PhC is used to control the propagation of light (Meade et al., 1992). The
deviation of light in a lattice structure can be controlled by defect
engineering. The following Eq. (1) explains the movement of light in a PhC by
solving Maxwell's electromagnetic equation.
            <disp-formula id="Ch1.E9" content-type="numbered"><mml:math display="block"><mml:mrow><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>×</mml:mo><mml:mfenced close=")" open="("><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">1</mml:mn><mml:mi mathvariant="italic">ϵ</mml:mi></mml:mfrac></mml:mstyle><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>×</mml:mo><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>H</mml:mi></mml:mfenced><mml:mo>=</mml:mo><mml:msup><mml:mfenced close=")" open="("><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mi mathvariant="italic">ω</mml:mi><mml:mi>C</mml:mi></mml:mfrac></mml:mstyle></mml:mfenced><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mi>H</mml:mi></mml:mrow></mml:math></disp-formula>
          <inline-formula><mml:math display="inline"><mml:mi>H</mml:mi></mml:math></inline-formula> – the photon's magnetic field; <inline-formula><mml:math display="inline"><mml:mi mathvariant="italic">ϵ</mml:mi></mml:math></inline-formula> – permittivity; <inline-formula><mml:math display="inline"><mml:mi>C</mml:mi></mml:math></inline-formula> – speed
of light; and <inline-formula><mml:math display="inline"><mml:mi mathvariant="italic">ω</mml:mi></mml:math></inline-formula> – angular frequency.
            <disp-formula id="Ch1.E10" content-type="numbered"><mml:math display="block"><mml:mrow><mml:mi mathvariant="italic">ϵ</mml:mi><mml:mo>=</mml:mo><mml:msup><mml:mi>n</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:math></disp-formula>
          <inline-formula><mml:math display="inline"><mml:mi>n</mml:mi></mml:math></inline-formula> – refractive index</p>
      <p>As in Eq. (9), the permittivity of a medium (<inline-formula><mml:math display="inline"><mml:mrow><mml:mi mathvariant="italic">ϵ</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> changes as the
angular frequency of resonance (<inline-formula><mml:math display="inline"><mml:mrow><mml:mi mathvariant="italic">ω</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> changes. Equation (10) shows that
<inline-formula><mml:math display="inline"><mml:mi mathvariant="italic">ϵ</mml:mi></mml:math></inline-formula> is dependent on RI and is the basis for using PhC as a sensor
(Liu and Salemink, 2012). Methods like the photonic band gap method, the
effective RI method, spectroscopy, and optical imaging are available (Fan et
al., 2008). Since input variations are significantly low, the sensitivity of
these methods is less (Nguyen et al., 2011).</p>
      <p>The design and simulation of sensors is done by the MEEP tool. This is a FDTD
simulation software to model electromagnetic systems. To compute transmission
flux at each frequency “<inline-formula><mml:math display="inline"><mml:mi mathvariant="italic">ω</mml:mi></mml:math></inline-formula>”, sampling of a continuous
electromagnetic field in a finite volume of space is done and is determined
by Eq. (11).
            <disp-formula id="Ch1.E11" content-type="numbered"><mml:math display="block"><mml:mrow><mml:mi>P</mml:mi><mml:mfenced close=")" open="("><mml:mi mathvariant="italic">ω</mml:mi></mml:mfenced><mml:mo>=</mml:mo><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mtext mathvariant="italic">Re</mml:mtext><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mtext>ń</mml:mtext><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>E</mml:mi><mml:mi mathvariant="italic">ω</mml:mi></mml:msub><mml:msup><mml:mfenced close=")" open="("><mml:mi>X</mml:mi></mml:mfenced><mml:mo>∗</mml:mo></mml:msup><mml:mo>×</mml:mo><mml:msub><mml:mi>H</mml:mi><mml:mrow><mml:mi mathvariant="italic">ω</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/></mml:mrow></mml:msub><mml:mfenced open="(" close=")"><mml:mi>X</mml:mi></mml:mfenced><mml:msup><mml:mi>d</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mi>X</mml:mi></mml:mrow></mml:math></disp-formula>
          To calculate <inline-formula><mml:math display="inline"><mml:mrow><mml:mi>P</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="italic">ω</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, the following steps are used in the MEEP tool.
<list list-type="order"><list-item>
      <p>Compute the integral of the Poynting vector <inline-formula><mml:math display="inline"><mml:mrow><mml:mi>P</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> for each time.</p></list-item><list-item>
      <p>Fourier transform the value in no. 1.</p></list-item><list-item>
      <p>Compute flux at the specified regions and frequencies.</p></list-item></list></p>
</sec>
<sec id="Ch1.S4.SS2">
  <title>Machine learning algorithm</title>
      <p>Machine learning is an automated action in which improvement is done in the
future based on learning from the past. The key element of this is to devise
learning algorithms that do the learning automatically with minimum human
actions. The algorithm in machine learning allows the developed application
to come up with its own assessment based on supplied training data (Haung et
al., 2010).</p>
      <p>The naive Bayes algorithm is a classification technique based on the Bayes
theorem with an assumption of independence among predictors (Rish, 2001). The
naive Bayes classifier assumes that the presence of a particular feature in a
class is unrelated to the presence of any other feature. Naive Bayes is known
for its simplicity that does better than other existing classification
methods. The Bayes theorem provides a way of calculating the posterior
probability <inline-formula><mml:math display="inline"><mml:mrow><mml:mi>P</mml:mi><mml:mo>(</mml:mo><mml:mi>c</mml:mi><mml:mo>|</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> from <inline-formula><mml:math display="inline"><mml:mrow><mml:mi>P</mml:mi><mml:mo>(</mml:mo><mml:mi>c</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math display="inline"><mml:mrow><mml:mi>P</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math display="inline"><mml:mrow><mml:mi>P</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>|</mml:mo><mml:mi>c</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. This is defined in
Eq. (13):

                <disp-formula specific-use="align" content-type="numbered"><mml:math display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="Ch1.E12"><mml:mtd/><mml:mtd/><mml:mtd><mml:mrow><mml:mi>P</mml:mi><mml:mfenced open="(" close=")"><mml:mi>c</mml:mi><mml:mo>|</mml:mo><mml:mi>x</mml:mi></mml:mfenced><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi>P</mml:mi><mml:mfenced close=")" open="("><mml:mi mathvariant="normal">x</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="normal">|</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">c</mml:mi></mml:mfenced><mml:mi mathvariant="normal">P</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="normal">c</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mi mathvariant="normal">P</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="normal">x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E13"><mml:mtd/><mml:mtd/><mml:mtd><mml:mrow><mml:mi>P</mml:mi><mml:mfenced open="(" close=")"><mml:mi>c</mml:mi><mml:mo>|</mml:mo><mml:mi>x</mml:mi></mml:mfenced><mml:mo>=</mml:mo><mml:mi>P</mml:mi><mml:mfenced open="(" close=")"><mml:msub><mml:mi>x</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>|</mml:mo><mml:mi>c</mml:mi></mml:mfenced><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>x</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>P</mml:mi><mml:mfenced close=")" open="("><mml:msub><mml:mi>x</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:mo>|</mml:mo><mml:mi>c</mml:mi></mml:mfenced><mml:mi>x</mml:mi><mml:mi mathvariant="normal">…</mml:mi><mml:mi>x</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>P</mml:mi><mml:mfenced close=")" open="("><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi mathvariant="normal">n</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/></mml:mrow></mml:msub><mml:mo>|</mml:mo><mml:mi>c</mml:mi></mml:mfenced><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>x</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>P</mml:mi><mml:mfenced close=")" open="("><mml:mi>c</mml:mi></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            <inline-formula><mml:math display="inline"><mml:mrow><mml:mi>P</mml:mi><mml:mo>(</mml:mo><mml:mi>c</mml:mi><mml:mo>|</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the posterior probability of a class (<inline-formula><mml:math display="inline"><mml:mi>c</mml:mi></mml:math></inline-formula>, target) given the
predictor (<inline-formula><mml:math display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula>, attributes).</p>
      <p><inline-formula><mml:math display="inline"><mml:mrow><mml:mi>P</mml:mi><mml:mo>(</mml:mo><mml:mi>c</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the prior probability of a class.</p>
      <p><inline-formula><mml:math display="inline"><mml:mrow><mml:mi>P</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>|</mml:mo><mml:mi>c</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the likelihood, which is the probability of a predictor-given
class.</p>
      <p><inline-formula><mml:math display="inline"><mml:mrow><mml:mi>P</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the prior probability of a predictor.</p>
      <p>Depending on various attributes, the algorithm based on the naive Bayes
theorem predicts the probability of different classes. This algorithm is used
to solve problems with multiple classes.</p>
</sec>
<sec id="Ch1.S4.SS3">
  <title>Methodology</title>
      <p>A Gaussian light pulse is considered as a source of simulation (Oskooi et
al., 2010). The simulated data obtained and ready reference data available
(training data) are given as input to the MATLAB program. The output results
are displayed on a LCD screen along with a voice message, using the Raspberry
Pi kit.</p>
</sec>
</sec>
<sec id="Ch1.S5">
  <title>Sensor design</title>
      <p>The objective is to design a two-dimensional PhC-based sensor (Akahane et
al., 2003) for water analysis. The refractive indices of water with different
salinity/TDS were used and simulations were carried out for the variations in
properties of the sample for each constituent (Sharan et al., 2013; Lavanya
et al., 2014). A shift in output transmitted power and frequency is observed.
Figure 3 shows PhC-based sensor design and light propagation.</p>
      <p>The design specifications are the following.
<list list-type="order"><list-item>
      <p>Rods in air configuration</p></list-item><list-item>
      <p>Lattice constant: “a” <inline-formula><mml:math display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 1</p></list-item><list-item>
      <p>Rod's radius r <inline-formula><mml:math display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 0.2 <inline-formula><mml:math display="inline"><mml:mi mathvariant="normal">µ</mml:mi></mml:math></inline-formula>m.</p></list-item><list-item>
      <p>The silicon slab's di-electric constant “<inline-formula><mml:math display="inline"><mml:mi mathvariant="italic">ϵ</mml:mi></mml:math></inline-formula>” <inline-formula><mml:math display="inline"><mml:mo>=</mml:mo></mml:math></inline-formula> 12.</p></list-item><list-item>
      <p>Di-electric constant of the sample used for simulation in place of air</p></list-item><list-item>
      <p>Light source type used, Gaussian pulse (centre frequency 0.295 and width
0.1)</p></list-item><list-item>
      <p>Wavelength of light 1350 nm</p></list-item><list-item>
      <p>Height of rods considered as infinity</p></list-item></list></p>
</sec>
<sec id="Ch1.S6">
  <title>Sensor simulation result analysis</title>
      <p>This is a generic highly sensitive optical sensor for continuous real-time
detection covering the full spectrum of possible chemical contaminants,
organics and turbidity detection. This is low cost and low maintenance
because it requires no consumables. This sensor measures RI changes in water,
using the Mach–Zehnder interferometry (MZI) principle. Any substance, when
dissolved in water, will change the RI of the water. Every substance has a
unique RI. Dissolved particles in water result in a combined RI called the
effective RI. Any substance that is dissolved in water will contribute to the
effective RI. A change in the composition of water will result in a change in
the effective RI. The proposed sensor can detect this change in RI
irrespective of the nature of contamination, whether inorganic, organic or
other. A brief comparison of the detection capability of the proposed sensor
with the conventional sensors is shown in Table 1.</p>
      <p>As can be concluded from the result in Table 2,
<list list-type="bullet"><list-item>
      <p>RI changes to the order of 10<inline-formula><mml:math display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">5</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> with change in % of salinity of
water. The salinity variation is influenced by the TDS in water. The proposed
method can detect RI change of the order of 10<inline-formula><mml:math display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">5</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>.</p></list-item><list-item>
      <p>The proposed sensor is highly sensitive and can detect variation of salinity
(TDS) in the range of 0.01 to 30% with an accuracy of 0.04%.</p></list-item></list></p>
      <p>The drinking water always contains inorganic salts, organic matter and
particles. The particles that are larger than a few micrometres in size
always give the greatest RI to the photonic sensor, while the salts that are
normally a few nanometres in size always give a much lower RI. As such, even
a trace amount of particles and organic matter in the measured water can
greatly influence the RI. This may limit the application of the PhC sensor
for measuring the TDS in drinking water. However, in the proposed PhC sensor
we have addressed this by considering the following.
<list list-type="order"><list-item>
      <p>Any substance, when dissolved in water, will change the RI of the water. The
change in RI is proportional to the concentration and the RI of the
substance. The relationship between RI and concentration is linear. This
linearity is maintained when a substance is dissolved in water containing
various elements provided that there is no chemical interaction between the
added substance and the elements already present in the initial water
solution. So even a small amount of concentration of inorganic salt will have
impacted the effective RI of the water. From the literature (Deosarkar et
al., 2012) we have found that 10 % (<inline-formula><mml:math display="inline"><mml:mrow><mml:mi>v</mml:mi><mml:mo>/</mml:mo><mml:mi>v</mml:mi></mml:mrow></mml:math></inline-formula>) ethanol and water RI is 1.332,
whereas the RI for KCl solutions in a 10 % (<inline-formula><mml:math display="inline"><mml:mrow><mml:mi>v</mml:mi><mml:mo>/</mml:mo><mml:mi>v</mml:mi></mml:mrow></mml:math></inline-formula>) ethanol and water
mixture at 303.15 K is 1.340. So there is a distinct change in RI (0.008)
because of inorganic salt KCl in the mixture.</p></list-item><list-item>
      <p>The change in RI because of KCl is of the order of 10<inline-formula><mml:math display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">3</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> and the
studied sensor has an accuracy of the order of 10<inline-formula><mml:math display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">5</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula>. Hence the PhC
sensor will be able to overcome the limitation of detection of lower
contributions in effective RI by inorganic salts.</p></list-item><list-item>
      <p>To ensure that the changes in RI due to inorganic salts get detected, the
designed machine learning system would match the signature of the water
constituent detected. Essentially each element of TDS in water will
correspond to a unique peak frequency of light when passed through water
(Sharan et al., 2013). The unique transmission spectrum of each water
constituent is considered the signature of the respective element.</p></list-item><list-item>
      <p>In the machine learning process each signature of TDS (organic, inorganic
and others) is stored in the database as a reference signature. During
detection of TDS, if the signature matches the stored value, then the
presence of the element is confirmed.</p></list-item></list></p>
      <p>Figure 5c is a replica of Fig. 5a or b. The only distinguishing factor for
the current scenario is the fact that the settling time at the tail and at
the horn are squeezed but remain stable for a very long range of frequency of
the applied intensity of light. This signature curve of the transmission
spectrum is incorporated into the database of the application.</p><?xmltex \hack{\newpage}?>
</sec>
<sec id="Ch1.S7">
  <title>Machine learning application design and development</title>
      <p>The naive Bayes classifier algorithm is developed as a MATLAB-based desktop
application (Garg, 2013). The classifier is designed for using unconditional
data provide by the user and is made generalized to read any dataset with
unconditional data. A Microsoft Excel file is used as input file categorical
feature values (non-numerical continuous data). The system is intended to
read two input files (.xlsx file) which contain the data set provided by the
user. One file contains the training set and the other the test set. Using
the training set, the prior probabilities of each class are calculated. Using
a single instance from the test set, the conditional probabilities for each
feature value are calculated. These values are then used to calculate the
posterior probabilities for each class. The class with the highest posterior
probability is assigned as the class for that test instance. This process is
done in each instance in the test set. The accuracy of the algorithm is
calculated by performing a comparison of the class values that are assigned
to the class with the original class values of that class. The workflow of
the system is shown in the flowchart below in Fig. 7.</p>
</sec>
<sec id="Ch1.S8">
  <title>Application of machine learning output and results</title>
      <p>The MATLAB-based application developed was used to detect, analyse and
classify the outputs obtained by the PhC-based sensors' simulated result and
was used to evaluate the ppm level of salinity/TDS in drinking water. The
algorithm selects the class with the highest posterior probability and
assigns it to the test data. The accuracy of the algorithm can be obtained by
performing a comparison of the class assigned to the test data with the
actual class of the test data. The accuracy of the classifier is calculated
by the number of correct classifications made/the total number of
classifications made. The simulated result of salinity/TDS and training data
is used from the selected USB drives by the developed application (Figure
8a). Based on the salinity check done, the observed result is shown in the
display of Raspberry Pi. If it is greater than or equal to 2000 ppm, the
display shows “High Salinity/TDS Observed” (Fig. 8b), and if ppm is less
than or equal to 1000 ppm, then the display shows “Low salinity/TDS
Observed” (Fig. 8c).</p>
</sec>
<sec id="Ch1.S9" sec-type="conclusions">
  <title>Conclusions</title>
      <p>The proposed paper concludes the design and implementation of an automatic
system that can be used for real-time evaluation of potable water. This
developed system includes a PhC-based ring resonator sensing application
interface with an LCD display. The result shows the performance of the sensor
is optimum as it can detect RI change of the order of 10<inline-formula><mml:math display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">5</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> in drinking
water. Even a 0.04 % change in salinity of water can be detected. The
application is based on the statistical algorithm implemented. Further
interfacing has been done using the Raspberry Pi device to provide an easy
display to show the ppm level of salinity/TDS in water. This application is
more accurate and does more continuous measurement than traditional methods.
Because of the use of a machine learning algorithm, the accuracy can be
further enhanced by the use of a further sub-classification of TDS. As future
work this approach can be extended to detect whether water can be used for
other purposes like farming and industrial use. <?xmltex \hack{\newline}?><?xmltex \hack{\newline}?><?xmltex \hack{\small\noindent{Edited by: R.~Shang\hack{\newline}
Reviewed by: M. Mokarram and one anonymous referee}}?></p>
</sec>

      
      </body>
    <back><ref-list>
    <title>References</title>

      <ref id="bib1.bib1"><label>1</label><mixed-citation>
Akahane, Y., Asano, T., Song, B. S., and Noda, S.: High-Q photonic nanocavity
in a two-dimensional photonic crystal, Nature, 425, 944–947, 2003.</mixed-citation></ref>
      <ref id="bib1.bib2"><label>2</label><mixed-citation>Deosarkar, S. D., Pandhare, V. V., and Kattekar, P. S.: Densities and
Refractive Indices of Potassium Salt Solutions in Binary Mixture of Different
Compositions, J. Engin., 2013, 368576, <ext-link xlink:href="http://dx.doi.org/10.1155/2013/368576" ext-link-type="DOI">10.1155/2013/368576</ext-link>, 2012.</mixed-citation></ref>
      <ref id="bib1.bib3"><label>3</label><mixed-citation>
Fan, X., White, I. M., Shopova, S. I., Zhu, H., Suter, J. D., and Sun, Y.:
Sensitive optical biosensors for unlabeled targets: a review, Anal. Chim.
Acta 620, 8–26, 2008.</mixed-citation></ref>
      <ref id="bib1.bib4"><label>4</label><mixed-citation>
Fawell, J. K., Lund, U., and Mintz, B.: Guidelines for drinking-water
quality, Health criteria and other supporting information, World Health
Organization, Geneva, 2nd Edn., 2, 1–4, 1996.</mixed-citation></ref>
      <ref id="bib1.bib5"><label>5</label><mixed-citation>
Garg, B.: Design and Development of Naive Bayes Classifier. Diss., North
Dakota State University, 2013.</mixed-citation></ref>
      <ref id="bib1.bib6"><label>6</label><mixed-citation>
Haung, Y., Lan, Y., Thomson, S. J., Fang, A., Hoffmann, W. C., and Lacey, R.
E.: Development of Soft Computing and Application in Agriculture and
Biological Engineering, Comput. Electron. Agr., 71, 107–127, 2010.</mixed-citation></ref>
      <ref id="bib1.bib7"><label>7</label><mixed-citation>Hossain, M. S., Akhter, F., and Emery David Jr, V.: Feasibility assessment of
household based small arsenic removal technologies for achieving sustainable
development goals, Drink. Water Eng. Sci. Discuss., <ext-link xlink:href="http://dx.doi.org/10.5194/dwes-2016-1" ext-link-type="DOI">10.5194/dwes-2016-1</ext-link>,
in review, 2016.</mixed-citation></ref>
      <ref id="bib1.bib8"><label>8</label><mixed-citation>
Joannopoulos, J. D., Meade, R. D., and Winn, J. N.: Photonic Crystal:
Modeling of Flow of Light, Princeton University Press, Princeton, NJ, 1995.</mixed-citation></ref>
      <ref id="bib1.bib9"><label>9</label><mixed-citation>
Joannopoulos, J. D., Villeneuve, P. R., and Fan, S.: Photonic Crystals:
Putting a new twist of light, Nature, 386, 143–149, 1997.</mixed-citation></ref>
      <ref id="bib1.bib10"><label>10</label><mixed-citation>Lavanya, J., Roy, S. K., and Sharan, P.: Design of optical sensor for
detection of brininess of water, Proceedings of the IEEE GHTC-SAS Conference,
99–104, <ext-link xlink:href="http://dx.doi.org/10.1109/GHTC-SAS.2014.6967566" ext-link-type="DOI">10.1109/GHTC-SAS.2014.6967566</ext-link>, 2014.</mixed-citation></ref>
      <ref id="bib1.bib11"><label>11</label><mixed-citation>
Liu, Y. and Salemink, H. W. M.: Photonic crystal-based all-optical on-chip
sensor, Opt. Express, 20, 19912–19920, 2012.</mixed-citation></ref>
      <ref id="bib1.bib12"><label>12</label><mixed-citation>Meade, R. D., Rappe, A. M., Brommer, K. D., and Joannopoulos, J. D.:
Existence of a photonic band gap in two dimensions, Appl. Phys., Lett. 61,
495, <ext-link xlink:href="http://dx.doi.org/10.1063/1.107868" ext-link-type="DOI">10.1063/1.107868</ext-link>, 1992.</mixed-citation></ref>
      <ref id="bib1.bib13"><label>13</label><mixed-citation>
Nguyen, L. V., Vasiliev, M., and Alameh, K.: Three-Wave Fiber Fabry-Perot
Interferometer for Simultaneous Measurement of Temperature and Water Salinity
of Seawater, IEEE Photonic. Tech. L., 23, 450–452, 2011.</mixed-citation></ref>
      <ref id="bib1.bib14"><label>14</label><mixed-citation>
Oskooi, A. F., Roundy, D., Ibanescu, M., Bermel, P., Joannopoulos, J. D., and
Johnson, S. G.: MEEP: A flexible free-software package for electromagnetic
simulations by the FDTD method, Comput. Phys. Commun., 181, 687–702, 2010.</mixed-citation></ref>
      <ref id="bib1.bib15"><label>15</label><mixed-citation>
Rish, I.: An empirical study of the naive Bayes classifier, IBM Research
Report, Computer Science RC 22230 (W0111-014), 2001.</mixed-citation></ref>
      <ref id="bib1.bib16"><label>16</label><mixed-citation>Sharan, P., Deshmukh, P., and Roy, S. K.: Mapping of aqua constituents using
photonic crystal, Proceedings of the IEEE R10-HTC Conference, 320–325,
<ext-link xlink:href="http://dx.doi.org/10.1109/R10-HTC.2013.6669063" ext-link-type="DOI">10.1109/R10-HTC.2013.6669063</ext-link>, 2013.</mixed-citation></ref>
      <ref id="bib1.bib17"><label>17</label><mixed-citation>Walker, M. and Newman, J.: Metals releases and disinfection byproduct
formation in domestic wells following shock chlorination, Drink. Water Eng.
Sci., 4, 1–8, <ext-link xlink:href="http://dx.doi.org/10.5194/dwes-4-1-2011" ext-link-type="DOI">10.5194/dwes-4-1-2011</ext-link>, 2011.</mixed-citation></ref>
      <ref id="bib1.bib18"><label>18</label><mixed-citation>
Yee, K. S.: Numerical solution of initial boundary value problems involving
Maxwell's equations in isotropic media, IEEE Transactions on Antennas and
Propagation, 14, 302–307, 1996.</mixed-citation></ref>

  </ref-list><app-group content-type="float"><app><title/>

    </app></app-group></back>
    <!--<article-title-html>Application of machine learning for real-time evaluation of salinity (or
TDS) in drinking water using photonic sensors</article-title-html>
<abstract-html><p class="p">The world is facing an unprecedented problem in safeguarding 0.4 % of
potable water, which is gradually depleting day-by-day. From a literature
survey it has been observed that the refractive index (RI) of water changes
with a change in salinity or total dissolved solids (TDS). In this paper we
have proposed an automatic system that can be used for real-time evaluation
of salinity or TDS in drinking water. A photonic crystal (PhC) based ring
resonator sensor has been designed and simulated using the MEEP (MIT
Electromagnetic Equation Propagation) tool and the finite difference time
domain (FDTD) algorithm. The modelled and designed sensor is highly sensitive
to the changes in the RI of a water sample. This work includes a
real-time-based natural sequence follower, which is a machine learning
algorithm of the naive Bayesian type, a sequence of statistical algorithms
implemented in MATLAB with reference to training data to analyse the sample
water. Further interfacing has been done using the Raspberry Pi device to
provide an easy display to show the result of water analysis. The main
advantage of the designed sensor with an interface is to check whether the
salinity or TDS in drinking water is less than 1000 ppm or not. If it is
greater than or equal to 2000 ppm, the display shows “High Salinity/TDS
Observed”, and if ppm are less than or equal to 1000 ppm, then the display
shows “Low salinity/TDS Observed”. The proposed sensor is highly sensitive
and it can detect changes in TDS level because of the influence of any
dissolved substance in water.</p></abstract-html>
<ref-html id="bib1.bib1"><label>1</label><mixed-citation>
Akahane, Y., Asano, T., Song, B. S., and Noda, S.: High-Q photonic nanocavity
in a two-dimensional photonic crystal, Nature, 425, 944–947, 2003.
</mixed-citation></ref-html>
<ref-html id="bib1.bib2"><label>2</label><mixed-citation>
Deosarkar, S. D., Pandhare, V. V., and Kattekar, P. S.: Densities and
Refractive Indices of Potassium Salt Solutions in Binary Mixture of Different
Compositions, J. Engin., 2013, 368576, <a href="http://dx.doi.org/10.1155/2013/368576" target="_blank">doi:10.1155/2013/368576</a>, 2012.
</mixed-citation></ref-html>
<ref-html id="bib1.bib3"><label>3</label><mixed-citation>
Fan, X., White, I. M., Shopova, S. I., Zhu, H., Suter, J. D., and Sun, Y.:
Sensitive optical biosensors for unlabeled targets: a review, Anal. Chim.
Acta 620, 8–26, 2008.
</mixed-citation></ref-html>
<ref-html id="bib1.bib4"><label>4</label><mixed-citation>
Fawell, J. K., Lund, U., and Mintz, B.: Guidelines for drinking-water
quality, Health criteria and other supporting information, World Health
Organization, Geneva, 2nd Edn., 2, 1–4, 1996.
</mixed-citation></ref-html>
<ref-html id="bib1.bib5"><label>5</label><mixed-citation>
Garg, B.: Design and Development of Naive Bayes Classifier. Diss., North
Dakota State University, 2013.
</mixed-citation></ref-html>
<ref-html id="bib1.bib6"><label>6</label><mixed-citation>
Haung, Y., Lan, Y., Thomson, S. J., Fang, A., Hoffmann, W. C., and Lacey, R.
E.: Development of Soft Computing and Application in Agriculture and
Biological Engineering, Comput. Electron. Agr., 71, 107–127, 2010.
</mixed-citation></ref-html>
<ref-html id="bib1.bib7"><label>7</label><mixed-citation>
Hossain, M. S., Akhter, F., and Emery David Jr, V.: Feasibility assessment of
household based small arsenic removal technologies for achieving sustainable
development goals, Drink. Water Eng. Sci. Discuss., <a href="http://dx.doi.org/10.5194/dwes-2016-1" target="_blank">doi:10.5194/dwes-2016-1</a>,
in review, 2016.
</mixed-citation></ref-html>
<ref-html id="bib1.bib8"><label>8</label><mixed-citation>
Joannopoulos, J. D., Meade, R. D., and Winn, J. N.: Photonic Crystal:
Modeling of Flow of Light, Princeton University Press, Princeton, NJ, 1995.
</mixed-citation></ref-html>
<ref-html id="bib1.bib9"><label>9</label><mixed-citation>
Joannopoulos, J. D., Villeneuve, P. R., and Fan, S.: Photonic Crystals:
Putting a new twist of light, Nature, 386, 143–149, 1997.
</mixed-citation></ref-html>
<ref-html id="bib1.bib10"><label>10</label><mixed-citation>
Lavanya, J., Roy, S. K., and Sharan, P.: Design of optical sensor for
detection of brininess of water, Proceedings of the IEEE GHTC-SAS Conference,
99–104, <a href="http://dx.doi.org/10.1109/GHTC-SAS.2014.6967566" target="_blank">doi:10.1109/GHTC-SAS.2014.6967566</a>, 2014.
</mixed-citation></ref-html>
<ref-html id="bib1.bib11"><label>11</label><mixed-citation>
Liu, Y. and Salemink, H. W. M.: Photonic crystal-based all-optical on-chip
sensor, Opt. Express, 20, 19912–19920, 2012.
</mixed-citation></ref-html>
<ref-html id="bib1.bib12"><label>12</label><mixed-citation>
Meade, R. D., Rappe, A. M., Brommer, K. D., and Joannopoulos, J. D.:
Existence of a photonic band gap in two dimensions, Appl. Phys., Lett. 61,
495, <a href="http://dx.doi.org/10.1063/1.107868" target="_blank">doi:10.1063/1.107868</a>, 1992.
</mixed-citation></ref-html>
<ref-html id="bib1.bib13"><label>13</label><mixed-citation>
Nguyen, L. V., Vasiliev, M., and Alameh, K.: Three-Wave Fiber Fabry-Perot
Interferometer for Simultaneous Measurement of Temperature and Water Salinity
of Seawater, IEEE Photonic. Tech. L., 23, 450–452, 2011.
</mixed-citation></ref-html>
<ref-html id="bib1.bib14"><label>14</label><mixed-citation>
Oskooi, A. F., Roundy, D., Ibanescu, M., Bermel, P., Joannopoulos, J. D., and
Johnson, S. G.: MEEP: A flexible free-software package for electromagnetic
simulations by the FDTD method, Comput. Phys. Commun., 181, 687–702, 2010.
</mixed-citation></ref-html>
<ref-html id="bib1.bib15"><label>15</label><mixed-citation>
Rish, I.: An empirical study of the naive Bayes classifier, IBM Research
Report, Computer Science RC 22230 (W0111-014), 2001.
</mixed-citation></ref-html>
<ref-html id="bib1.bib16"><label>16</label><mixed-citation>
Sharan, P., Deshmukh, P., and Roy, S. K.: Mapping of aqua constituents using
photonic crystal, Proceedings of the IEEE R10-HTC Conference, 320–325,
<a href="http://dx.doi.org/10.1109/R10-HTC.2013.6669063" target="_blank">doi:10.1109/R10-HTC.2013.6669063</a>, 2013.
</mixed-citation></ref-html>
<ref-html id="bib1.bib17"><label>17</label><mixed-citation>
Walker, M. and Newman, J.: Metals releases and disinfection byproduct
formation in domestic wells following shock chlorination, Drink. Water Eng.
Sci., 4, 1–8, <a href="http://dx.doi.org/10.5194/dwes-4-1-2011" target="_blank">doi:10.5194/dwes-4-1-2011</a>, 2011.
</mixed-citation></ref-html>
<ref-html id="bib1.bib18"><label>18</label><mixed-citation>
Yee, K. S.: Numerical solution of initial boundary value problems involving
Maxwell's equations in isotropic media, IEEE Transactions on Antennas and
Propagation, 14, 302–307, 1996.
</mixed-citation></ref-html>--></article>
