Shop OBEX P1 Docs P2 Docs Learn Events
16-bit ADC math help — Parallax Forums

16-bit ADC math help

TCTC Posts: 1,019
edited 2010-09-07 15:13 in BASIC Stamp
I just came across some MAX1416 ADC, it is a dual channel 16-bit ADC. I know it is a little overkill (maybe more than a little) but I would like to use them for my project of turning an ATX power supply in to a bench top power supply. I am going to use one for each voltage out (3.3V, 5V, and 12V) and the current for each voltage.

My problem is I need to convert the 16-bits to a voltage reading. IE 5.5V/ 65535= .00008V per bit, so if the ADC outputs $E8B9 = 5.0000V

Now I don’t care if it has a decimal point or not (I can add it). I would like it to be one formula that by changing one value could be used for 3.3V (3.5V max), 5V (5.5V max), and 12V (13V max).

Also could I use one voltage reference for all three ADC’s or do I have to use one voltage reference for each ADC?

Thanks
TC

Comments

  • Tracy AllenTracy Allen Posts: 6,662
    edited 2010-09-02 19:23
    The math depends on how you have the power supply voltages reduced to a level where the ADC can accept them. This ADC offers 4 single-ended channels or 2 differential channels, configurable. The 3.3V supply can go directly into one channel (via a protection resistor, just in case...). But the 5V and 12V supplies will have to be stepped down with voltage dividers. You mentioned that you also want to measure currents.

    But to get to the specific question, consider the nominally 3.3V supply into a single ended channel with a 5V reference. The ADC code goes from 0 to 65535 for the 0 to 5V span, and at 3.3V the code will be 43253 or thereabouts. On the Stamp it is convenient to work with milliVolts, and you can use the Stamp ** operator:
    mV = code ** 5000
    When the code is 43253, that will return mV=3300.
    The multiplier for your 5V and 12V supplies might be something other than 5000, depending on the circuit, but the equation will have the same form.
  • TCTC Posts: 1,019
    edited 2010-09-02 19:49
    I knew I would forget something; my reference voltage is 2.5V I was thinking it would be easier to figure out a voltage divider for each ADC that is why I chose that reference.

    If I understand what you are saying for each measurement I would:

    3.3V = 3500
    5V = 5500
    12V = 1300

    Where from your code “mV=code**max measurement” Please let me know if I am seeing this wrong.
    Thanks
    TC
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2010-09-02 23:21
    Okay, suppose the external resistor dividers are set up on each of the 3 channels so that the ADC input is 2.5 Volts and the ADC count is 65535, when the power supplies are at 3.500, 5.500 and 13.000 Volts respectively. Then yes, the three conversion equations would be
    mV3 = code3 ** 3500
    mV5 = code5 ** 5500
    mV12 = code12 ** 13000
    
  • TCTC Posts: 1,019
    edited 2010-09-03 12:50
    Well that was easy, Thank you for helping me.
    TC
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-09-07 14:24
    You might want to look at the MAX186 I wrote a Demo for a while back

    http://datasheets.maxim-ic.com/en/ds/MAX186-MAX188.pdf
  • TCTC Posts: 1,019
    edited 2010-09-07 15:13
    I am going to order a few to see if I like it, Thanks
Sign In or Register to comment.