External Reference voltage maximum? (How to sample 0 - 10V)

Status
Not open for further replies.

gatheround

Well-known member
Hi everyone,
I'm working on a project where I need to sample three different voltages. Two are 0-10 V and one is 0-5V. Before I release the magic smoke, I just wanted to ask here if there are any issues with sending 10 or even 15V to the external reference?
 
Depending on your accuracy requirements you can use the MCUs internal reference or an external one between about 1.0 V and 3.3 V. Don't go above 3.3 (or VDD).
Then use an R divider to divide the external signal to lower than this value. e.g. if you use 3.3 V, divide the 10 V by 3 or 4; the 5 V by 1.5 or 2
 
Depending on your accuracy requirements you can use the MCUs internal reference or an external one between about 1.0 V and 3.3 V. Don't go above 3.3 (or VDD).
Then use an R divider to divide the external signal to lower than this value. e.g. if you use 3.3 V, divide the 10 V by 3 or 4; the 5 V by 1.5 or 2

Thanks for the reply, that's sort of what I was suspecting. I can divide down the 0-10V as you suggested, but with the 0-5V signal having scale accurately is very important. Would that mean I should use an op-amp amplifier with a trim-pot to set the gain accurately? Or is there a more fool-proof "divide by exactly 1.5" circuit out there that hopefully won't have me adjusting trim pots or hand-matching resistors?
 
I am not aware of any special divide by 1.5 circuit that avoids the need for accurately matched components.

The main reason to use an opamp is impedance matching. It's desirable to drive the ADC input with a relatively low impedance, ideally under 1K, but under 10K is probably fine. Usually its desirable to have a high source impedance when measuring a signal, so you avoid drawing too much current from it (or "loading" it). The lower your impedance to the input signal, the more likely you are to change it. It all depends on what type of device is creating the signal. If it's directly from an opamp, then loading it with 10K or 30K is probably fine. If it's from some sort of passive circuit involving resistors, adding a significant load might change it. If it's from an opamp, but inside another physical device which has a 100 ohm resistor in series with the output (to protect the opamp in case you do bad things to the output pin), and there's a lengthy wire or cable between the devices adding more impedance, then a low impedance causes some current flow through that 100 ohm resistor and all that wire, perhaps contributing a small error?

Using only three 10K resistors (2 in series for 20K to the 0-10V signals, and 1 to ground), the impedance loading the 0-10V signal is 30K (neglecting the tiny capacitance of the ADC pin). If the 0-10V signal has a low 100 ohm source impedance, then the impedance seen by the ADC is 20100 and 10000 in parallel, or 6677 ohms. That ought to work fairly well if your 0-10V signal can handle a 30K ohm load. If 30K is too low, you can increase the resistors somewhat, but as you go higher the ADC suffers, so an opamp is needed so you can have a high impedance input seen by the 0-10V, but a low impedance output driving the ADC.

Adding the opamp comes with a lot of downsides, however. First, you still need an accurate resistor ratio for feedback around the opamp, or to attenuate the signal before input to the opamp. But from a dividor ratio accuracy point of view, the opamp only makes things worse, not better (other than the huge advantage of impedance matching). Opamps have an offset voltage, which is the same as the input simply being off a tiny bit. Opamps with bipolar transistors inputs (the ones with the lowest input offsets) have input bias current. The input current flows through whatever resistors you're using. Usually the 2 inputs have very similar current, so if you take care to match the impedance seen by each input (usually by adding 1 extra resistor in series with 1 of the inputs), most of that error can be eliminated, but the 2 input currents aren't perfectly identical. Opamps also add noise, but so do higher value resistors. If you use a low noise opamp and low value resistors (probably in the feedback loop), usually it's a net win noise-wise to add the opamp. If you're really concerned about noise, it's important to consider noise in both the voltage error and input current to the opamp... at least when selecting the opamp. The datasheets often omit a spec if it's terrible (nobody can omit input offset voltage, but noise is the type of spec they tend to avoid), so always remember datasheets are written by marketing people with the primary purpose to sell you their product. Fully documenting it is merely a side effect.

Analog design to meet stringent specs, even for seemingly simple circuits, can be challenging.....
 
Last edited:
Also--as Paul alludes to--if your 5 V has a source impedance of 100 ohm, and you use a 10k R divider, you will get a 100/10k = 1 % error. Secondly, resistors supporting (say) 10-bit accuracy need to be better than 0.1 % and that gets expensive...

Do you need accuracy (R divider limitations, VREF limitations), or resolution (but can have gain error & offset errors). As Paul says, precision analog design quickly runs into real-world challenges.
 
Also worth considering is the way many products are designed.... using a cheap reference and cheap resistors, but ones that have good stability over the required temperature range, and then calibrate to correct the error in software. Some people calibrate by applying an extremely accurate test voltage and they record the ADC reading. Others apply an approximate voltage (or several voltages) and simultaneously measure it with the ADC and an accurate multimeter. I usually take that 2nd approach, which requires a more complex test process, but I like having accurate multimeters more than having precision voltage sources.

But your point about the source resistance is good. Unless you know the signal is driven from a very low impedance, you really do need a high input impedance to avoid error. No amount of calibration can solve the situation where the signal source has an unknown output impedance. You can only solve that by having a very high input impedance.
 
Last edited:
Also--as Paul alludes to--if your 5 V has a source impedance of 100 ohm, and you use a 10k R divider, you will get a 100/10k = 1 % error. Secondly, resistors supporting (say) 10-bit accuracy need to be better than 0.1 % and that gets expensive...

Do you need accuracy (R divider limitations, VREF limitations), or resolution (but can have gain error & offset errors). As Paul says, precision analog design quickly runs into real-world challenges.

Thanks for the replies Jp3141 and Paul,

Offset errors aren't a problem, the most important thing is that the scaling is accurate and linear. As for resolution, getting at least 10 bits of useful information would suffice for the 0-5V signal. 8 bits is enough for the 0-10V signals. Loading is definitely an issue with these, and they would need to be buffered. Thanks for the info on op-amp selection Paul, to be completely honest I've only ever used TL07x op-amps before so I definitely have some reading-up to do.

As Paul said, I could calibrate the ADC with a "known voltage" and correct the error in software.. but I would prefer to correct that error in hardware to honest. I will breadboard a simple op-amp amplifier with an adjustable gain to correct for resistor tolerances and see if I can get it working and calibrated.
 
Thanks for the replies Jp3141 and Paul,

Offset errors aren't a problem, the most important thing is that the scaling is accurate and linear. As for resolution, getting at least 10 bits of useful information would suffice for the 0-5V signal. 8 bits is enough for the 0-10V signals. Loading is definitely an issue with these, and they would need to be buffered. Thanks for the info on op-amp selection Paul, to be completely honest I've only ever used TL07x op-amps before so I definitely have some reading-up to do.

As Paul said, I could calibrate the ADC with a "known voltage" and correct the error in software.. but I would prefer to correct that error in hardware to honest. I will breadboard a simple op-amp amplifier with an adjustable gain to correct for resistor tolerances and see if I can get it working and calibrated.

Be aware that while resistors have a specified tolerance (e.g. 1 % or 5 %), this includes ageing and temperature variations. There is no guarantee that a particular resistor will remain at the measured value -- e.g. it could drift from your measurement/calibration value while still remaining in spec. The VREF on the ADC and the opamp offset could have similar 'issues'.

If you use the 3.3 V supply as the reference -- remember this is not a precision reference, and could easily have 5 % variation over temperature (and loading and USB input voltage). The MCU's internal 1.2 V reference is within 1 % of 1.1950 V at room temperature, but could drift by 80 mV (e.g. +/- 3 %) over temperature. If you need more stability than this, you should use an external reference (e.g. TI REF30xx).

Also, to buffer a 10 V signal, you will need a > 10 V supply (for the opamp).
 
Be aware that while resistors have a specified tolerance (e.g. 1 % or 5 %), this includes ageing and temperature variations. There is no guarantee that a particular resistor will remain at the measured value -- e.g. it could drift from your measurement/calibration value while still remaining in spec. The VREF on the ADC and the opamp offset could have similar 'issues'.

If you use the 3.3 V supply as the reference -- remember this is not a precision reference, and could easily have 5 % variation over temperature (and loading and USB input voltage). The MCU's internal 1.2 V reference is within 1 % of 1.1950 V at room temperature, but could drift by 80 mV (e.g. +/- 3 %) over temperature. If you need more stability than this, you should use an external reference (e.g. TI REF30xx).

Also, to buffer a 10 V signal, you will need a > 10 V supply (for the opamp).

Thank you, I couldn't find information about the stability over temperature of the 3.3V regulator within the microcontroller. Looks like an external reference is the best way to go. No worries about the power supply, I have regulated +/-15V available as well as a +5V reference on this project.
 
Status
Not open for further replies.
Back
Top