 # John Errington's Experiments with an Arduino

## Voltage measurement with the Arduino board (page 3).

The examples already described allow reasonably accurate measurements to be made - but only if the source has a very low internal resistance. Most voltmeters are made to have a high impedance so that they do not significantly change the voltage being measured.

### Effect of voltmeter impedance on accuracy of measurement

The diagram shows a voltage source (i.e. whatever you are measuring the voltage of) connected to your measuring device (voltmeter). Lets look at what happens when we make a measurement with our arduino. The Arduino chip analog input circuit has an impedance of about 100M//14pf. (Shown here Rp, Cp) Also the analog input pins can show a leakage current of 1uA (but typically 50nA).
A 50nA current flowing through a 10k resistance will produce 50mV, or 10 LSB error!

These can reduce the accuracy of our measurements if the source resistance Rint is high, especially as the sample time window only allows about 6us for the 14pf capacitance to charge.

This is why the arduino spec recommends a source resistance of <10k.

The measurement error due to charging is Vo / Vs = (1-exp(-t/RC);

putting t = 6ns, C = 14pf, R = 10k we get t/RC = 6/140 = 7; and

Vo/Vs =(1-exp(-7) = 1 - 0.000912 which gives an error just less than 1LSB.

### How can we provide this low source resistance?

For voltages between 0 and 5V we can use an Operational Amplifier in a voltage follower configuration as shown here. Vin is the voltage you are measuring, and Vout connects to the analog input on the Arduino. Normally we would use positive and negative supplies to power an Op Amp; however modern CMOS Op Amps are able to accept inputs and provide outputs through the whole supply range. This simple configuration, with only four components, will give an input resistance of ten megohms, a VERY low output resistance, and will also provide protection against static and overvoltage or reverse voltage at the input.

The MCP6041/2/4 series are particularly suitable in this application, giving one, two or four op amps in an 8 pin or 14pin DIL package at low cost. (around £2.50 eBay)

If Vin will always be connected to a source you can even omit the 10M resistor!

### measuring other external voltages

For positive voltages we use the same circuit as above, but simply change the divider chain. Lets design a circuit to measure in the range 0 - 20V. The divider needs to present a voltage Vout of 0 - 5V at A0, so for a 20V input we will have 5V across R2 and 20 - 5 = 15V across R1.

Choosing R2 = 10M and R1 = 30M gives the range we need. You can chain three 10M resistors to make the 30M resistor. Alterrnatively you could use a 3M3 resistor for R2 and a 10M resistor for R1.

Again Vin is the voltage you are measuring, and Vout connects to the analog input on the Arduino.

For all the above examples its necessary to calibrate the measurement system.

Acknowledgements: All diagrams drawn with MeeSoft Diagram Designer