COD-UV-SPECTROSCOPY-ANN-ANALYSIS

38
UV SPECTROSCOPY EMBEDDED CLOUD SYSTEM FOR ANN-COD ANALYSIS Kaushik Patra ([email protected] ) For CMPE-299 under the supervision of Dr. Hua Harry Li ([email protected] ) Department of Computer Engineering San Jose State University Date: 19 th March, 2013 © 2012 - SJSU Confidential

description

This is the MS thesis defend presented in Spring'13. The topic was to present an cloud connected embedded system performing water quality analysis using portable UV spectrometer. Artificial neural network based technique was developed to classify pure vs. dirty water based on COD (Chemical Oxygen Demand) parameter.

Transcript of COD-UV-SPECTROSCOPY-ANN-ANALYSIS

Page 1: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

UV SPECTROSCOPY EMBEDDED CLOUD SYSTEM FOR ANN-COD

ANALYSIS

Kaushik Patra ([email protected])

For CMPE-299 under the supervision of Dr. Hua Harry Li ([email protected] )

Department of Computer EngineeringSan Jose State University

Date: 19th March, 2013

Page 2: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Problem Statement• Lack of affordable water quality analysis instrument using

spectrometry analysis with UV/Vis light spectrum (200nm – 800nm).

• Very time consuming and not adaptable to analysis environment variability.

• Non-generic system geared towards a specific set of testing.

• Environment non-friendly process due to heavy use of chemical re-agents.

Page 3: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Objectives of Study• To conduct survey on state of the art technique for

COD content measurement in water.

• To design and implement ANN based self learning and sustainable and adaptive computing system for better decision making in COD analysis using spectrometry.

• To integrate ANN based COD measurement system into the existing embedded system.

• To test and verify overall system using real water samples from water treatment facilities.

Page 4: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Artificial Neural Network (ANN)• Artificial Neural Network (ANN) is mathematical model of

problem solving based on a very simplified model of working mechanism of neuron. ▫ Invention of Associative Network by John Joseph Hopfield in

1982 accelerated the usage of ANN in industrial application.▫ The conception of ANN is proposed in 1943 by Warren

McCulloch, a neuropsychologist, and Walter Pitts, a logician, from University of Chicago.

• It is an adaptive mathematical model for solving problem where relation between input parameters and output(s) of a function is very complex or unknown. ▫ Adaptability and machine learning are two essential

characteristics for ANN based tools.

Page 5: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

ANN in COD analysis• ANN has its application in very complex problem solving.

▫ Analog VLSI , Vision Chips▫ Stock market prediction▫ Autopilot mechanism for aircrafts

• Spectrometry based measurement of Chemical Oxygen Demand (COD) metric is a complex problem.▫ Mathematical relation between spectral analysis data and

COD content is complex and not completely known.▫ ANN with three feed-forward perception layer is a good

candidate to be used to implement an adaptable and supervised machine learning mechanism to be used for COD determination using spectral analysis with UV/Vis light (200nm – 800nm).

Page 6: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Spectroscopy in COD analysis• Three phenomenon occurs when EM radiation

falls into water sample containing impurities.▫ Deflection▫ Absorption▫ Scattering

• Different type of organic compound absorbs UV / VIS EM radiation of different wave length.

▫ Hence COD measurement should be studied over entire spectrum (200nm – 850nm)

Page 7: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Related Researches (1/3)

• Glucose concentration determination using ANN on infra-red absorption pattern in sample solution. ▫ ‘Neural Network Based Real-Time Detection of Glucose using a Non-

chemical Optical Sensor Approach’ by Fedric M. Ham et. al. [1990]

• COD determination using UV/VIS spectrometry.▫ ‘On-line and in-situ measurement of turbidity and COD in wastewater

using UV/VIS spectrometry’ by N. Flesichmann et. al.▫ ‘Binary encoded 2nd-differential spectrometry using UV-Vis spectral

data and neural networks in the estimation of species type and concentration’  by N. Benjathapanun et. al. (1997).

• Hybrid approach of water quality measurement using spectrometry and physico-chemical sensor.▫ Water quality monitoring using a smart sensing system by A. Charef et.

al. [2000]

Page 8: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Related Researches (2/3)

• A case study on pepper mill wastewater shows that analysis needs to be done on entire spectrum of UV/VIS.▫ ‘Monitoring of paper mill wastewater treatment plant using UV/VIS

spectroscopy’ by G. Langergraber et. al. [2004]

• Fingerprinting of different bio media substances using spectroscopy on entire range of EM wave.▫ ‘Spectral analysis and finger printing for biomedia characterization’ by

M. Pons et. al. [2004]

• Using wireless network for water quality monitoring.▫ ‘Water Quality Monitoring System Using Zigbee Based Wireless Sensor

Network’ by Z. Rasin and Md. R. Abdullah [2006]

Page 9: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Related Researches (3/3)

• Statistical feature extraction to reduce ANN input to a manageable amount for spectroscopy analysis for COD.▫ ‘Estimation of chemical oxygen demand by ultraviolate spectroscopic

profiling and artificial neural network’ by S. Fogelman et. al. [2006]

• Remote monitoring of water quality using GPRS.▫ ‘The Design on Multi-Parameter Online Monitoring System of Water

Quality Based on GPRS’ by Q. Tie-Zhu and S. Le [2010]

• Using ANN and GA for COD measurement.▫ ‘Hybrid artificial neural network genetic algorithm technique for

modeling chemical oxygen demand removal in anoxic / oxic process’ by Y. Ma et. al. [2011]

Page 10: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Conventional COD Analysis Technique (1/3)

• Refluxing water sample with potassium dichromate (K2Cr2O7) in a strong acid condition.

▫ Amount of potassium dichromate digested depends on how much organic compound is present in water sample. Hence, indirectly measures COD.

▫ Amount of potassium dichromate left over is measured using chemical titration process.

▫ Needs two hours or more for entire process to be completed.

▫ Ref : Dr. Chunlong, Fundamentals of Environmental Sampling and Analysis, (page 357)

Page 11: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

• Using colorimeter to determine left over potassium dichromate.

▫ Colorimeter is used to determine concentration of colored compound dissolved in water by measuring absorption amount of certain wavelength of light.

▫ The refluxed solution takes yellow to brown color depending on the concentration of the dichromate. Measuring the absorption pattern, colorimeter can indicate the amount of undigested potassium dichromate.

Conventional COD Analysis Technique (2/3)

Ref: http://en.wikipedia.org/wiki/Colorimeter_(chemistry)#cite_ref-2

Page 12: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

• Using photo-catalytic method.

▫ Oxidation of organic compound is accelerated in presence of catalysts and UV radiation (<400nm).

▫ Oxidation process creates electrical signal on the sensor.

▫ Amount of signal generated depends on concentration of organic compound present in water sample.

Conventional COD Analysis Technique (3/3)

Ref: COD Analysis, PeCODTM from MANTECH, ManSci Inc. http://www.mansci.com/products/PeCOD/index.html

Page 13: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Uniqueness of this Research1. An unique methodology of COD identification in

water sample using ANN photometry data analysis technique.

2. A mobile embedded hardware system integrated with portable photometer and connected to cloud infrastructure.

3. A software application system to utilize implemented cloud enabled mobile hardware system

1) System to both train and utilize ANN for COD analysis.2) In-situ upgrade of ANN by incremental training.

Page 14: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Overall System Architecture• The UV light source is connected

to flow using fiber optic cable.

• The dispersed light from flow cell comes to spectrometer using another fiber optic cable.

• The Spectrometer is connected to ARM11 embedded system though USB.

• The ARM11 Embedded system runs ANN based COD analysis algorithm to analyze spectrometry data using cloud storage and application server.

Page 15: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Overall System

Page 16: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Design of COD Detection Technique• 20 equidistance sample of photometry data

over the spectrum range is captured.

• This 20 sample is used as input to the ANN.

• Samples are normalized w.r.t. highest data present in pattern so that all the sample are between 0-1.

• ANN is trained with data pattern from water sample with no COD and with known COD.▫ 100 data pattern in generated from single

spectrometry data by injecting 20% random noise.

▫ Data from no COD is assigned as result 1.▫ All other patterns are assigned as result 0.▫ 100 random data pattern is generated with

result 0.

Page 17: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

ANN Architecture• Feed-forward network.

• Number of input 20

• Number of output 1

• Number of layer 1

• Number of hidden nodes 50

• Training algorithm – standard back-propagation

• Learning rate 0.7

I1 I2I20

. . .

H1

H2

H50. . .

O1

Page 18: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Mathematical Modeling for Training(1/2)

•Different signal patterns are generated with the following mathematic formulae.

▫ ▫ is the random noise with probability density function of

• ‘f’ is base frequency and ‘f’ is the random phase shift.

Page 19: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

• In the feasibility study the following parameters are used.

▫ Base frequency f = 1KHz

▫ Amplitude of the principal component as 1.0.

▫ Other harmonics have random (but symmetric in the spectrum) amplitude normalized to 1.0

▫ Time t is varied from 0-2p divided into 1K discrete points.

▫ Random phase shift is bounded between 0-2p

▫ Random noise has random amplitude with max of 20% of the base amplitude.

Mathematical Modeling for Training(2/2)

Page 20: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Experiment Design (1/2)

• Followings are the details on the experiment

▫ Done on different numbers of harmonics in composite signal (1, 2, 4, 8, 16, …, 1024).

▫ For each harmonic set 100 random spectrum is used.

▫ For each spectrum, 100 different signal patterns are generated injected with random noise and phase shift into the pattern. The ANN is trained to identify these patterns as 1.

Page 21: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Experiment Design (2/2)• Followings are the details on the experiment

▫ For each spectrum, 100 random pattern is generated with value between -1.0 to +1.0. The ANN is trained to identify these patterns as 0.

▫ Test patterns are generated similar to the training pattern generation.

▫ For each spectrum, the test is measured with percentage of detection error. Maximum and minimum errors are determined per spectrum set.

Page 22: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Experiment Result (1/3)• Followings is a sample signal generated

Page 23: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Experiment Result (2/3)• Following is the table of experiment error details.

#

Harmonics

Maximum

% of error

Mean

% of

error

Minimum

% of error

Standard

Deviation

of the % of error

1 5.5 1.35 0.0 0.94

2 4.0 0.46 0.0 0.71

4 2.0 0.17 0.0 0.35

8 2.0 0.20 0.0 0.44

16 6.5 0.41 0.0 0.84

Page 24: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Experiment Results (3/3)• Following is the table of experiment error details.

#

Harmonics

Maximum

% of error

Mean

% of

error

Minimum

% of error

Standard

Deviation

of the % of error

32 4.0 0.56 0.0 0.89

64 6.0 0.88 0.0 1.08

128 3.0 0.59 0.0 0.73

256 2.5 0.48 0.0 0.61

512 2.0 0.31 0.0 0.49

1024 2.5 0.28 0.0 0.44

Page 25: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Result Interpretation• The overall error distribution looks like following.

• Minimum error is 0%• Mean error is 2.21%

• Standard deviation is 5.24%

• Maximum error is 6.5%

Page 26: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

System Testing (1/2)

• Calibrated water sample with known theoretical oxygen demand is used for system test

▫ Industry standard is to use Potassium Hydrogen Phthalate (KHP).

▫ 1000 mg COD / Lt base water sample is prepared using 851.1 gm dry KHP 851.1 mixed in 1 Lt of organic free deionized water.

• 100 ml water sample with 250, 500 COD / Lt is prepared from the base water sample by dilution.

• 100 ml sample of water with unknown COD is prepared by mixing small amount of the reference solution with water.

Page 27: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

System Testing (2/2)

• Water sample with 0, 250, 500 and 1000 mg COD / Lt. is used for ANN training.

▫ Spectroscopy data is taken 5 times for each COD to account for natural variation.

▫ Each of these 5 samples are then injected with 10% random error to produce 10 reference samples.

• Following water samples are used to test the system along with the training data.

▫ Filter water▫ Sample with unknown COD▫ Toilet flush system water

Page 28: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

System Test Setup (1/4)

Page 29: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

System Test Setup (2/4)

Page 30: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

System Test Setup (3/4)

Page 31: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

System Test Setup (4/4)

Page 32: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

System Training Data

Page 33: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

System Testing Data

Page 34: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

System Test Result

•All test patterns are successfully classified as having COD or no COD.

▫ Link to the sample preparation video.

▫ Link to the test demonstration video.

Page 35: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Conclusion• COD detection is possible, without using any

chemical, based on pure photometry data analysis using artificial neural network.

• Affordable COD detection system can be built using generic mobile embedded system extended with attachable spectrometer through USB or other standard connection.

• COD detection system can be built on top of cloud based infrastructure.

Page 36: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Future Work• Development of photometry data analysis based

algorithm to determine COD concentration level.

• Integration of real private / public cloud into this system.

• Implementation of an evolving COD analysis system with feedback from laboratory COD results.

• Implementation of more robust experiment setup using controlled pump and flush system.

Page 37: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

Acknowledgment• Dr. Hary Hua Li, Department of Computer Engineering, San Jose

State University for his continuous support, encouragement and guidance throughout this thesis work.

• The thesis committee members, Dr. Donald Hung, Department of Computer Engineering, and Dr. Robert H. Morelos-Zaragoza, Department of Electrical Engineering, San Jose State University for being generously agreed to be part of the thesis committee and their encouragement and valuable feedback on this work.

• Arch Shaw, Alumni, Computer Engineering Department, San Jose State University for his pioneer work on integration of photometer into embedded system.

• My wife and daughter for being continuously supportive to complete this thesis work in time.

Page 38: COD-UV-SPECTROSCOPY-ANN-ANALYSIS

© 2012 - SJSU Confidential

UV SPECTROSCOPY EMBEDDED CLOUD SYSTEM FOR ANN-COD

ANALYSIS

Kaushik Patra ([email protected])

For CMPE-299 under the supervision of Dr. Hua Harry Li ([email protected] )

Department of Computer EngineeringSan Jose State University

Date: 19th March, 2013