That was what my colleague was told when he was at a seminar about calibration.
The talker continued:
“What we will learn today is how to estimate how much off the reading is, and if it really cares.”
This is a truth you always must remember while making measurements. You can NEVER get an exact true reading. If you use the analogue inputs on a micro controller, you have several possible sources of the error.
1) The reference
2) The bit factor
3) The physics
First part is a difficult one. an ADC (Analogue to digital converter) is always using some sort of reference voltage. On an Arduino it is by default Vcc. But Vcc is not always a good reference point. If you use a USB power source the Vcc is 5volts plus/minus 0.25 volt. I.e. 4.75 to 5.25 volts. This span is quite big if you want an exact reading.
On the other hand, in your implementation, this might be totally acceptable. Still, it is good to be aware of this.
Second part, the bit factor. Arduino uses a 10 bit ADC. This means that every step is Vref/1024. If your Vref is 5.0 volt, every step will be 0.00488 volts. In most situations, this should be good enough, but still, it is not my choice.
But now, let us go back to the reference again. Say that what you want to measure is a voltage that is expected to be in the 100 mV region, and never go over 200 mV. In such a case you really should reconsider what Vref to use. If you use Vcc as Vref, your readings will be around 20 for your nominal 100 mV up to 40 for 200 mV. In this case, a Vref of 0.5 volt, or even 0.25 volt would be much better.
The physics, or what are you measuring part.
First a small thought. What are you measureing?
Whatever unit you put on the output, you are measuring a relative voltage. OK, I know, you say. BUT some sensors are actually generating a current that is propotional to the read value. This means you have to measure the voltage over a resistor. Now, resistors are normally high precision (anyonel else remember what the gold and silver bands meant as tolerance readings on the old hole mounted resistors?).
You will normally have 1% tolerance or less on your resistor. If you have the right equipment you can even measure the exact resistor used and get even lower. But still, even if you get down to 0.1% tolerance, it is still a tolerance you have to consider if it will impact your final reading.
Another thing is the error of the sensor. When you read the specification, remember that the tolerance in some cases is given as % of full reading. if the sensor has 1% of full reading and is specified to 100 degrees, you have an error of 1 degree plus whatever else etror you got.
One more thing about physics. Sometimes you want the sensor at some distance from the controller. In this case you must be aware that the cable in effect is a RC network. and an antena. In most cases this is no problem, but as the distance rises, the error rises. Also, having a stright 2 wire sensor cable next to a mains cable for several meters will give interesting effects.
Two types of errors.
An important thing with errors is what type they are. I’d call them constant or variable.
Typical constant error is a resistors tolerance. If you measure the resistor you can expect two things:
a value that is within the stated tolerance
the same value every time. you make the measurement
This means that if you use the resistor for a measurement, for instance in a voltage divider, you can use the measured (verified) value in your code. Of cause, you will need to change the code if you change the resistor.
Another place when you most probably have a (mostly) constant error is the USB supply to your system. It will most probably be the same error every time you use the same source (computer or adapter) to hook up the system.
Variable errors are for instance noise from power sources (typicaly 50 or 60 Hz). These errors are more difficult to handle. One way is to take the mean value out of 3 to 5 measurements. The danger here is if you have a system that makes the measurements in phase with the mains cycle, you will have the same error each time….