- freely available
Sensors 2010, 10(9), 8363-8374; doi:10.3390/s100908363
Abstract: A low-cost optical sensor based on reflective color sensing is presented. Artificial neural network models are used to improve the color regeneration from the sensor signals. Analog voltages of the sensor are successfully converted to RGB colors. The artificial intelligent models presented in this work enable color regeneration from analog outputs of the color sensor. Besides, inverse modeling supported by an intelligent technique enables the sensor probe for use of a colorimetric sensor that relates color changes to analog voltages.
Color sensing is one of the important subjects of optical sensors. Color sensors have a variety of applications including detection of environmental, biological, and chemical parameters [1–7]. Color detection based chemical sensing is mostly implemented with particular emphasis on colorimetric sensors because many parameters, like pH , concentration , and chemical gases [4,8,9] can cause direct or indirect color changes in biological and chemical species.
Optical sensors usually have a non-linear relationship between the sensor’s response and the effect to be sensed or the measurand. Due to the fact that optical sensors have highly sensitive and non-linear nature, an unexpected change in the measurand may cause considerably changes and measurement errors in the sensor’s responses. Furthermore, it is expected that in modern sensor technology, a sensor has to adapt itself to the changing or unexpected conditions. In order to meet the expectations and to predict the sensor’s response more accurately, artificial intelligent techniques become a useful tool for the design of intelligent sensors [10–12].
Artificial Neural Networks (ANNs) are inspired by the brain’s complex, nonlinear, and parallel computing ability and therefore they have some exceptional properties for data processing, such as adaptation, learning, and generalization . Intelligent optical sensors incorporate the abilities of ANNs with optical sensors inherently having high accuracy, long term stability, and immunity to electromagnetic interference. ANN based intelligent techniques have more significance if the sensor is highly nonlinear and/or a precise mathematical relationship cannot be established between the sensor’s response and the measurand. For example, when optical color sensors are used for classification of emerged colors, ANNs exhibit good performance in versatility of the measurement system [14,15].
The study we present in this paper is a low-cost reflective color sensor whose detection principle is similar to that of designs in [16–18] but overcomes the drawbacks reported therein with the aid of artificial intelligence. All parts of the sensor consist of cheap and easily available components. For example, the reflected signal from colored surface is produced by a RGB LED driven by a microcontroller and is detected by a photodiode. The analog signal from the photodiode is then amplified by an Op-Amp and applied to the microcontroller where it is converted to digital signals and processed. As it is well known, dark-colored surfaces degrade the performances of the reflective color sensors. In order to overcome this degradation and to improve sensor responses, we used ANN models utilizing multilayer perceptron (MLP) algorithms.
2. Brief Description of the Neural Networks
Neural Networks are perhaps the most popular intelligent technique in the design of intelligent sensors  and intelligent optical sensors [11,12]. This is especially because of their abilities in modeling of highly non-linear functions and generalizing of unseen data.
There are different types of neural networks, such as multilayer perceptron (MLP), radial basis function (RBF) and generalized regression neural networks (GRNN), for modeling of non-linear functions and data estimation/prediction problems . The three network types have not only many similarities but also significant discrepancies. Figure 1  shows general structure of the three types of neural networks consisting of an input layer, one or more hidden layers and an output layer. The processing units of an MLP apply a linear function to their inputs while they typically have a non-linear activation function whereas the RBF and GRNN include radial processing units. Besides, MLPs can exhibit better performances when they are used for data estimation/prediction problems (see Table 3 of Foody et al. ) while some other network types such as RBF, GRNN and probabilistic neural network (PNN) can successfully solve classification problems . Since our problem is typically a data estimation/prediction problem, we preferred to use MLP neural network whose brief description is given below. Performance comparisons of the network types may be a subject of further studies.
An MLP neural network consists of neurons (also called as nodes) connected to each other with weights. Each neuron has individual weights that are multiplied by the inputs when they enter to the processing unit. Then the processing unit sums up the inputs multiplied by the weights and produces the output of the neuron after the summation is applied to an activation function. The activation function must be a continuously differentiable function (preferably a non-linear function so that the network has a non-linear behavior). The function mostly used in MLP neural networks has sigmoidal nonlinearity whose types are logistic and hyperbolic tangent functions .
The input variables are transferred via the neurons at the input of the network. This group of the neurons is called input layer while the neurons producing of the network responses at the output are called output layer. An MLP network also includes one or more hidden layers between the two layers. In most nonlinear problems, two or more hidden layers improve the generalization ability of the network .
In order to train an MLP neural network, a learning algorithm is used to adjust the weights of the connections between the neurons in the layers. The performance of a learning algorithm generally changes from one problem to another and consequently, a trial-and-error method is mostly considered to determine the more efficient algorithm for a given problem. The learning algorithms having satisfactory performances used in this work are Gradient descent with momentum and adaptive learning rate backpropagation (GDX), Bayesian regularization backpropagation (BR), Levenberg-Marquardt backpropagation (LM), Resilient backpropagation (RP), and Broyden Fletcher Goldfarb Shanno quasi-Newton backpropagation (BFG).
GDX has an algorithm that updates weights and bias values according to gradient descent momentum and an adaptive learning rate. LM algorithm is a network training function that updates weight and bias values according to Levenberg-Marquardt optimization and it is the fastest (at the expense of the more memory usage) backpropagation algorithm in MATLAB Neural Network Toolbox. In BR algorithm, the weight and bias values are updated according to LM optimization that minimizes a combination of squared errors and weights. RP algorithm updates weight and bias values according to the resilient backpropagation algorithm and it works by modifying each weight by a learning parameter in order to minimize the overall error. Weights and bias values are updated according to the BFGS quasi-Newton method where the new weight is computed as a function of the gradient and the current weight. More details about the ANNs and learning algorithms can be found in [13,22].
3. Reflective Color Sensing
A typical reflective color sensor consists of three parts: a target, a source illuminating the target and a detector capturing the reflected light from the target. The most important parts of the design are the source and the detector. Reflective color sensors use either a broadband white-light source and three photo-detectors mounted behind of individual color filters or three narrow-light source generating RGB colors and a photo-detector. The sensor described in this section is the second and its general structure is given in Figure 2.
In a reflective color sensor, three phenomena take place when the light beams impinge onto the target: reflection, absorption, and transmission. A portion of incident light is reflected while the remaining is transmitted after a partial absorption regarding to the properties of the target. Two types of the reflected signal, i.e., diffuse and specular reflections, contribute to detector’s response. The diffuse reflection carries the useful information about the surface color; however varying specular reflection and fluctuating transparency can degrade the performance of the sensor. Fortunately, the specular reflection and the transparency remain almost constant for a given target and some small fluctuations in these parameters can be tolerated by intelligent approaches.
The cycle starts checking out whether the device is connected with PC. Then, minimum and maximum analog voltages produced by the probe are determined to calibrate the probe according to the properties of the surface to be measured. Minimum and maximum voltages are obtained from black and white colored surfaces, respectively. After calibration, the automatic measurement intervals are selected for each LED to be driven and the photodiode to be read. Time intervals are selected as 100 ms in this work. Microcontroller then drives R-LED during a duty-cycle of 100 ms as first and reads the photodiode’s output at the same time (Figure 3). This step is repeated averagely by 10 times until readouts remain stable. After completion of the R-LED period the microcontroller sends the readouts to the PC and initiates the G-LED period, and so on. When the three periods complete, (i) a new period can be started on the same surface, (ii) a new measurement can be started on another surface, or (iii) the procedure can be ended. A typical readout in terms of analog voltages and corresponding RGB contents is given in Table 1.
The sensor uses RGB LEDs controlled by a microcontroller as the light source. A photodiode converts the optical signal reflected from the target into analog voltages. Then the microcontroller converts analog voltages into digital data and sends to computer after completion of a measurement cycle. This digital data is utilized to determine R, G, and B values, since the reflected intensity (i.e., diffuse reflection) is proportional to RGB content of the target. Figure 4 describes how the measurement cycle completes.
4. Results and Discussion
An MLP neural network having an input layer with three inputs, two hidden layers, and an output layer with three outputs is used. The activation function of the output layer is a linear one while that of the other layers is the hyperbolic tangent function. The network is trained by five different training algorithms where the hidden neuron numbers in each layer are adjusted for the best performances. The inputs of the network are analog voltages obtained from the photonic circuit and the outputs are RGB contents of the surface. In order to obtain optimal network structures and neuron numbers in the hidden layers we used a trial and error approach. Although we started to train the networks with a minimum number of hidden layers and neurons in it, the best performances were obtained by different structures. Network structures of the proposed models are summarized in Table 2.
Although RGB content of any surface can be one of the 16 million possible combinations, we used a dataset consisting of only 246 data for training of the networks given in Table 2. Test dataset that is randomly selected and completely different from training dataset consists of 33 data. In order to constitute the dataset, we prepared a color palette whose a small part is given in Figure 5 and printed out them on a glossy paper by using a color laser printer. Then, for each color cell in the palette we obtained corresponding analog voltages by measuring with the probe given in Figure 2.
Computational performances of the networks are summarized in Table 3. It is useful to note that in the table, absolute error between the real and the networks’ values should be considered instead of usual error notations such as Root Mean Squared (RMS) and mean squared errors (MSEs), because absolute deviation from the real RGB content is more instructive than the others for this problem. Nevertheless, the MSEs of the models are also given in the table calculated with un-normalized values of the RGB contents. As can be seen from Table 3, BR and RP algorithms exhibit the best results in terms of maximum absolute error and time consumption.
For a better comparison of the performances, the best results (BR and RP) and the worst result (GDX) of the proposed models are given in Table 4. Numerical meaning of RGB contents is that if the absolute error is more than 30, human eye can distinguish the difference. In this context, RP and GDX results have two and four values, respectively, whose absolute errors are more than 30 while all of absolute errors of BR results are less than 30. Visual results of the networks are given in Table 5 as another performance comparison.
As can be seen from Table 5, all proposed networks can successfully model any RGB content of a given surface regarding analog voltages. In other words, the artificial intelligent models presented in this manner enable color regeneration from analog outputs of the color sensor (or from any voltage information). Besides, with the aim of an inverse modeling supported by an intelligent technique, the sensor probe can be used for a colorimetric sensor that relates color changes to analog voltages.
A low-cost optical sensor based on reflective color sensing is presented. Moreover, some neural network models are used as artificial intelligent technique to improve the color regeneration from the sensor signals. That is to say, analog voltages of the sensor can be successfully converted to RGB colors. The artificial intelligent models presented in this work enable color regeneration from analog outputs of the color sensor. Besides, an inverse modeling supported by an intelligent technique enables the sensor probe for use of a colorimetric sensor that relates color changes to analog voltages.
This work was supported by Research Fund of the Erciyes University (Project Number FBD09-1079)
- Endo, T; Yanagida, Y; Hatsuzawa, T. Colorimetric detection of volatile organic compounds using a colloidal crystal-based chemical sensor for environmental applications. Sens. Actuat. B 2007, 125, 589–595. [Google Scholar]
- Naydenova, I; Jallapuram, R; Toal, V; Martin, S. A visual indication of environmental humidity using a colour changing hologram recorded in a self developing photopolymer. Appl. Phys. Lett 2008, 92, 031109. [Google Scholar]
- Wang, XD; Chen, HX; Zhou, TY; Lin, ZJ; Zeng, JB; Xie, ZX; Xi, C; Wong, KY; Chen, GN; Wang, XR. Optical colorimetric sensor strip for direct readout glucose measurement. Biosens. Bioelectron 2009, 24, 3702–3705. [Google Scholar]
- Ricketts, SR; Douglas, P. A simple colorimetric luminescent oxygen sensor using a green LED with Ptoctaethylporphyrin in ethyl cellulose as the oxygen-responsive element. Sens. Actuat. B 2008, 135, 46–51. [Google Scholar]
- Ercag, E; Üzer, A; Apak, A. Selective spectrophotometric determination of TNT using a dicyclohexylamine-based colorimetric sensor. Talanta 2009, 78, 772–780. [Google Scholar]
- O’ Toole, M; Shepherd, R; Wallace, GG; Diamond, D. Inkjet printed LED based pH chemical sensor for gas sensing. Anal. Chim. Acta 2009, 652, 308–314. [Google Scholar]
- Rastegarzadeh, R; Pourreza, N; Saeedi, I. An optical redox chemical sensor for determination of iodide. Talanta 2008, 77, 1032–1036. [Google Scholar]
- Sen, A; Albarella, JD; Carey, JR; Kim, P; McNamara, WB, III. Low-cost colorimetric sensor for the quantitative detection of gaseous hydrogen sulfide. Sens. Actuat. B 2008, 134, 234–237. [Google Scholar]
- Courbat, J; Briand, D; Wöllenstein, J; De Rooij, NF. Colorimetric gas sensors based on optical waveguides made on plastic foil. Procedia Chem 2009, 1, 576–579. [Google Scholar]
- Borecki, M. Intelligent fiber optic sensor for estimating the concentration of a mixture-design and working principle. Sensors 2007, 7, 384–399. [Google Scholar]
- Saracoglu, ÖG. An artificial neural network approach for the prediction of absorption measurements of an evanescent field fiber sensor. Sensors 2008, 8, 1585–1594. [Google Scholar]
- Efendioglu, HS; Yildirim, T; Fidanboylu, K. Prediction of force measurements of a microbend sensor based on an artificial neural network. Sensors 2009, 9, 7167–7176. [Google Scholar]
- Haykin, S. Neural Networks: A Comprehensive Foundation, 2nd ed; Prentice-Hall: Englewood Cliffs, NJ, USA, 1999. [Google Scholar]
- O’ Farrell, M; Lewis, E; Flanagan, C; Lyons, WB; Jackman, N. Design of a system that uses optical-fiber sensors and neural networks to control a large-scale industrial oven by monitoring the food quality online. IEEE Sensor J 2005, 5, 1407–1420. [Google Scholar]
- O’ Farrell, M; Lewis, E; Flanagan, C; Lyons, W; Jackman, N. Comparison of k-NN and neural network methods in the classification of spectral data from an optical fibre-based sensor system used for quality control in the food industry. Sens Actuat B 2005, 111–112, 354–362. [Google Scholar]
- Afromowitz, MA; Van Liew, GS; Heimbach, DM. Clinical evaluation of burn injuries using an optical reflectance technique. IEEE Trans Biomed Eng 1987, BME-34. 114–127. [Google Scholar]
- Laming, JE; Martino, A. PC color recognition using led and software techniques. IEEE Photonic. Technol. Lett 1993, 5, 583–586. [Google Scholar]
- Yang, PK; Chen, JC; Chuang, YH. Improvement on reflective color measurement using a tri-color LED by multi-point calibration. Opt. Commun 2007, 272, 320–324. [Google Scholar]
- Wefky, AM; Espinosa, F; Jiménez, JA; Santiso, E; Rodríguez, JM; Fernández, AJ. Alternative sensor system and MLP neural network for vehicle pedal activity estimation. Sensors 2010, 10, 3798–3814. [Google Scholar]
- Foody, GM; Cutler, ME; McMorrow, J; Pelz, D; Tangki, H; Boyd, DS; Douglas, I. Mapping the biomass of bornean tropical rain forest from remotely sensed data. Global Ecol. Biogeogr 2001, 10, 379–387. [Google Scholar]
- Kiyan, T; Yildirim, T. Breast cancer diagnosis using statistical neural networks. Istanbul Univ.–J. Elect. Elect. Eng 2004, 4, 1149–1153. [Google Scholar]
- Neural Network Toolbox, Available online at http://www.mathworks.com/access/helpdesk/help/toolbox/nnet/ (accessed on June 25, 2010).
|Photodetector readouts (volts)||RGB contents|
|Surface Color||VR, R-LED||VG, G-LED||VB, B-LED||R||G||B|
|Training algorithm||Network type (neuron numbers in the layers)|
|Input||1st hidden||2nd hidden||Output|
|Gradient descent with momentum and adaptive learning rate backpropagation (GDX)||3||8||9||3|
|Bayesian regularization backpropagation (BR)||3||10||5||3|
|Levenberg-Marquardt backpropagation (LM)||3||5||9||3|
|Resilient backpropagation (RP)||3||5||9||3|
|Broyden Fletcher Goldfarb Shanno quasi-Newton backpropagation (BFG)||3||12||9||3|
|Algorithm||Maximum absolute error||Un-normalized MSE||Epoch number||Time consumption (s)|
|No||Inputs (analog voltages)||Outputs (RGB contents)|
|Real values||BR results||RP results||GDX results|
© 2010 by the authors; licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution license (http://creativecommons.org/licenses/by/3.0/).