Shop OBEX P1 Docs P2 Docs Learn Events
drop in 10 or 12 bit replacement for ADC0831 8 bit AD converter — Parallax Forums

drop in 10 or 12 bit replacement for ADC0831 8 bit AD converter

LloydsLloyds Posts: 75
edited 2009-09-16 04:11 in Accessories
Hello,

I've got a pressure transducer wheatstone bridge circuit working well with my BS2, amplifying it with an AD623 to vary between +0.1 to +3.5 vdc, and then running it thru an ADC0831 8 bit AD converter. I've adjusted the zero offset and ref voltage on the ADC0831 using a couple of voltage divider resistor circuits to utilize almost all of the 255 steps of the converter.

The pressure I'm measuring is between 500 and 3500 psi so the resolution is about 12 psi. I'd like to switch to a 10 or 12 bit converter to get better resolution and am hoping someone can recommend a drop-in 8 pin replacement for the ADC0831 so I don't have to rework my perf board. I'm using a socket for the AD0831 and would rather not install a larger socket. I only need a single channel.

Thanks in advance,
Lloyd

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-09-03 18:04
    Lloyds,

    When faced with such a situation I always consider making a small plug-in PCB with the new chip on it. I doubt there will be a drop in 12-bit (I could be wrong), so this would give you an option without having to re-design your board. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • LloydsLloyds Posts: 75
    edited 2009-09-04 04:56
    Chris,
    Thanks for the reply. I poked around and finally just started going thru data sheets and I think I found something that will be worth trying:

    12 bit Texas Inst AD converter
    http://focus.ti.com/lit/ds/symlink/ads7822.pdf

    here's the data sheet for what I am currently using:

    8 bit National AD converter
    http://www.national.com/ds/DC/ADC0831.pdf

    Both are 8 pin dips and the pin-outs and voltage levels look the same.
    I think I'll give the TI 12 bit version a try and see how it works. My ref and zero offset voltages are adjustable so I should be able to get the full range of the 12 bits.

    Thanks again,
    Lloyd
  • TimmooreTimmoore Posts: 1,031
    edited 2009-09-04 07:03
    How often to you need the A2D to sample? There is a way to increase the resolution of an A2d by oversampling. i.e. if you sample 256x faster than you need and average to add 4bits to the resolution. So if you dont need a fast sampling rate you might be able to do that.
  • LloydsLloyds Posts: 75
    edited 2009-09-04 11:59
    Timmoore,
    That sounds like the perfect solution. Sampling twice a second is all I need.
    Here is my code. As you can see, I am already taking 5 samples 2 msec apart and averaging them to stop the display dithering if the pressure is fluctuating between 2 Bit counts. My conversion formula has each Bit equal to 13.41 PSI.
    Could you show me how to modify the sampling technique to get the extra bit counts?
    Thanks very much!
    Lloyd

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    '
    [noparse][[/noparse] declarations for ADC ]
    adcBits VAR Word '
    adcAvg VAR Word '
    reps1 VAR Nib '
    PSI VAR Word '

    '
    [noparse][[/noparse] initialization ]
    CS PIN 7
    CLK PIN 8
    DataOutput PIN 9

    ReportPSI:

    'take 5 samples and average them
    adcAvg = 0
    FOR reps1 = 1 TO 5
    HIGH CS
    LOW CS
    LOW CLK
    PULSOUT CLK, 210
    SHIFTIN DataOutput,CLK,MSBPOST, [noparse][[/noparse]adcBits\8]
    adcAvg = adcAvg + adcBits
    PAUSE 2
    NEXT
    adcAvg=adcAvg/5
    ' Conversion formula PSI = adcAvg x 13.41 + 120
    PSI = adcAvg*41/100+(adcAvg*13)+120

    'Display PSI readings on the screen:
    DEBUG HOME
    DEBUG " last Bit count: ", BIN8 adcBits
    DEBUG CR, " Avg of last 5 Bit counts: ", BIN8 adcAvg
    DEBUG CR, " Average pressure ", DEC PSI, " PSI", CR
    RETURN
  • TimmooreTimmoore Posts: 1,031
    edited 2009-09-04 17:01
    A good place to read about oversampling is http://en.wikipedia.org/wiki/Oversampling

    In your case, say you need 2 bits more resolution, then you need 2 ** (2*n) where n is 2 so 16 a2d samples per output sample. So you need to do 32 samples per sec for your 2 samples per sec.
    Then you read 16 samples, add them together, so you get a value 16 * 10bits then divide that by 4 and you have your output sample.
    So your loop for averaging 5 samples, if you take 16 samples and divide by 4 (rather than your take 5 samples and divide by 5). You get your 2 bits more resolution.

    The way to think about this is the extra resolution in the input to the A2D is affecting the lowest bit. The lowest bit is the best the A2D can do sampling the input signal. But if the input isn't exactly map to the A2D input level for its bit sometimes it may read a bit high and sometimes a bit low. The number of times it reads higher depends on whether the input signal is closer to the next bit up in the A2D. So if the input signal is closer to setting the A2D lowest bit to 1 but not quite there say 7/8 of hte way to a 1, then sometimes you will read a 1 and sometimes a 0 but the average if about 7/8.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-09-04 20:19
    Hello, your duplicate post in the BASIC Stamp forum was removed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • LloydsLloyds Posts: 75
    edited 2009-09-04 21:45
    Chris,
    My mistake.
    I just reviewed the guidelines.
    Thanks,
    Lloyd
  • LloydsLloyds Posts: 75
    edited 2009-09-04 21:57
    Timmoore,
    Yes, I see what you mean, and I will read the oversampling article and experiment with the code.

    With the setup I have, if I increase the pressure very very slowly, it jumps in 13 psi increments with the 8 bit converter. If the oversampling works, it should jump in 6, or 3 psi increments, depending on the amount of over-sampling, if I'm understand it correctly. It will be an interesting experiment and I'm anxious to see how it works.
    Thanks again,
    Lloyd
  • LloydsLloyds Posts: 75
    edited 2009-09-16 04:11
    Its 10 days since the last post and I've done some testing and learned a few things.

    First, I tried the oversampling, which was a great idea, but because the pressure I was trying to read was stable, basically zero Hz, the oversampling, no matter how I tried it, gave the same result as a single sample. The 8 bit readings still jumped in 13psi increments.

    So then I tried the 12 bit ADS7822P which I thought was a drop-in replacement. Chris, you were right, I should have made a small piggyback board to get the bugs worked out. It was a drop-in except that the CS and Vref pins were swapped. At least I didn't ruin anything. I rewired those 2 pins on the original board, and everything was fine except that the readings stopped at 2047 bits, like it was an 11 bit converter. That was disappointing because I wanted at least 3500 steps to measure the pressure. So as a very last resort, I actually read the pin descriptions on the data sheet and found that the first bit sent was always a null bit. I made a guess, and changed the SHIFTIN statement to read 13 bits instead of 12 and darn if it didn't work (page 50 of the Basic Analog and Digital Student Guide) . I was able to set the zero offset and the total spread of the count so that there was a one-to-one correspondence between the bit count and PSI. Zero to 3500 psi with no conversion formula needed!

    I'm really learning a lot from these forums and the other resources, and appreciate everyone's input. Sometimes I'm not even sure what question to ask, but poking around will usually get me thinking in the right direction.

    Thanks to all,
    Lloyd
Sign In or Register to comment.