Shop OBEX P1 Docs P2 Docs Learn Events
ADC resistor divider questions — Parallax Forums

ADC resistor divider questions

photomankcphotomankc Posts: 943
edited 2013-03-25 23:29 in General Discussion
I have been looking to build myself an expansion board for the RaspberryPi that delivers a few needed extras for my robot project. One subsection that I wanted to add was a bank of ADC inputs. Found a pretty nicely documented project that used the MCP3424 and went ahead and decided to pick up a few on my last DigiKey order. The circuit presented in that project though made stop to pause today. The ADC uses an internal 2.048V reference for the conversion process. The original project circuit uses a voltage divider [10K/6.8K] to make the inputs into a 0-5V range instead of the default 0-2.048V.

Ok cool. Except it made me stop and think. Lots of analog sensors are in effect voltage dividers that vary one resistance in response to some physical input. My understanding of resistor networks is not that good, but on paper it seems to me that feeding one voltage divider with another is not going to get the results you expect just looking at the sensor output voltage range. The final circuit really becomes more complicated with series resistance added at the top of the divider and parallel added across the original divider.

I'm thinking that by making that input a more friendly range it has limited the use of those inputs. I'm considering forgoing that and leaving them as-is but that means that it's up to the user circuit to get whatever the voltage range is down to 0-2.048V which is a bit of pain to use.

Am I over thinking that or would that in fact create voltages that would be different than expected if you just considered each divider separately?

Comments

  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2013-03-25 10:06
    It seems like it would be pretty easy to test to see if you get expected results with the "double voltage divider" idea. But, either way, I think you would want to leave at least some of them as is, and document what needs to happen.

    You could have both the "as-is" inputs and have a couple that have a specified voltage range, say 0-5V and 0-24V using built in voltage dividers (heck even with a 24V range, you have precision down to 92µV!)
  • Mark_TMark_T Posts: 1,981
    edited 2013-03-25 10:35
    photomankc wrote: »
    I have been looking to build myself an expansion board for the RaspberryPi that delivers a few needed extras for my robot project. One subsection that I wanted to add was a bank of ADC inputs. Found a pretty nicely documented project that used the MCP3424 and went ahead and decided to pick up a few on my last DigiKey order. The circuit presented in that project though made stop to pause today. The ADC uses an internal 2.048V reference for the conversion process. The original project circuit uses a voltage divider [10K/6.8K] to make the inputs into a 0-5V range instead of the default 0-2.048V.

    Ok cool. Except it made me stop and think. Lots of analog sensors are in effect voltage dividers that vary one resistance in response to some physical input. My understanding of resistor networks is not that good, but on paper it seems to me that feeding one voltage divider with another is not going to get the results you expect just looking at the sensor output voltage range. The final circuit really becomes more complicated with series resistance added at the top of the divider and parallel added across the original divider.

    I'm thinking that by making that input a more friendly range it has limited the use of those inputs. I'm considering forgoing that and leaving them as-is but that means that it's up to the user circuit to get whatever the voltage range is down to 0-2.048V which is a bit of pain to use.

    Am I over thinking that or would that in fact create voltages that would be different than expected if you just considered each divider separately?

    The technical way of saying this is that you realize an ADC with an input resistance of 4k is less useful than one with near-infinite input resistance. The cure is an opamp
    in follower-mode on each input to drive the dividers. For 24V that's a bit harder as a 24V capable rail-to-rail opamp might be quite hard to find.

    But if all your sensors have a low output impedance its less important (a lot these days have a built-in opamp output stage).
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2013-03-25 10:49
    +1 for buffering the input to the ADC.

    But you can do it after the voltage divider and get good results. And then you can have the easily accessible low voltage opamps. I would even say it would be better after the voltage divider because a lot of ADCs put a small load on the input, which can affect readings if you have too much resistance in the voltage divider. Also the frequency that the ADC reads each channel can affect the reading if there is too much impedance.
  • photomankcphotomankc Posts: 943
    edited 2013-03-25 11:22
    I'll look into the OP-AMP design. That would make for a better solution I think than having to know the insides of the sensor and how well it matches the ADC. I decided that Bobb is right and I downloaded and tried out spice and that made it easy to see. High resistance on the ADC side and low resistance in the sensor makes the best combination with the dividers, but I know from experience that making the input resistance too high for the ADC leads to noisy readings. The effect is not as pronounced as I imagined but would mean that you lose range at the high end. Never played much with OP-AMP's. Digital signals I do pretty well, when it comes to analog, I'm stupid and I know it.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2013-03-25 11:47
    Op amp wiring is pretty simple, the datasheet usually has the wiring you need, or just look up an op amp "voltage follower" diagram. Make sure you get a rail-to-rail op amp. Depending on what you will be measuring certain specs will matter. For example, if you are wanting to measure frequencies, you will want a high slew rate, and high frequency, but if not, you can get a lower frequency/slew rate amp and save some money. You probably don't need hardly any output current, and you will definitely want a high input resistance. Though most are 1MΩ, you can get higher.

    Hope that helps a bit.
  • photomankcphotomankc Posts: 943
    edited 2013-03-25 12:40
    It does help! Thank you much.
  • PropGuy2PropGuy2 Posts: 360
    edited 2013-03-25 13:57
    I just finished a project using the MCP3208 - SPI chip. I used simple voltage dividers all around, 10K to ground and another resistor in series to get the ADC voltage within my 3.3 volt range limit (Vdd and ADC ref are 3.3 volts). Code is super easy, ten lines at most. Results are good for 3 to 4 decimal places.
  • frank freedmanfrank freedman Posts: 1,983
    edited 2013-03-25 14:10
    Pull the TI document, "Op Amps for Everyone". Lots of good stuff in there.

    FF
    Bobb Fwed wrote: »
    Op amp wiring is pretty simple, the datasheet usually has the wiring you need, or just look up an op amp "voltage follower" diagram. Make sure you get a rail-to-rail op amp. Depending on what you will be measuring certain specs will matter. For example, if you are wanting to measure frequencies, you will want a high slew rate, and high frequency, but if not, you can get a lower frequency/slew rate amp and save some money. You probably don't need hardly any output current, and you will definitely want a high input resistance. Though most are 1MΩ, you can get higher.

    Hope that helps a bit.
  • Mark_TMark_T Posts: 1,981
    edited 2013-03-25 18:04
    Input resistance vary enormously - all JFET input opamps are in the G-ohm range for instance, and most precision bipolar opamps manage a lot better than 1M. For an 18bit ADC you would naturally be using a precision opamp anyway

    The datasheet usually lists "input bias current" rather than input resistance. Input voltage error = source resistance x input bias current + input offset voltage (roughly speaking).

    [ and output noise figure is likely to be an issue too ]
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-03-25 23:29
    Of course, if you are considering using op-amps as a differential amplifier on the front end, it might be wiser to just use a comparitor and eliminate all the CPU loading with ADC code.
Sign In or Register to comment.