# Sensitivity vs. range

Note: much of this content has been adapted from the old robotics classic, Mobile Robots: From Inspiration to Implementation, 1st Edition, by Joseph Jones and Anita Flynn.

Sensitivity and range: two important concepts when dealing with sensors...

## Sensitivity

All phenomena in the world are mapped in the microcontroller as an a range of numbers, usually between 0-1023 for inputs (i.e. 10-bit input), or 0-255 for outputs (i.e. 8-bit output).

• sometimes real-world phenomena have infinite degrees of subtlety, much of which can get lost in this digital mapping
• so be careful how you do the mapping to make sure to enable maximum sensitivity across the range of real-world phenomena.
• there are two simple types of mapping that are generally useful: linear and logarithmic

## Linear mapping

### The good

• great for representing sensors or actuators that sense or respond linearly to their input ranges
• e.g, the rotation of a motor responds linearly to an input signal
Linear mapping of an 8-bit signal to a 90 range of rotation provides an even sensitivity
• linear mapping is extremely easy to do

• not so great for sensors with uneven sensitivity over the range of the sensor
• e.g. photodiodes have lower sensitivity in dark light than in bright light, and linear mapping will maintain this bias
Linear mapping of 10,000 light intensity units to an 8 bit value skews sensitivity towards brightness

## Logarithmic mapping

### The good

• can provide better sensitivity in uneven sensor ranges
• e.g. better for mapping acoustic pitches and sound frequencies, which are logarithmic by nature
• e.g., provides better sensitivity across a range of light levels for photodiode sensors

• require a bit more work
• e.g. using the log10 function from Arduino's math.h library in your code
• or using a logarithmic amplifier integrated circuit (IC) in your circuit

## Photoresistors

Speaking of light-sensing, photoresistors turn out to be a good compromise between sensitivity and range.

We often use photoresistors, and not photodiodes or phototransistors, because photoresistors are easer to hook up to our microcontroller circuits. Their sensitivity is generally worse than that of photodiodes and phototransistors (whose signals require amplification).

But to get the decent sensitivity out of photoresistors while not compromising the range too much, it's recommended to use them in a voltage divider circuit with a static resistor that has the same value resistance you expect the photoresistor to have when at the average level of light you expect it to be exposed to. Then we use a linear mapping to analyze the levels.

## Mathematically speaking (in case you're interested)

Sensitivity is the degree to which the output signal of the sensor changes as the measured quantity changes

• Δr/r = S × Δx/x
• x is the measured quantity, r is the sensor output
• Δx is the change in measured quantity, Δr is the change in sensor output
• 'S is the specific sensitivity factor of the sensor'