바스넷버룬
                     (Barun Basnet)
                     1
                     방준호
                     (Jun-ho Bang)
                     2†
                     유인호
                     (In-ho Ryu)
                     1
                     김태형
                     (Tae-hyeong Kim)
                     1
               
                  - 
                           
                        (Major of IT Applied System Engineering of Convergence Technology Engineering Division,
                        Chonbuk National University, Korea)
                        
 
                  - 
                           
                        (Major of IT Applied System Engineering of Convergence Technology Engineering Division,
                        Chonbuk National University, Korea)
                        
 
               
             
            
            
            Copyright © The Korean Institute of Electrical Engineers(KIEE)
            
            
            
            
            
               
                  
Key words
               
               Sensor, Threshold, Standard deviation, Actuators, Gaussian distribution
             
            
          
         
            
                  1. Introduction
                
               Recent advancement in micro controller and their cheap availability has led to the
               development of embedded control systems for almost all real-life applications
(1). Their presence is everywhere from electrical, industrial, military, education, transportation,
               business, agriculture to home applications
(2-5). Sensors and actuators are critical components in electrical control systems, where
               the output of sensors is programmed to trigger the actuators when a specified threshold
               is crossed.
               
               
 
               The output of a sensor is a result of observing a physical phenomenon and converting
               them into a suitable electrical signal. Those signal always have a certain degree
               of randomness or fluctuations which appears in the output as some noise level added
               to it. It is because of the intrinsic property of sensors, other electronic components
               throughout the circuitry and other environmental reasons
(6-9). In many cases, a simple low pass filter, or certain digital filtering algorithm
               can be used to smooth out such noisy signals to a great extent
(10,11). However, in the case of high bandwidth sensors, filtering limits the ability to
               measure high-frequency physical changes in the environment since their bandwidth is
               narrowed down. Moreover, filtered signals are not 100% smooth and contain randomness
               just like the original signal. Even with those filtering method, if the signal hovers
               around the threshold, it would bring huge instability in the system’s output. Especially
               in the applications which require higher resolution, chances of instability in the
               output is even higher. 
               
               
 
               In this paper, we propose a Gaussian-based threshold tunable algorithm for stabilizing
               the actuators through sampling sensor data and automatically tuning the threshold.
               We establish a hypothesis that probability density function (PDF) of any random sensor
               reading can be modeled by the Gaussian distribution. The key technique presented in
               this method is manipulating the preset threshold for the stable operation of actuators
               since two or more threshold for the same action cannot exist simultaneously in the
               digital world. And the question of how much the threshold should be tuned to cover
               the entire signal is addressed with the modeling of sensor data using Gaussian distribution.
               By taking it into account, 99.73% of sensor data will fall under the three standard
               deviation (σ) range. The algorithm will keep track of the state of the system and
               tune the threshold to the 3σ range once the signal reaches the threshold. At this
               point, no matter how much the signal fluctuates, the state of the output will remain
               constant. It will tune back from the 3σ to the original threshold only when the signal
               crosses below the 3σ range. As a result, there is always the stability in the output
               independent of the level of noise or any randomness in the sensor data. Chapter 3
               gives detail realization of the proposed algorithm and explain the working concept
               in the detail. Chapter 4 compares the proposed method with other filtering methods:
               Exponential smoothing and Kalman filter, and shows its effectiveness over those methods.
               
               
 
             
            
                  2. Related Work
                
               Most of the published work focuses on noise reduction for sensor data acquisition
               using either analog circuit techniques or digital filtering techniques. M. Aamir et
               al. reports noise reduction techniques in the embedded system where the investigation
               of hardware and layout techniques can provide concrete solutions
(12). Similarly, F. Reverter reported analog circuit techniques which can help in interfacing
               sensors directly to microcontrollers without the use of signal conditioning circuit
(13). This method can help in reducing noise caused by surrounding electronic devices.
               Other noise cancellation techniques for single and double sensor were also reported
               where canceling signal is generated by measuring noise field
(14,15). V. Y. Mendeleyev et al. designed an optical sensor for reducing the influence of
               intensity fluctuations on output stability
(16). The analysis of the stabilization principle is performed assuming that the contribution
               of the intrinsic noise of the detectors and electronics to the output of the sensor
               is negligible in comparison to that of the light source’s intensity fluctuations.
               K.H. Eom et al. presented improved Kalman filtering method to reduce noise and obtain
               correct data in the multi-sensing environment
(17). P.H.G. Mani et al. reported on integration testing of sensors and actuators with
               embedded processing component. It focuses on sensor and actuator fault detection which
               can critically impact the system performance
(18). Other papers reported issues in sensor anomaly detection in wireless sensor networks
(19-21) and false alarm reduction methods
(22).
               
               
 
             
            
                  3. Gaussian-based Threshold Tunable Algorithm
                
               As we discussed in previous chapters, sensor data always have a certain degree of
               randomness and fuzziness due to various factors associated with it. The probability
               density function (PDF) of such sensor measurements can be modeled by a Gaussian distribution.
               Gaussian distribution is by far the most accurate PDF model to quantify uncertainty
               or random variables when making inferences as it is based on Central Limit Theorem
               (CLT). Mathematically the proposed algorithm can be expressed as
               
 
               
                
               where y is the output of the system which is the function of the probability of the
               random Gaussian variable x, and the Boolean variable tracker which stores the previous
               state of the system. Here p(x) can be expressed as
               
               
 
               
                
               
                
               
                
               
                
               where µ is the mean (expected value), σ is the standard deviation and square of the
               standard deviation, σ
2 being the variance. The probability that a random variable X lies in an interval
               is given by equation 
(3), 
(4) and 
(5).
               
               
 
               
                     3.1 Proposed algorithm
                   
                  In this section, we explain the realization of our proposed algorithm and show how
                  it works in stabilizing the outputs without any filtering. Setting thresholds is very
                  crucial in any control systems. In embedded control systems, microcontrollers are
                  programmed to set the threshold for the operation of actuators
(23). We especially take the example in Bang-bang or Hysteresis control type (see 
Fig. 1) systems.
                  
                  
 
                  
                        
                        
Fig. 1. Bang-bang/Hysteresis type control
 
                      
                   
                  In general cases, irrespective of the level of noise, a single threshold will ensure
                  smooth operation of the actuators. Suppose in a normal environment, readings of a
                  temperature sensor triggers a motor when a specified threshold is reached. It turns
                  on if the signal crosses above the threshold and turns off if the signal goes below
                  the threshold. However, if the signal stays around the threshold, it will bring instability
                  in the operation of the motor. The frequent change in the state eventually will bring
                  mechanical failure in the motor.
                  Many practical methods do exist to prevent such events from occurring. Some of them
                  include reading the sensor data only at certain time intervals or introducing delays
                  in reading the signals. Other methods include tracking the threshold where signals
                  will be ignored for a specified time once the threshold is reached. These type of
                  methods are useful especially in environmental monitoring and control where continuous
                  data is not of much importance. However, in other applications where the instantaneous
                  response is required per observation, such methods may not be helpful.
                  
 
                  Algorithm 1 Threshold Tuning
                  
                  
 
                   
                  1: Begin: Determine threshold;
                  
                  
 
                  2: Read n samples from the sensor at t=0 to t=n;
                  
                  
 
                  3: Compute σ from n samples;
                  
                  
 
                  4: Assign a Boolean variable Tracker to FALSE
                  
                  
 
                  5: Start Loop
                  
                  
 
                  #Condition 1
                  
                  
 
                  if (current sensor reading 
                  
 threshold)  
                  
                  
 
          
                  	do Actuator → ON
                  
 
                  	do Tracker → TRUE
                  
                  
 
                  #Condition 2	
                  
                  
 
                  else if ((current sensor reading 
                  
 (threshold –3σ))         AND (Tracker → TRUE)) 
                  
                  
 
                  	do Actuator → ON
                  
                  
 
                  else do Actuator  OFF
                  
                  
 
                  do Tracker  FALSE
                  
                  
 
                  6: End 
                  
                  
 
                   
                  Here, Algorithm 1 shows the working procedure of the Threshold tuning algorithm. The
                  working concept of the algorithm is also shown in flowchart in the 
Fig. 2. In step 1, a threshold is determined and assigned to the variable threshold. In
                  step 2 and 3, n number of samples are read from the sensor to calculate the standard
                  deviation σ. In step 4, a Boolean variable Tracker is assigned a FALSE or 0 value
                  initially. This Boolean variable will be assigned TRUE value only if the signal reaches
                  the threshold. This will help in determining whether the signal has crossed the threshold
                  or not. In step 5, the system loop begins, and Condition 1 is checked first. If the
                  sensor reading reaches the threshold, the actuator will be triggered ON, and the Tracker
                  variable will be assigned TRUE simultaneously. Activation of Condition 1 leads to
                  the activation of Condition 2 immediately where the previous status of the actuator
                  will be maintained. Once the signal is below 3σ range, the actuator is triggered OFF,
                  and the Tracker variable will be assigned FALSE. This creates a stable zone for the
                  signal from the original threshold to the 3σ range.
                  
                  
 
                  
                        
                        
Fig. 2. Flowchart representation of the Algorithm1
 
                      
                   
                
               
                     3.2 Dynamic Threshold tuning
                   
                  Readings of sensor data in single sensing and multi- sensing environment often different.
                  The measurement data of the multi-sensing environment has more noise and disturbances
                  than the single sensing environment
(17). Even the sensors of the same type manufactured by same vendor company drift slightly
                  when actual measurements are done
(9). To address these problems we added a feature to the Algorithm 1, i.e. dynamically
                  tuning the threshold every loop.
                  
                  
 
                  Algorithm 2 represents dynamic threshold tuning algorithm. The only difference between
                  this algorithm and Algorithm 1 is, it computes the standard deviation every time a
                  new sample is taken. A new 3σ range is set every time the loop runs.
                  
                  
 
                   
                  Algorithm 2 Dynamic threshold Tuning
                  
                  
 
                  1: Begin: Determine threshold;
                  
 
                  2: Assign a Boolean variable Tracker to False
                  
                  
 
                  3: Start Loop
                  
                  
 
                  Read current sample from the sensor and Store;
                  
                  
 
                  Compute and update σ in every loop;
                  
                  
 
                  if (current sensor reading 
                  
 threshold)
                  
                  
 
                  	do Actuator → ON
                  
                  
 
                  	do Tracker → TRUE	
                  
                  
 
                  else if (current sensor reading 
                  
 (threshold – 3σ))        AND (Tracker → TRUE)
                  
                  
 
                  	do Actuator → ON
                  
                  
 
                  else do Actuator → OFF
                  
                  
 
                  do Tracker → FALSE
                  
                  
 
                  4: End  
                  
                  
 
                
             
            
                  4. Experiments and Discussions
               
                     4.1 Actuator output with known methods
                   
                  In this section, we compare our method with other known methods: Exponential smoothing
                  and Kalman filter, in the actuator stability criteria. Exponential smoothing method
                  smooths the noisy readings from the sensor and acts as a low-pass filter. Equation
                  (6) and (7) shows the mathematical expression of the Exponential smoothing method:
                  
                  
 
                  
                   
                  
                   
                  where represents sensor data at time t=0, represents the best estimate of the data
                  and α is the smoothing factor. The value of α close to zero will have a greater smoothing
                  effect but less responsive to the recent changes, whereas value closer to 1 will have
                  lower smoothing effect but more responsive to the recent changes. The value of the
                  estimator s will be updated every time the sensor makes a new reading. 
                  
                  
 
Figure. 3 shows the application of the Exponential smoothing algorithm at α = 0. For the experimental
                  purpose, we used a microcontroller board based on ATmega32u4 providing 16 MHz clock
                  speed and 10 bit ADC. The algorithm successfully managed to smooth the signal and
                  filter the high frequencies. However, it was not able to reduce the frequent changes
                  in the state of the output. Another common yet complex algorithm is Kalman filter
                  which has a wide range of application including sensor signal processing. It is based
                  on a state-space approach where it optimally estimates the states of the model containing
                  statistical noise with known parameters
(24).
                  
                  
 
                  
                        
                        
Fig. 3. Application of Exponential smoothing algorithm
 
                      
                   
                  
                   
                  
                   
                  The state dynamics and output equations are described by equation 
(8) and 
(9) respectively. Here, x, y, u, w, v, F, G, H represents state vector, output vector,
                  input vector, process noise vector, measurement noise vector, system matrix-state,
                  system matrix-input and observation matrix respectively. These equations can further
                  be divided into two groups:
                  
                  
 
                  	a. Time update equations
                  
                  
 
                  
                   
                  
                   
                  	b. Measurement update equations 
                  
                  
 
                  
                   
                  
                   
                  
                   
                  Here, equation 
(10) and 
(11) represent the time update equations and 
(12), 
(13) and 
(14) represent the measurement update equations. Q, R, K and Z represents process noise
                  covariance, measurement noise covariance, Kalman gain and measured value respectively.
                  
Figure. 4 shows the application of Kalman filter algorithm. For our experiment in sensor signal
                  processing the parameters of Kalman filter are assumed as follows:
                  
                  
 
                  
                        
                        
Fig. 4. Application of Kalman Filter algorithm
 
                      
                   
                   
                  i. x is the sensor output voltage, 
                  
                  
 
                  ii.F=1; meaning the sensor reading does not vary instantaneously, 
                  
                  
 
                  iii. G = 0; meaning there is no control input and
                  
                  
 
                  iv. H=1; meaning the output voltage is only 	observable. 
                  
                  
 
                  v. R is the variance of the sensor reading
                  
                  
 
                   
                  Estimating Q and R is very challenging and often require complex calculations
(17). We arbitrarily assigned a very small value of 1×10
-4 to Q, whereas R was the variance of the sensor reading calculated after taking 50
                  samples. It successfully managed to get rid of the noise and estimate the signal.
                  However, it could not reduce the frequent changes in the state of the output satisfactorily.
                  It is because filtered signals are not 100% smooth and they also hover around the
                  threshold just like the original signal.
                  
                  
 
                
               
                     4.2 Actuator output with the proposed method
                   
                  The proposed method controlled the threshold based on the measurement of the probability
                  of the random Gaussian variable. We empirically found that the observed series of
                  sensor measurements indeed converged to Gaussian distribution when the sufficiently
                  large number of samples were taken. We took 2000 sample readings of a light sensor
                  (CdS photo sensor) in an illuminated room of 500 lux. With the total power supply
                  of 5 V, the µ of sensor readings was 1.33 V with the σ being 0.12. The maximum and
                  minimum value observed was 1.71V and 0.96V respectively. Operating frequency of the
                  sensor was observed to be approximately 120 Hz.
                  
                  
 
Figure. 5 shows the extraction of the sensor data using an oscilloscope. 
Figure. 6 shows sensor readings in using an embedded computer (ATmega32u4) where 1σ, 2σ and
                  3σ range cover approximately 68%, 95% and 100% of the data. 
Figure. 7 shows PDF of the collected sensor data fitted to Gaussian distribution.
                  
                  
 
                  
                        
                        
Fig. 5. Data acquisition with the analog method
 
                      
                   
                  
                        
                        
Fig. 6. Data acquisition with the digital method
 
                      
                   
                  
                        
                        
Fig. 7. PDF of the collected sensor data
 
                      
                   
                  As shown in 
Figure. 7 we manipulated the environment for the experimental purpose to demonstrate the usefulness
                  of the algorithm. In a normal environment, the output of the system is completely
                  stable irrespective of any level of noise as shown in 
Figure. 8. Once the signal is at the threshold the actuator status is ON, and it keeps on maintaining
                  the same status till the signal is at the 3σ range. Once it goes below the 3σ range,
                  the actuator status is OFF. Now after this, even if the signal crosses above 3σ range
                  its status would not change to ON. This brings great stability to 99.7% to the output
                  of a control system. In addition to that, unexpected events can be avoided, life of
                  the actuators can be prolonged, and maintenance cost can be reduced as well. 
                  
                  
 
                  
                        
                        
Fig. 8. Application of the proposed algorithm in the manipulated environment
 
                      
                   
                  
                        
                        
Fig. 9. Application of the proposed algorithm in the normal environment
 
                      
                   
                
               
                     4.3 Discussions
                   
                  The average stability using Exponential smoothing algorithm, Kalman filter and the
                  proposed algorithm was approximately 50%, 70% and 99.7% respectively. Our initial
                  hypothesis before beginning the experiment was all the data of the readings of sensors
                  in an uncontrolled environment would converge to a Gaussian distribution. However,
                  not all sensors exactly converge to the Gaussian distribution and the shape of the
                  distribution of those sensors are somehow complex. A Gaussian distribution is merely
                  an approximation of such complex probability distributions. Also, the variance of
                  a filtered signal is much less than a raw sensor signal. The algorithm proposed in
                  this paper can be applied to a filtered signal. The ‘3σ range’ can be made much narrower
                  with the cost of increase in computation time. 
                  
                  
 
                  Robust quantitative approach can also be adopted for outlier detection if it is of
                  high importance. The 3σ rule may break down at the contamination level greater than
                  10%. Other statistical outlier detection rules like the Hampel identifier can be used
                  which breaks down at the contamination level greater than 50%
(25).
                  
                  
 
                  
                   
                  The threshold level µ ± 3σ can be changed to  ± 3S and S can be expressed as
                  
                  
 
                  
                   
                  where x
i is the sample data, 
                  
 is the sample median and the whole numerator part of the equation 
(16) is the median absolute deviation (MAD) i.e. median of the absolute deviations from
                  the data’s median.
                  
                  
 
                
             
            
                  5. Conclusion
                
               Electrical control facilities deploy sensors and rely on their measurements and data
               acquisitions. Our work mainly focused on designing an algorithm capable of manipulating
               the preset threshold for the stable operation of the actuators. We modeled the random
               variables of the sensor readings by the Gaussian distribution. And by taking advantage
               of the properties of the distribution, we tuned the threshold to 3σ range covering
               99.73% of the signal. We also discussed the possibility of the proposed algorithm
               in the multi-sensing environment using dynamic tuning of the threshold. Finally, we
               used Exponential smoothing algorithm, and Kalman filtering for the same purpose and,
               experimentally found our method performed better. With the application of the proposed
               algorithm, complete stability can be achieved in any Bang-bang or Hysteresis type
               control. system.
               
 
             
          
         
            
                  감사의 글
               이 논문은 2018년도 정부(교육부)의 재원으로 한국연구재단 기초연구사업의 지원을 받아 수행된 연구임 (2018R1D1A1B07048630)
             
            
                  
                     References
                  
                     
                        
                        Crespo A., Albertos P., Simo J., 2007, Embedded Control Systems: From Design to Implementation,
                           Symp. Cost Oriented Automation, La Habana, Cuba

 
                      
                     
                        
                        Islam T., Mukhopadhay S. C., Suryadevara N. K., 2017, Smart Sensors and Internet of
                           Things: A Postgraduate Paper, IEEE Sensors Journal, Vol. 17, No. 3

 
                      
                     
                        
                        Chen H., Choi Y., Chou P. B., 2006, An Architecture for Programming and Managing Sensor
                           and Actuator Networks in Enterprise Environment, Workshop on Building Software for
                           Sensor Networks

 
                      
                     
                        
                        Lamont L., Toulgoat M., Deziel M., Patterson G., 2011, Tiered wireless sensor network
                           architecture for military surveillance applications, International Conference on Sensor
                           Technologies and Applications, pp. 288-294

 
                      
                     
                        
                        Ojha T., Misra S., Raghuwanshi N. S., 2017, N S. Sensing-cloud: Leveraging the benefits
                           for agricultural applications, Computers and Electronics in Agriculture, Vol. 135,
                           pp. 66-84

 
                      
                     
                        
                        Bordoni F., D’Amico A., 1990, Noise in sensors, Sensors and Actuators A: Physical,
                           Vol. 21, pp. 17-24

 
                      
                     
                        
                        Maijala P., Shuyang Z., Heittola T., Virtanen T., 2018, Environmental noise monitoring
                           using source classification in sensors, Applied Acoustics, pp. 258-267

 
                      
                     
                        
                        Kim D.  et al., 2015, When Thermal Control Meets Sensor Noise: Analysis of Noise-induced
                           Temperature Error, IEEE

 
                      
                     
                        
                        Wilson J., 2005, Sensor Technology Handbook, Elsevier

 
                      
                     
                        
                        2014, Understanding Sensor Resolution Specifications and Performance, TechNote, Lion
                           Precision, Technical article

 
                      
                     
                        
                        Basnet B.  et al., 2016, An Smart Greenhouse Automation System Applying Moving Average
                           Algorithm, KIEE, Vol. 65, No. 10, pp. 1755-1760

 
                      
                     
                        
                        Aamir M., Saleem M. F., 2004, Analysis of Noise Reduction Techniques in Embedded Systems,
                           National Conference on Emerging Technologies

 
                      
                     
                        
                        Reverter F., 2012, The Art of Directly Interfacing Sensors to Micro controllers, J.
                           Low Power Electron. Appl., pp. 265-281

 
                      
                     
                        
                        Oppenheim A. V., Weinstein E., Zangi K. C., 1994, Single-Sensor Active Noise Cancellation,
                           IEEE Transactions on speech and audio processing, Vol. 2, No. 2

 
                      
                     
                        
                        Zangi K. C., 1993, A New Two-Sensor Active Noise Cancellation Algorithm, IEEE

 
                      
                     
                        
                        Mendeleyev V. Y., Kourilovitch A. V., 2014, Optical sensor for reducing influence
                           of intensity fluctuations on output stability, Optical Engineering, Vol. 53, No. 2

 
                      
                     
                        
                        Eom K. H.  et al., 2011, Improved Kalman Filter Method for Measurement Noise Reduction
                           in Multi Sensor RFID Systems, Sensors

 
                      
                     
                        
                        Mani P. H. G., Khan I., Raju KVSVN, 2011, Sensors and Actuators Integration in Embedded
                           Systems, ACEEE Int. J. on Network Security, Vol. 2, No. 2

 
                      
                     
                        
                        Haque S. A., Rahman M., Aziz S. M., 2015, Sensor Anomaly Detection in Wireless Sensor
                           Networks for Healthcare, Sensors

 
                      
                     
                        
                        Lim S. Y., Choi Y. H., 2013, Malicious Node Detection Using a Dual Threshold in Wireless
                           Networks, J. Sens. Actuator Netw., pp. 70-84

 
                      
                     
                        
                        Chen S., Lu R., Zhang J., 2017, An Efficient Fog-Assisted Unstable Sensor Detection
                           Scheme with Privacy Preserved, arXiv:1711.10190v1 [cs.CR]

 
                      
                     
                        
                        Rahman M. M.  et al., 2017, A False Alarm Reduction Method for a Gas Sensor Based
                           Electronic Nose, Sensors

 
                      
                     
                        
                        Athanassiades M., Smith O., 1961, Theory and design of high-order bang-bang control
                           systems, IRE Transactions on Automatic Control, Vol. 6, No. 2

 
                      
                     
                        
                        Rhudy M. B., Salguero R. A., Holappa K., 2017, A Kalman Filtering Tutorial For Undergraduate
                           Students, International Journal of Computer Science & Engineering survery (IJCSEE),
                           Vol. 8, No. 1

 
                      
                     
                        
                        Zhao Y., 2015, Fault Detection and Classification and protection in Solar Photovoltaic
                           Arrays, Ph.D Thesis, Northeastern University, pp. 73-77

 
                      
                   
                
             
            저자소개
             
             
             
            
             
            
            Mr. Basnet is currently enrolled in Ph.D program in the dept. of IT Applied System
            Engineering at Chonbuk National University.
            
 
            His research interests include Analog Integrated circuits, Wireless sensor networks
            and Embedded Systems.
            
 
            E-mail : 
barunbasnet1@gmail.com 
             
             
            
             
            
            Dr. Bang is a professor at Major of IT Applied System Engineering of Convergence Technology
            Engineering Division and Smart Grid Research Center, Chonbuk National University.
            
            
 
            His research interest include analog circuit and IT convergence system.
            
 
            E-mail : 
jhbang@chonbuk.ac.kr 
             
             
            
             
            
            Dr. Ryu is a professor at Major of IT Applied System Engineering of Convergence Technology
            Engineering Division, Chonbuk National University. 
            
 
            His research interest include circuit & control system and IT convergence system.
            
 
            E-mail : 
toto00@jbnu.ac.kr 
             
             
            
             
            
            Dr. Kim is a professor at Major of IT Applied System Engineering of Convergence Technology
            Engineering Division, Chonbuk National University. 
            
 
            His research interest include digital circuits, micro computer and embeded system.
            
 
            E-mail : 
thkim1324@jbnu.ac.kr