1
\$\begingroup\$

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?

Thanks for your help!

\$\endgroup\$
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ – vini_i Jan 1 '16 at 21:56
  • \$\begingroup\$ @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.) \$\endgroup\$ – Nick Alexeev Jan 1 '16 at 22:43
2
\$\begingroup\$

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.

Also, please show a diagram of your circuit if possible.

\$\endgroup\$
  • \$\begingroup\$ Thanks, great answer. I didn't know that analogRead is referenced from the input voltage! I'm using a 3.7v lipo battery with a 3v system (it'll get recharged before it reaches 3.7v), so the battery voltage should always be high enough to power the Arduino board I'm using. \$\endgroup\$ – Alex Wulff Jan 1 '16 at 22:20
  • \$\begingroup\$ Keep in mind that unless you're feeding directly to the 3.3V (or 5V) pin of the Arduino, the input voltage will go through the Arduino's built-in regulator. \$\endgroup\$ – Ryan Griggs Jan 1 '16 at 22:29
  • \$\begingroup\$ Say I supply the board with the battery voltage and power the sensors with the regulated voltage - is analogRead referenced from the regulated voltage or the input voltage? \$\endgroup\$ – Alex Wulff Jan 1 '16 at 22:33
  • \$\begingroup\$ Analog Reference would be the voltage supplying your Arduino board OR you may choose to input a different reference on the AREF pin. See the aforementioned article (arduino.cc/en/Reference/AnalogReference). But keep in mind external references and analog inputsl must be within 0-5V. \$\endgroup\$ – Ryan Griggs Jan 2 '16 at 1:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.