EFA:Sensors:Reading Analog Sensors

Sensors with Analog Voltage Output

Many sensors will just give you an analog voltage. Some common sensors with analog output that you might see and use:

  • ADXL335 – Three-axis accelerometer with analog output. Easy to use.

Variable Resistors

Many sensors are just resistors that change their resistance value based on some external input (light, temperature, force etc.). The Arduino is not able to read the change in resistance directly, but we can convert that resistance change into a change in voltage using a voltage divider.

Voltage Divider

If you connect two resistors in series as in the image below, the voltage read from Vout depends on the ratio of the two resistors. Read the Wikipedia article or check this tutorial from Sparkfun, if you want to learn how to calculate the values.

Potentiometer

Potentiometers are essentially voltage dividers built inside a handy interface. They come in different shapes and sizes, but all of them work roughly the same way.

Light Dependant Resistor (LDR, photocell, light sensor)