0-5V ADC Scaling to 3.3V

Hi there,

I need to scale a 0-5V analog signal down to 0-3.3V for use with an Arduino Zero (ATSAMD21) and I understand I could use a simple resistor voltage divider with 1.7k and 3.3k, but my question is, would this affect the ADC readings? Also, I've seen people decouple with a capacitor between the output voltage and GND. I'd like to avoid using op amps and would like to see the best way of using a voltage divider for this.

What are the best principles here, and what values would achieve the best results?

Thanks!

androidfanboy:
Hi there,

I need to scale a 0-5V analog signal down to 0-3.3V for use with an Arduino Zero (ATSAMD21) and I understand I could use a simple resistor voltage divider with 1.7k and 3.3k, but my question is, would this affect the ADC readings? Also, I've seen people decouple with a capacitor between the output voltage and GND. I'd like to avoid using op amps and would like to see the best way of using a voltage divider for this.

What are the best principles here, and what values would achieve the best results?

Thanks!

I could use a simple resistor voltage divider with 1.7k and 3.3k

Yes

I've seen people decouple with a capacitor between the output voltage and GND.

Which "output voltage"

Regards

By "output voltage" I mean the output of the voltage divider. So to scale 0-5V down to 0-3.3V I'd use the 3.3k shunt resistor between the output of the divider to GND, and 1.7k from the output of the divider to the input (0-5V).

I've seen people put a capacitor across the shunt resistor.

androidfanboy:
By "output voltage" I mean the output of the voltage divider. So to scale 0-5V down to 0-3.3V I'd use the 3.3k shunt resistor between the output of the divider to GND, and 1.7k from the output of the divider to the input (0-5V).

I've seen people put a capacitor across the shunt resistor.

Hi,

Theoretically speaking (I mean, ideal conditions) it is not necessary.

Depending upon your concrete project it may be recommendable (even neccesary).

Regards

androidfanboy:
By "output voltage" I mean the output of the voltage divider. So to scale 0-5V down to 0-3.3V I'd use the 3.3k shunt resistor between the output of the divider to GND, and 1.7k from the output of the divider to the input (0-5V).

I've seen people put a capacitor across the shunt resistor.

The divider has to be (0 - 5V) - 1.7 k - Input to the M0 - 3.3 k - GND.

Can you post a sketch?

Regards

Sorry, that's what I meant, I flipped it in words. The 1.7k is on the bottom (to GND), 3.3k on the top.

When would the capacitor be necessary? Would this be necessary for the M0?

The largest issue will be the accuracy of the resistor divider. You have to make sure that for 5V in, the output is 3.3V or less. If you resistor divider turn out to scale the signal from 0-5 to 0-3, you need to make sure to use 3V and not 3.3V in your equation. Additionally your would be short steps. In this example, about 10%. Which will in turn effect the resolution of your readings.

5V with a 5V ADC is 4.88mV / count
3.3V with 3.3V ADC is 3.22mV / count

If the resistor divider provides 5V scaled to 3.3V then you must multiply by 1.5 to rescale it back to 5V.
If the resistor divider provides 5V scaled to 3.0V then you must multiply by 1.667 to rescale it back to 5V; but the ADC will only be using ~920 steps (as 3.0V is your maximum input value). Effectively reducing the resolution of each count.

adwsystems:
The largest issue will be the accuracy of the resistor divider. You have to make sure that for 5V in, the output is 3.3V or less. If you resistor divider turn out to scale the signal from 0-5 to 0-3, you need to make sure to use 3V and not 3.3V in your equation. Additionally your would be short steps. In this example, about 10%. Which will in turn effect the resolution of your readings.

5V with a 5V ADC is 4.88mV / count
3.3V with 3.3V ADC is 3.22mV / count

If the resistor divider provides 5V scaled to 3.3V then you must multiply by 1.5 to rescale it back to 5V.
If the resistor divider provides 5V scaled to 3.0V then you must multiply by 1.667 to rescale it back to 5V; but the ADC will only be using ~920 steps (as 3.0V is your maximum input value). Effectively reducing the resolution of each count.

Hi,
That's correct.
You have to have in mind that you can select 12 bits for the ADC (You loose resolution but compensate it by using 4096 steps).

Cap: What is the project?

Regards

I'm not doing any crazy-fast sampling, if that's what you're asking about. I'm just reading a good 'ole analog 0-5V but I just want to make sure accuracy is decent. I'll probably end up choosing stable resistors (like < 1% tolerance) but I was wondering if the capacitor makes it any better. I heard that if the equivalent resistance (ESR) of the voltage divider is too high it can screw with the ADC.

What are your thoughts on that? Thanks!

Another problem, especially with the rather small resistor values, may be the output impedance of the sensor. If that's more than a couple hundred Ohm, the load of these resistors will affect the output big time, and probably more for high voltages than for low voltages. I'd use 10x higher values for starters. Maybe even more, depending on the sensor.

Using 1% (or less) tolerance is good for accuracy of scaling, but not necessarily for stability which is mainly affected by temperature changes. There are resistor types that have particularly low thermal coefficients.

ESR is a property of capacitors, not of resistors. Resistors have an actual resistance.

Which sensor are you actually using?

Thanks! And yes, I thought about thermal instability as well. I could probably choose automotive-grade resistors.

I haven't picked out a sensor yet, but it would be a self-powered current transducer like this.

For that particular current transducer the datasheet says "Care must be taken to ensure the burden impedance of the instrumentation is greater than 1.0 megohm. The unit will operate with lower burden impedance but at reduced accuracy."

So I guess the sum of the resistors in the voltage divider need to be > 1Mohm? (So 1.7M and 3.3M?)

I'm not doing any crazy-fast sampling, if that's what you're asking about. I'm just reading a good 'ole analog 0-5V but I just want to make sure accuracy is decent.

You are loosing resolution simply because instead of 5V with a range of 0-1023 (with 10-bits) you only have 0-3.3V with a range or 0-675.

Or with 12-bits you'll have 0-2703 (with 0-3.3V).

I'll probably end up choosing stable resistors (like < 1% tolerance)

Or you can add a pot, or if you have an accurate voltmeter you can calibrate in software.

but I was wondering if the capacitor makes it any better.

A capacitor will reduce the noise, making the readings more stable (if that's an issue). If your readings are not jumping-around a capacitor won't make any difference. ...It's normal to jump +/- one count because the analog voltage is a continuous analog value (it's a real number)and you can be on the "hairy edge" somewhere between two integers, and a capacitor can't completely eliminate that.

I heard that if the equivalent resistance (ESR) of the voltage divider is too high it can screw with the ADC....

...So I guess the sum of the resistors in the voltage divider need to be > 1Mohm? (So 1.7M and 3.3M?)

No, the "instrument" is the Arduino.

The load resistance on the voltage divider (in this case that's the input impedance of the ADC) is in parallel with the "bottom" resistor so it can screw-up the voltage divider. But, since the ADC input impedance is super-high (around 100M Ohms) it's not an issue as long as the resistances in your voltage divider are "reasonable".

Thanks! What exactly would be "reasonable"? Like 17k and 33k, or 170k and 330k? Basically my shunt resistor would be in parallel with the ADC impedance and therefore the overall ADC impedance would drop due to my resistor, so should I lean towards the higher end of the values (170k and 330k)?

Also, the ATSAMD21's ADC is 12-bit. I'd rather not have to calibrate anything manually. I would want this to be plug and play to get desired accuracy.

Thanks!

I looked up the data sheet, and assuming it's typical for the sensor you're planning to get.
Beware of overvoltage:

Signal Out: 0-5 VDC
Max. Signal Out: 12 VDC

You have the clamping diodes on the Arduino's pins to help protect you from this, but you also need a sufficiently large resistance to limit the current (10k or so).

Another problem:

Output Load: 1.0 Megohm or greater for rated accuracy

That's three orders of magnitude higher than what you plan to use. Also too big for proper operation of the ADC, which is happiest with an output impedance of up to about 10k. That's also two orders of magnitude off.

What you can probably do best: build a voltage divider using two resistors that together are >1 MOhm, then connect that output to a unity gain OpAmp to buffer the signal from high to low impedance output, and the OpAmp output then goes to the pin. If you power the OpAmp with +3.3V it will simply max out at 3.3V when the sensor output goes over 5V, so no problem for the analog pin.

Any rail-to-rail OpAmp with input impedance of 100 MOhm or better (i.e. almost all of them) will do for this.

The load resistance on the voltage divider (in this case that's the input impedance of the ADC) is in parallel with the "bottom" resistor so it can screw-up the voltage divider. But, since the ADC input impedance is super-high (around 100M Ohms) it's not an issue as long as the resistances in your voltage divider are "reasonable".

I've had problems with divider equivalent output impedances (resitance) below 10 kOhm (pro mini; even Sparkfun ones). If the current through the divider is not a problem, I'd use resistors in the range of KOhms. That would improve the response time if you finally mount a 100 nF cap.

Regards

I'm just reading a good 'ole analog 0-5V

What's that?

Regards

Another thought: the output voltage is equivalent to the current. So if you were to use the lower 66% of the range only (so 0-6.6A for a 10A sensor) you'd get your 0-3.3V signal. You only have to deal with over voltage, which a clamping diode and current limiting resistor can deal with.

As the data sheet states a >1M output burden for accuracy, I expect the actual output impedance of the sensor to be in the order of 10-100k. That's high, but not too high for the ADC as long as you're aware that you may not be able to measure very fast changing signals.

OK, so let me try to get my facts straight. I think which impedances affect what is confusing me a bit.

  • The input impedance of the ADC is in parallel with the "bottom" resistor of the divider, so a lower resistor value (like 33k) will make is so that the ADC's impedance has less of an effect on the voltage divider than if the resistor were 3.3M, for example.

  • But then we also have the output impedance of the sensor. The sensor datasheet says "the burden impedance of the instrumentation" (which in this case is the ADC) should be greater than 1M because otherwise the measurements will be screwy due to the output impedance of the sensor being too close to the input impedance of the ADC.

To my understanding this means we have a catch-22 in that I should use resistors in the 10k range so that the divider isn't affected too much by the ADC's impedance, but then I also have to make sure the ADC's impedance is well above the sensor's output impedance (and it's not). Am I understanding things correctly?

Thanks!