Вы находитесь на странице: 1из 21

ANN Based Error Compensation for Distance Measuring Sensor

ABSTRACT: Identification of all the errors to achieve the required levels of accuracy may be
difficult. The problem of improving the accuracy of measurement of physical quantities
remains upon in many cases, despite the vast variety of Morden sensor. The problem becomes
important when either the sensor or the measurement method cannot offer inherently the
desired resolution and accuracy. To resolve the accuracy issues, a sensor based indirect error
compensation approach is proposed in this project. To improve the error compensation
precision of these sensors, a method of the error compensation of sensors based on the neural
network algorithm is proposed. To validate the validity of the algorithm, the simulation
example of the error compensation of sensor was given. Here I am using Ultrasonic sensor for
estimate the error compensation. The ANN based error compensation has been implemented
for the sensor by training the ANN with their respective error profiles and the result indicate
that the accuracy of sensor. The result shows that the approach of the error compensation of
sensors using the neural network algorithm has a very high accuracy. Thus, the method
proposed is effective. Few Error Estimation and Compensation Techniques have been
discussed and newer method has been proposed for improving the compensation efficiency.
The desired goal is to improve the measurement accuracy by estimation and correction of the
maximum error components are analysed in this project.
Keywords:

1.INTRODUCTION
Information obtained from a sensor is prone to be erroneous.callibration is done in order to
get rid of these errors. Suitable compensation are provided as a part of this calibration
procedure. Neural network provide an advantages of making the system learn from its
operation and improve its output by modifying the system parameter according to a feedback.
Neural network work on the principle of limitation of working of neuron in the brain for
efficient implementation of complex algorithm. These provide a flexibility over conventional
model in a way that neural network are non-parametric in nature.
1.1 Need of Compensation
In order to improve the error compensation precision of sensor, an approach of the error
compensation sensor based on polynomial regression method was proposed. To validate the
validity of the method the simulation example of error compensation of sensor was given.
The result showed that the approach of error compensation of sensor using the polynomial
regression method has a very high accuracy.
In this project an error profile is being generated, which would show the deviation sensor
output from ground truths. Quality enhancement is being done by feeding the error data and
sensor data to an ANN, which would implement either of the following algorithm depending
on mode of application.
Back propagation algorithm: compensation when a faulty sensor is detected.
Polynomial regression: for finding errors to intermediate sensor values then those
provided to ANN for training.
Error backpropagation algorithm is a supervised learning technique used to train
a Neural Network In error backpropagation Neural Network, each hidden and
output neuron processes its inputs by multiplying each input by its weight,
summing the product and then passing the sum through a nonlinear function to
produce a result. NN learns by adjusting the weights of the neurons in response
to the errors between the actual output values and the target output values. This
is performed through the gradient descent on the sum of squares of the error for
all the training sets. The training stops when average sum of squares of the error
is minimized.

All real life transaction and interaction are a form of measurement. Certain specific
instruments, known as sensors are require to measure

few particular parameters. A sensor

output is permeable to many kinds of error and irregularities owing to different condition of
application under different conditions for similar input stimulus and hence lead to error in
measurement these error and irregularities are removed.
1.2 The Need for better accuracy
The purpose of this research is to develop a general purpose compensation system that is
capable of enhancing the accuracy of sensor measurement by correcting for the systematic
position errors by using the neural network. In todays modern and competitive
manufacturing environment there is an ever increasing need of higher precision and greater
accuracy. The benefits behind the compensation are the

To speed up the process of supplanting, fitting by assembly.


To ensure better interchangeability of components by manufacturing to higher

tolerances.
To achieve better product performance and reliability.

Neural Networks: General Discussion


Information obtained from a sensor is prone to be erroneous. Calibration is done in order to
get rid of these errors. Suitable compensations are provided as a part of this calibration
procedure. Complexity of an error compensation algorithm and the methodology for going
about to solve the problem strictly depends on the application requirement. For applications
requiring high precision, algorithms of higher complexity and computational power are
supposed to be used whereas for those which do not require such high precision, procedures
can be simple enough.
Though several different methods can be exploited to reach similar conclusions, Neural
Networks provide an advantage of making the system learn from its operations and improve
its output by modifying the system parameters according to a feedback. Neural networks
work on the principle of imitation of working of neurons in the brain for efficient
implementation of complex algorithms. These provide a flexibility over conventional
mathematical models in a way that neural networks are non-parametric in nature. Moreover,
addition of extra information in neural networks is much simpler than its mathematical
counterparts. Also, function replication can be done very effectively.

Several learning algorithms and propagation algorithms are available for this purpose. They
can employ either single layer or multi-layer approaches, depending on the complexity and
requirement.
Example [11][12]: a classification problem with data representation similar to that of an AND
or OR operation can be solved using single layer system, but those depicting XOR or XNOR
require a minimum of two layers.
For this particular project, a neural network has been designed to implement a fourth order
polynomial regression operation on the sensor data.

Figure 1: A structured view of neural network

1.3 Objective of the project:

To compensate the error of ultrasonic distance sensor using different algorithm.

To improve the information quality of sensor using the information of ground truths,
with the help of Artificial Neural Networks.

To attain higher compensation performance with greater accuracy.

2. LITERATURE SURVEY
Calibration of a sensor inherently defines the need for error compensation. Authors in [5]
provide a comprehensive coverage of different sources of error for an ultrasonic sensor. Main
reasons include: temperature, target location, composition, motion, characteristics of
ultrasound being used and transmission media.
Alan S Morris in [8] also provides a discussion on ultrasound, its characteristics and factors
affecting it. Taking into consideration, the directionality of ultrasonic waves, and how they
diverge as they move forward in the medium, a useful account of these waves can be made by
considering them not as single directional beams, but as conical beams with edges of cone
defined as transmission angle and magnitude taken either -3dB [7] or -6dB [8] with respect to
the central lobe or the main lobe.
Taking into account all the above factors as causes of error, one has to provide suitable
compensation. Providing such a compensation through mathematical modelling would make
the measurement complex and tedious. A better solution is to calibrate the sensors under test.
This project deals with compensation of errors during distance measurement using wired
ultrasonic sensor. All the data acquisition has been done using a perpendicular target.
Artificial Neural networks have been used for this purpose. Authors in [15] have provided a
comprehensive coverage of different learning algorithms followed by numerous applications
of neural networks possible using those algorithms. Backpropagation algorithm has been
implemented with the aid of [15]. This can be used only for function estimation and providing
approximate-to-target readings in the presence of faulty sensors. Polynomial regression is
required to make an error profile that transits smoothly through all the training data and also
to estimate errors at intermediate points. This algorithm has been implemented as an
application of multi-variate linear regression from module 4 of [13].

4. SYSTEM MODEL

5. PRPOSED DATA CALIBRATION MECHANISM

5.2 Compensation Techniques


5.2.1 Backpropagation Algorithm [13]
This algorithm deals with multi-layer perception. The error obtained after the last layer should
be responsible for not only updating the weights corresponding to final layer, but also to all
other weight matrices as well. Back propagation achieves this by introducing sensitivities for
each layer and updating these from those of the succeeding layer.
For an M-layer network,

Figure 6: Model for Back propagation Algorithm

Training the network:

Training the network will be done by updating the weights and biases, so that the

output reaches the target value.


Performance index for this operation is mean square error (mse). This index is also

called Cost Function.


Update operation is done in accordance with LMS algorithm, where weights are
updated by subtracting the product of learning factor and partial derivative of cost
function with respect to that weight from its current value. Bias update is done by
subtracting the sensitivity of the layer from its current value.

5.2.2 Polynomial Regression


Neural network has been utilised to perform a regression problem of order 5 using two layers one input and one
output. The network has weight vector w. Input is given in the form of a vector containing multiple powers of
sensor value p.
=[1 1 2 3 4 5]

Input multiplied with weight vector gives a polynomial of sensor value in every training example. This
polynomial output, when compared to the target value, which is error for the training example, in this case, gives
a polynomial mapping of sensor values over range of plausible errors. Then, for any intermediate value between
two sensor-readings, error can be obtained from the polynomial coefficients i.e. weight vector. This error can be
added (or subtracted) from the sensor data to give compensated output.

Training the network:

An input matrix X is constructed whose rows are vectors formed by multiple powers of sensor value p.
X is, thus, a m:6 vector, with first column containing all 1s.
(,:)= [1 1 2 3 4 5] ; =1 ( )

Weights of the network are given by the column vector:


()=[], =1

Hypothesis function: It is the summation of the product of a training input with its corresponding weight
element.
()= (,:)

The network is trained by updating the weights in order to decrease the performance index, which, in this
case is Mean Square Error. This performance index is also called Cost Function (J).

where (x(i), y(i)) is the ith training example.

Weight update operation:

This includes bias update operation as well, since the input matrix includes the initial bias
inputs in its first column and the weight vector is constructed so as to cater to all the elements
of every row in the input matrix.

Simplifying the differential term in the above equation

The above method of cost function reduction is called batch-gradient descent method, due to
the fact that, for every update operation, error is being calculated for all the training
examples, unlike the LMS approach, where only error pertaining to one training example is
calculated for one update operation at a time. The above differential is called batch error and
is multiplied with a learning factor () before updating the weight vector.
Thus, the final update equation is:

5.2.3 Checking the Trained Artificial Neural Network


For both the algorithms above mentioned, the efficiency of training operation can only be
assessed when some known data is sent into the network and the output obtained matches the
expected results. Thus, after every training session, known data, typically, the same training
inputs are re-sent into the network and checked for degree of closeness between the network
output and training targets.
Above algorithms have been implemented in MATLAB and networks have been checked for
training efficiency, whose results have been shown in the next chapter.

6. RESULTS
6.1 Data from the Arduino-based DAQ System
HC-SR04 has been deployed and interfaced via an Arduino Uno to a computer. Pin
connections are as follows:

Digital pin 11: connected to Echo pin of the sensor.

Digital pin 12: connected to Trigger pin of the sensor.

A pulse of 10 microseconds is given to the trigger pin of the sensor. The transmitter then
sends eight pulses of 40 kHz frequency. These pulses when reflected from the target are
received by the receiver and the duration for which the ultrasound has travelled is represented
by the pulse width of echo signal received. This duration is given in terms of microseconds
and can be converted suitably, using velocity of sound, to distance. Velocity of sound varies
with the environmental conditions, especially temperature and humidity. Temperature
increases the velocity whereas the increase in humidity attenuates the waves. These problems
in measurement are reflected directly from the observed data.
Figure 8 : Ultrasonic Sensor interface with Arduino Uno
The following table shows the readings taken from the ultrasonic sensor for measuring the
distance of the target from it. During all the data acquisition, target has been placed
perpendicular to the senors direction of propagation of ultrasonic waves. 18

Ground 10
Truths
Sl.No
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
Average

(cm)
10.16
9.74
10.16
10.16
10.16
10.16
10.23
10.16
10.23
10.16
10.16
9.74
10.16
10.16
10.09
9.74
10.16
10.16
10.23
10.16
10.104

20

30

40

50

60

70

80

90

100

(cm)
19.99
19.59
19.99
20.36
19.59
19.99
19.99
20.36
19.99
21.18
20.26
20.26
19.99
19.99
19.59
20.76
20.19
20.26
19.92
19.99
20.112

(cm)
29.76
29.49
29.62
29.62
30.78
29.49
29.76
29.76
29.49
29.72
29.76
29.76
30.11
30.18
29.49
29.72
30.18
30.18
29.76
30.11
29.837

(cm)
40.11
39.62
39.69
39.62
39.62
40.04
39.55
40.04
39.69
39.69
39.62
39.62
40.04
39.69
40.04
40.04
39.62
40.04
40.04
40.47
39.844

(cm)
49.68
50.17
50.1
50.17
50.17
50.1
49.75
49.82
49.75
49.68
49.75
49.75
49.68
49.75
49.75
49.75
49.75
49.68
49.75
50.17
49.858

(cm)
60.32
60.32
59.75
59.82
59.82
59.75
60.24
60.24
60.32
60.32
59.82
59.82
59.82
60.24
59.82
60.24
59.82
59.89
60.32
59.82
60.025

(cm)
69.64
69.64
70.16
70.49
70.56
70.49
70.13
70.63
70.56
69.64
70.16
69.64
70.16
70.13
69.64
69.57
69.71
69.99
70.16
70.16
70.063

(cm)
79.11
81.17
80.52
80.24
80.17
79.74
80.17
80.17
80.59
80.17
80.29
79.81
79.74
79.81
80.17
80.29
80.17
80.59
80.73
80.66
80.215

(cm)
90.2
90.61
89.98
89.91
89.91
89.84
89.69
89.84
89.91
89.84
89.56
89.69
89.69
89.69
89.84
89.56
89.84
90.34
89.84
89.98
89.888

(cm
100.09
100.0
100.09
100.0
99.66
100.0
100.51
100.1
100.01
100.5
100.01
99.59
100.51
100.5
99.59
99.59
100.64
100.5
100.58
100.5
100.17

The following shows that initial error found has been substantially reduced
due to implementation of neural network for error compensation.

6.2 Execution of Algorithms


6.2.1 Backpropagation Algorithm
Data from DAQ has been fed into a three layer Artificial Neural Network, whose purpose is
to create an error profile from the standard and sensor data and create an output that is
immune to disturbances in the inputs. After appropriate training, when the same training data
was sent through the network, output followed the target values very closely. Introducing
variations in the input did not alter the output. This property of the algorithm is useful for
replacement of damaged sensor nodes.

Training data:
Input Vector X whose row vectors are of the form given below, where variation of p with
target values is given in the next table.

()=[]

RESULTS:
Console Output:

Figure 9: Console showing Backpropagation Output

Plot: Error Profile [Error vs Sensor value for all training examples]

6.2.2 Polynomial Regression without hidden layer

This algorithm is provided with multiple powers of DAQ output as input and the target is set
to be the error obtained by comparing the sensor output to the standard i.e. data from ground
truth measurement system. Result will be a polynomial mapping the sensor inputs to errors
obtained. From that graph, an error estimate for any required DAQ value can be obtained.
This error estimate when mixed up with the original uncertain data will give solutions are
devoid of errors or with much less errors compared to the original ones.
Training input is a matrix X whose row vectors are of the form
(,:)=[1 ()1 ()2 ()3 ()4 ()5]
Target or standard values are errors:
()= ()()
Values of p and correct vectors:

CONCLUSION

This project has acquired sensor data, ultrasonic sensor in particular, through a Data
Acquisition System setup using Arduino Uno Board. The Arduino-based DAQ system has a
two-fold advantage. It is much cheaper than off-the-shelf DAQ systems available and at the
same time very easy to be programmed unlike a conventional microcontroller or processor.
Data from Arduino can directly be interfaced with MATLAB to obtain real-time data.
Artificial Neural Networks to get DAQ outputs closer to the standards values. ANN can be
implemented for such operations after appropriately being trained with a set of sensor and
standard data. This project implements the Backpropagation and Polynomial Regression
algorithms for that purpose.
FUTURE SCOPE:

References

[1]
[2] PPIMT, Hisar (Haryana),Minimization of Error in Training a Neural Network
Using Gradient Descent MethodIJTR mar-apr2012
[3]

[4]
[5]

D. S. Bernstein, "Sensor Performance Specifications," IEEE Control Systems Magazine,


August 2001.

Вам также может понравиться