ADC input voltage level shifting 5V to 3.3V??

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC input voltage level shifting 5V to 3.3V??

Jump to solution
19,281 Views
injunear1
Contributor IV

Hello,

I have an analog sensor that requires 5VDC and I want to read it into an ADC channel on the KL25Z Freedom Board.


In am providing an external 5VDC to power the board and which also powers the sensor. How might one convert a variable 0-5V range from the sensor into a 0-3V range for the board?


And, do I need to electrically isolate the sensor analog output from the analog input to the MCU? In other words, will a simple voltage divider network work, or is the 3.3V separate and unconnected from the external 5V supply?

I have considered the TI AMC1100 but the input voltage range is only about +-300 mV.


To use this, I speculate one could connect the sensor output to a voltage divider network and read the voltage drop across a resistor as the input to the AMC1100 and then run the output into the MCU ADC, but, is there an easier way?


Thank you.


Hillbilly Injunear



1 Solution
7,245 Views
chris_brown
NXP Employee
NXP Employee

Hi Hillbilly Injunear,

One option is to use a simple resistor divider but the effective output impedance of this will likely be too high to get an accurate result from the ADC.

The second option is to buffer it with a unity gain op amp.  Or configure an op-amp (or network of op-amps) to have a gain of 2/3 and not bother with the potential divider.


Hope this helps,


View solution in original post

0 Kudos
7 Replies
7,245 Views
injunear1
Contributor IV

Thank you all for your helpful posts, including BigMac, who put in extra time explaining the details.

Part of my question related to whether or not I could have 5V from an external power supply going to my external sensor and then run the output through a voltage divider network whose output will be measured relative to the voltage from a different power supply (onboard 3.3V).

(I can envision releasing copious amounts of magic smoke because I connected two separate power supplies without tying the 3.3V to the 5V.) However, after looking at the board schematic for a while, I am guessing that it will be OK.

Accuracy and speed are low considerations for this implementation. I am just using 8 bit accuracy, and reading 100 samples a second is more than enough.

All I am trying to do is read the position of a hydraulic cylinder (1.5 in max travel). I am currently using a 10k slide pot connected to the 3.3V (and duct taped to the cylinder ;-).

So, If I am understanding these things correctly (which I may not be), right now the analog source resistance can vary from 0 to 10K.

Today, I received some 5K plunger pots which will work better mechanically and should meet the 5K max input resistance specification.

For the sake of expedience, I think I will just use the pots connected to 3.3V for now. I can add an active 5V analog sensor in a couple of months when we are closer to production.


Thank you all for your suggestions and responses. They really were helpful.


0 Kudos
7,245 Views
bigmac
Specialist III

Hello,

If using two separate power supplies, you must ensure that the ground ,or common connections of both supplies are joined, so that each supply will be referenced to Vss of the MCU.

If using a potentiometer as the sensor, it would seem logical to make use of the 3.3 volt supply, rather than a separate 5 volt supply.  However, if necessary to use 5 volts for other reasons, a further alternative is to directly limit the output voltage range from the potentiometer, by placing a series resistor, equal to one half the potentiometer total resistance, between the top of the potentiometer and the +5 volt supply.

Keep in mind that, where a poteniometer is directly connected between the two supply rails, the maximum ESR (presented to the ADC channel) will be equal to 25% of the potentiometer resistance, when the wiper is at the half-way position (i.e. R/2 in parallel with R/2).  As the wiper moves towards either extremity, the ESR will approach zero.  For a 10k ohm pot, the maximum ESR would therefore be 2.5k ohm, easily meeting the specification.

Since it appears that the sensor is external to the board, you may need to give consideration  to the addition of circuitry to protect the MCU device from damage due to static discharge, and other transient voltages.  The use of a unity gain, rail-to-rail buffer is one method to prevent excessive injection current into the MCU pin.

Regards,

Mac

0 Kudos
7,246 Views
chris_brown
NXP Employee
NXP Employee

Hi Hillbilly Injunear,

One option is to use a simple resistor divider but the effective output impedance of this will likely be too high to get an accurate result from the ADC.

The second option is to buffer it with a unity gain op amp.  Or configure an op-amp (or network of op-amps) to have a gain of 2/3 and not bother with the potential divider.


Hope this helps,


0 Kudos
7,245 Views
JimDon
Senior Contributor III

Not sure why this would make the ADC inaccurate, in general.

What it could do is increase the RC time constant when in series with input capacitance so that you could not sample as fast, or not track an AC signal as well, So the real question is can the sensor drive the voltage divider hard enough so that the series resistance can be low enough so that you can meet bandwidth requirements.

7,245 Views
chris_brown
NXP Employee
NXP Employee

Per the KL25 datasheet, the analog source resistance should be no higher than 5k ohms.  So, sure, you might be able to implement a simple resistor divider circuit that meets that criteria.  But in general it's better to go with the op-amp solution because these devices will typically have a low output impedance and you won't have to worry about stressing the output of your sensor.  That's why I recommend that solution. 

~cheers.

0 Kudos
7,244 Views
JimDon
Senior Contributor III

To be sure, if you product can afford it it is nice to use an op amp. However the lower cost of the voltage divider may be compelling. At 5V 5K would be 1ma, so if you sensor can provide that, you will not be "stressing" it in any way that will affect it's long term performance.

0 Kudos
7,245 Views
bigmac
Specialist III

Hello,

Perhaps there have been a number of misconceptions about the ADC interface requirements that I will attempt to clarify here.

The ADC accuracy is affected by the source resistance of the external circuitry because of the sampling arrangement necessary to handle multiple input channels. The presence of external equivalent series resistance (ESR) will increase the charging time constant for the internal capacitor.  If the capacitor voltage does not stabilize within closer than 1 LSB at the completion of the sampling period, there will be a conversion error.  For example, for 12-bit resolution, the CR time constant must not exceed 1/9 the sampling period.  This is why there is a 5k ohm maximum limit for external ESR.

Using a simple voltage divider to scale 5 volts down to 3.3 volts, and to also meet the 5k ESR limit, the 1mA load on the sensor would appear to be a gross over-estimation.  Let's consider a voltage divider with a series resistance of R ohms.  For the required signal attenuation, the shunt resistor would need to have a value of 2R ohms.  Therefore, the ESR may be calculated as 2/3 * R.  For an ESR limit of 5k, the maximum value for R would be 7.5k ohms.  The loading of the sensor will actually be R + 2R = 3R, or 22.5k.  The maximum load on the sensor would therefore be 220uA.

Assuming that the sensor output is a positive value, there is no simple single op-amp configuration to provide less than unity gain.  A voltage divider will need to be used, either by itself, or in conjunction with one or two unity gain buffers.  When using a single buffer, this may connect either preceeding the voltage divider, or after the voltage divider.  In the first case, the loading of the sensor is minimized, and the output of the buffer may drive a lower resistance voltage divider.  With the buffer after the voltage divider, the external ESR to the ADC will be minimized, and a higher resistance voltage divider may be used.

Another important reason for including a buffer is to provide additional protection to the ADC input against static discharge, etc., particularly where the sensor is an externally located device.  A high resistance voltage divider prior to the buffer amplifier would provide better protection here.

Regards,

Mac