# Analog sensor reading and calibration

I have what I think is simple question regarding the use and data calibration of variable analog sensors (such as a force-sensing resistor). As more pressure is applied to this sensor, its resistance changes. This value can be collected by an Arduino device using the analogRead() function, which outputs a value from 0-1024, with 1024 being no pressure and 0 being the most pressure. I am assuming that analogRead is measuring the voltage, but I could be wrong.

My question is this: If I provide current to these devices from a battery, as the battery's voltage drops with use, will it affect the value read by an Arduino or other device? The value doesn't appear to change linearly as more pressure is applied, so would multiplying the read value by the battery voltage to get a constant work if the value does change with the battery voltage?

• If your using a battery then you should regulate the voltage. This solves all of the issues your concerned about and it guarantees that your circuit will run well. – vini_i Jan 1 '16 at 21:56
• @vini_i Some sensors are absolute, some sensors are ratiometric. If a sensor is ratiometric w.r.t supply voltage, and the A/D is referenced to the same supply voltage, then the reading of a certain stimulus will be the same independent of the supply voltage. (The non-linear nature of the sensor w.r.t stimulus is a different aspect altogether.) – Nick Alexeev Jan 1 '16 at 22:43

You are correct: analogRead() returns a value indicating the proportional voltage of the input to the Analog Reference Voltage, which is either the supply voltage, 5V or 3.3V, or another value depending on the Arduino you're using and your settings.

IF you are powering the Arduino with the same battery as your sensor, as your battery's voltage drops below the Arduino's regulated voltage, if it's still high enough to power the Arduino, the analogRead() function will continue to return a proportional voltage between 0V and your battery voltage. So there's no need to multiply the result by a constant as this is "automatic".

However, if you're powering the sensor from a battery and your Arduino from another source, you would need to know the battery voltage and adjust your analogRead() value proportionally.

Use a multimeter to ensure the voltage being fed into the Arduino is indeed changing as expected.