0
\$\begingroup\$

I am planning to wire up the following sensor to an Arduino or a Raspberry Pi with a ADC.

The following segment gives a wiring diagram and than says that "Analog to digital conversions rely completely on VCC [...] this may be as high as 5.25V or as low as 4.75V"

enter image description here

I am a beginner to electronics - what is VCC? Additionally what is the "onboard 3.3V reference"?

\$\endgroup\$
1

1 Answer 1

4
\$\begingroup\$

Vcc is the power supplied to the Arduino. The ADC does measurements relative to Vcc, so if Vcc changes 10%, the values reported by the ADC will change approximately 10% (the other direction). Vcc depends on what your power supply is supplying, and may not be particularly accurate.

The Arduino's processor chip includes a temperature-compensated bandgap reference that produces a stable 1.1V reference source.If you use this for ADC, then fluctuations in Vcc won't affect the ADC values. The disadvantage is your input voltage needs to be under 1.1V.

The analog/digital converter converts the analog input voltage into a 10-bit value, where 0 represents ground voltage (GND) and 1024 represents the reference voltage or Vcc. (Except 1023 is the highest you can get.) So if you use Vcc, then the meaning of each ADC value depends on what Vcc happens to be. If you use the 1.1V reference, then the ADC values are stable.

But the circuit you're looking at does things entirely differently. It uses Vcc for the ADC reference voltage. Then they feed the Arduino's 3.3V supply into the ADC and measure its value with the ADC. If you assume the 3.3V supply is accurate, then you can work backwards and figure out Vcc. Finally, you can measure the sensor voltage you want to measure with the ADC, plug in the value you computed for Vcc, and get an accurate sensor reading. This lets you measure values all the way up to Vcc and correct for variations in Vcc.

The 3.3V supply is generated by a linear regulator on the Arduino board, which is supposed to be accurate to 1%. So if you assume you don't have any voltage drop between the regulator and the Arduino, and you assume that Vcc stays constant while you do this, then everything works well.

The math: Suppose your first measurement (of 3.3V) is \$n_1\$ and your second measurement (of the sensor) is \$n_2\$. We have

\$3.3V = n_1 * \frac {V_{cc}}{1024}\$

\$V_{sensor} = n_2 * \frac {V_{cc}}{1024} \$

We can cancel out \$V_{cc}\$, eliminating the inaccuracy from its value:

\$V_{sensor} = 3.3V * \frac{n_2}{n_1}\$

\$\endgroup\$
1
  • \$\begingroup\$ In addition, the output of sensor used by TS is ranging from about 1V - 3V (based on the page about its breakout), so using 3.3V ref voltage will clearly gives more accurate result \$\endgroup\$
    – duck
    Commented Jan 4, 2017 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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