1
Calibration Of Sensors Using Arduino S.Choudhury, S.Kisku, S.Majhi, S.Moharana, A.Raj, S.Sharma , V.Kumar, S.Das
Abstract—In this paper we present an efficient calibration technique for low cost sensors based on Arduino codes to reduce the marginal and any arbitrary errors in sensors due to environmental effects and designing defects. Calibration is process of finding a relationship between two unknown (when the measurable quantities are not given a particular value for the amount considered or found comparing with a standard for the quantity) quantities. The different sensors were combined and set up on a single Arduino board to improve accuracy and sensor output. The project consisted of three important sensorsTemperature, Accelerometer and Ultrasonic sensor. Temperature Sensor features a temperature complex with a calibrated digital signal output. Accelerometer is used as a baseline to discern orientation with respect to a given frame of reference. Ultrasonic sensor uses a technique similar to that of SONAR to determine distance of an object from a transmitted signal. The ultrasonic sensor was calibrated using multi-point curve fitting technique after the necessary observations were taken from an experiment using Arduino codes for the sensor. Open source kalman filter code was used for calibration of accelerometer, multiple point curve fitting algorithm was used for calibration of temperature sensor and one-point calibration technique was used for calibration of ultrasonic sensor. (Abstract)
and subject to variability as well,Temperature measurements are subject to thermal gradients between the sensor and the measurement point,Light and color sensors can be affected by spectral distribution, ambient light, specular reflections and other optical phenomena and inertial sensors are sensitive to alignment with the system being measured. The two most important characteristics of a good sensors are precision-the ability to produce the same output for the same input and resolution-the ability to to reliably detect small changes in the measured parameter. In this paper we wil carry out the calibration of three sensors namely accelerometer-MPU-6050,ultrasonic-HCSRO4,temperature sensor-LM-35. II.
BLOCK DIAGRAM
Keywords—calibration,ultrasonic,accelerometer,kalman,curve,fitting.
I.
INTRODUCTION
Calibration is a set of operations that under certain conditions establish relations between values indicated by a measuring instrument or system, or values represented by a materialised measure or reference material, and values realised by measurement standards. There are a lot of good sensors available and many are ’good enough’ out of the box for many non-critical applications. But in order to achieve the best possible accuracy, a sensor should be calibrated in the system where it will be used. This is because: 1) No sensor is perfect since sample to sample manufacturing variations means that even two sensors from the same manufacturer production run may yield slightly different readings ,Differences in sensor design mean two different sensors may respond differently in similar conditions. This is especially true of ‘indirect’ sensors that calculate a measurement based on one or more actual measurements of some different, but related parameters,Sensors subject to heat, cold, shock, humidity etc. during storage, shipment and/or assembly may show some variations in response and some sensor technologies ’age’ and their response naturally changes over time - requiring periodic re-calibration 2) The Sensor is only one component in the measurement system,and the reading vary with different variables like in an analog sensors, the ADC is part of the measurement system
Fig. 1. Block diagram III.
CIRCUIT DIAGRAM
Fig. 2. Circuit Diagram
JOURNAL OF CALIBATION OF SENSORS USING ARDUINO, November 2015 IV. BASIC CONCEPTS OF CALIBRATION The first thing to decide is what the calibration reference would be like. 1.Standard References If it is important to get accurate readings in some standard units, a Standard Reference is needed to calibrate using it as a reference. This can be: A calibrated sensor - If a sensor or instrument that is known to be accurate, it can be used to make reference readings for comparison. Most laboratories have instruments that have been calibrated against NIST standards. These will have documentation including the specific reference against which they were calibrated, as well as any correction factors that need to be applied to the output. A standard physical reference - Reasonably accurate physical standards can be used as standard references for some types of sensors like rulers,rangefinders,boiling water,ice water,value of g. 2.The Characteristic Curve Each sensor will have a ‘characteristic curve’ that defines the sensor’s response to an input. The calibration process maps the sensor’s response to an ideal linear response. How to best accomplish that depends on the nature of the characteristic curve.
FLOWCHART
V. CALIBRATION PROCEDURE we will be analysing three calibration techniques one each for the three sensors used 1.Kalman Filter “KALMAN FILTER” is the one of best techniques for calibration. The calibration of accelerometer MPU6050 is done by KALMAN filtering algorithm. The raw readings of input variable i.e the orientation of the sensor and the output of the sensor give the basic variables to be used in the next calibration technique i.e the KALMAN process which reduces the non-linearity of sensor. This is the basic aim of the product to show proper values of different parameters that are to be measured.[1] Initially the bias is zero hence; the error covariance matrix is taken as a null matrix. The covariance noise in observance is calculated from the observed readings of the sensor without the filter and the observer and the process noise variance is assumed to be zero. The variable B is also set to zero as no controlling input is present to change the upcoming readings. The variable H is set to 1 as the output reading is observed. Now as per KALMAN process defined in the flow chart the error covariance matrix and the Kalman gain is continuously updated with time the sensor starts to give continuous readings with an interval which is defined in the code. The new readings of the sensor after Kalman filtering are almost equal to the real time readings. [5][6][8][9]
Department of Electronics and Communication,NIT Rourkela
2
JOURNAL OF CALIBATION OF SENSORS USING ARDUINO, November 2015
3
Fig. 3. kalman filter flowchart
Fig. 5. One point calibration flowchart
2.One Point Calibration One-point calibration is the simplest type of calibration. If the sensor output is already scaled to useful measurement units, a one-point calibration can be used to correct the sensor offset errors when only one measurement point is needed or the sensor is known to be linear and has the correct slope over a desired measurement range.This process can be used for calibration of Ultrasonic sensor HC-SR04.[2]-[4]
3.Multi-Point Curve Fitting Sensors that are not linear over the measurement range require some curve-fitting to achieve accurate measurements over the measurement range. A common case requiring curve-fitting is thermocouples at extremely hot or cold temperatures. While nearly linear over a fairly wide range, they do deviate significantly at extreme temperatures. The graphs below show the characteristic curves of high, intermediate and low temperature sensors. This process can be used for calibration of Temperature Sensor LM-35.[7]
Fig. 6. Applicability conditions of Multi point curve fitting Fig. 4. Applicability conditions of One point calibration FLOWCHART
Fig. 7. Multi point calibration flowchart Department of Electronics and Communication,NIT Rourkela
JOURNAL OF CALIBATION OF SENSORS USING ARDUINO, November 2015 VI.
4
EXPERIMENTAL RESULTS
The three algorithms were implemented using ARDUINO codes for calibration of Accelerometer MPU6050,ultrasonic sensor HC-SR04,temperature sensor LM-35. The performance of the sensors has been clearlyimproved as can be clearly seen from the following graphs
Fig. 10. LM-35 characteristics plot
Fig. 8. accelerometer calibration plot It can be clearly noted that the kalman filter provides stability to the accelerometer and in case of sudden position or coordinate changes,the accelerometer provides accurate readings.
LM-35 temperature sensor shoes non-linear characteristics,hence one point calibration cannot be used for calibration and hence multi point curve fitting has been used,after calculation of regression coefficient for each data entry the calibrated sensor output is the product of non-calibrated output and the regression coefiicient at that data entry.The calibrated value provide a better estimate of the actual value than that of the non-calibrated value.
Fig. 9. HC-SR04 characteristics plot As the distance of the target increases the readings of the ultrasonic sensor tends to drift from the actual values.This drifting of values can be neutralised using an offset which is introduced using the one point calibration method.The calibrated readings are accurate and sufficiently close to the actual readings through out the measurement range .
Fig. 11. Final product
Department of Electronics and Communication,NIT Rourkela
JOURNAL OF CALIBATION OF SENSORS USING ARDUINO, November 2015 [5]
[6]
[7]
[8]
[9]
[5] E. Renk, M. Rizzo, W. Collins, F. Lee, and D. Bernstein, “Calibrating a triaxial accelerometer-magnetometer-using robotic actuation for sensor reorientation during data collection,” IEEE Control Syst. Mag., vol. 25, no. 6, pp. 86–95, [6] P. Batista, C. Silvestre, P. Oliveira, and B. Cardeira, “Accelerometer calibration and dynamic bias and gravity estimation: Analysis, design, and experimental evaluation,” IEEE Trans. Control Syst. Technol., vol. 19, no. 5, pp. 1128–1137, Sep. 2011. [7] H. Kuga, R. da Fonseca Lopes, and W. Einwoegerer, “Experimental static calibration of an IMU (inertial measurement unit) based on MEMS,” in Proc. XIX COBEM, Bras´ılia, DF, Brazil, 2007. [8] J. Ambadan and Y. Tang, “Sigma-point Kalman filter data assimilation methods for strongly nonlinear systems,” J. Atmos. Sci., vol. 66, no. 2, pp. 261–285, Feb. 2009. [9] S. Won and F. Golnaraghi, “A triaxial accelerometer calibration method using a mathematical model,” IEEE Trans. Instrum. Meas., vol. 59, no. 8,pp. 2144–2153, Aug. 2010.
Fig. 12. Product in Working state VII.
CONCLUSION
Three calibration techniques based on the use of a Arduino microcontroller has been presented.Use of each of the above calibration techniques has been presented by calibrating accelerometers,ultrasonic sensors,temperature sensors.Significant improvement was noticed in the sensor readings after calibration and the sensors are now ready for any further use. ACKNOWLEDGMENT WE would like to thank the Department of Electronics and Communication, NIT Rourkela as a whole for providing us every possible help and for providing insights and guidance on complete topic. We are also thankful to Department of Mechanical Engineer for allowing us to use the Themal laboratary for experimentation. We are also greatly thankful that the curriculum has included this lab which helped us get a practical insight and develop innovative ideas. R EFERENCES [1]
[2]
[3]
[4]
5
[1] Tadej Beravs, Janez Podobnik, and Marko Munih, Member, IEEE “Three-Axial Accelerometer Calibration Using Kalman Filter Covariance Matrix for Online Estimation of Optimal Sensor Orientation” IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 61, NO. 9, SEPTEMBER 2012 [2] J. Wang, Y. Liu, and W. Fan, “Design and calibration of a smart inertialmeasurement unit for autonomous helicopters using MEMS sensors,” in Proc. IEEE Int. Conf. Mechatron. Autom., 2006, pp. 956–961. [3] R. Zhu and Z. Zhou, “Calibration of three-dimensional integrated sensors for improved system accuracy,” Sens. Actuators A: Phys., vol. 127, no. 2, pp. 340–344, Mar. 2006. [4] A. Kim and M. Golnaraghi, “Initial calibration of an inertial measurement unit using an optical position tracking system,” in Proc. IEEE PLANS, 2004, pp. 96–101.
Department of Electronics and Communication,NIT Rourkela