Shop OBEX P1 Docs P2 Docs Learn Events
How do i connect a ADC0831 to a baics stamp oem 2 board, and get results on a s — Parallax Forums

How do i connect a ADC0831 to a baics stamp oem 2 board, and get results on a s

MARKYODB2MARKYODB2 Posts: 5
edited 2009-11-14 23:22 in Accessories
Hello,

For a project i am trying to create a ph meter. As of right night i have a TLO74 connetced to a ph electrode.
The Readings i am getting from this range from 2.824 volts for a ph of 0 and 2.0425 volts for a ph of 14. giving about 1ph per 55.85mV.
I am feeding this imput into pin 2 of the ADC0831.·I have pin 4 of the ADC0831 coneceted to pin 13 of my stamp, pin 6 to pin 14 of the stamp, and pin 7 connected to pin 15 of the stamp. pin 5 and 8 oc the ADC are connevted to +5V and pins three and four to ground. I belevie i have everything hooked·up correctly, but i am not sure on how to start the coding. Any help is greatly appreciated. as to i am new with the stamp basic enviroment.

thanks
mark·

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-11-14 15:35
    Lots of information available in "Stampworks" (download and save it):

    http://www.parallax.com/Portals/0/Downloads/docs/books/sw/Web-SW-v2.1.pdf
  • MARKYODB2MARKYODB2 Posts: 5
    edited 2009-11-14 22:29
    Ok, i have came up with code,
    I am reveiving a number 74... although i should be getting an output voltage of about 1.4 what did i do wrong?

    ADres VAR Byte ' A/D result (8 bits)
    ADcs CON 13 ' A/D enable (low true)
    ADdat CON 14 ' A/D data line
    ADclk CON 15 ' A/D clock
    Kal CON 14961 ' Constant to be determined.
    txPIN CON 0
    Baud19200 CON 32

    START: LOW ADcs ' Enable ADC
    SHIFTIN ADdat,ADclk,MSBPOST,[noparse][[/noparse]ADres\9] ' Shift in the data
    HIGH ADcs ' Disable ADC
    DEBUG ?ADres ' Display the result
    PAUSE 1000 ' Wait a 0.1 Seconds
    SEROUT txPIN, Baud19200, [noparse][[/noparse]22,12,18]
    SEROUT txPIN, Baud19200, [noparse][[/noparse]148," PH",157,DEC ADres]
    PAUSE 200
    SEROUT txPIN, Baud19200, [noparse][[/noparse]22]
    GOTO START ' Repeat forever
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-11-14 23:02
    With 8-bits, full-scale (5V) = 255;·so 1.4V·=·28% of 5V, 255 * 0.28 = 71

    It's not going to bounce back with volts, but how many parts (of full-scale.)· Get it?
  • MARKYODB2MARKYODB2 Posts: 5
    edited 2009-11-14 23:06
    ok completely understand that thanks!

    It does not stay at 71 all the time it fluctuates a few different numbers. Do you know how to take the average of 4 readings then display this. im not getting accurate readings by doing my division scale. as to converting to a actual ph number.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-11-14 23:15
    Short lead length to the ADC input will help.

    Read PBASIC Help, it's pretty easy to take a reading and sum it with another and divide it by two.· Do a couple of digits or "error" make a difference?
  • MARKYODB2MARKYODB2 Posts: 5
    edited 2009-11-14 23:22
    ADres VAR Byte ' A/D result (8 bits)
    ADcs CON 13 ' A/D enable (low true)
    ADdat CON 14 ' A/D data line
    ADclk CON 15 ' A/D clock
    pH VAR Byte
    mV VAR Byte
    Kal CON 14961 ' Constant to be determined.
    txPIN CON 0
    Baud19200 CON 32
    DEBUG CLS
    I am trying now to display the results of a ph of seven by (2.110 is 42.2% of 5V) and .422 in fraction is 211/500.
    the result is displaying 0 ph. how is that possible? or is there a way to set up a calculation as to ph = ADres*55.85(ph levels)?

    START: LOW ADcs ' Enable ADC
    SHIFTIN ADdat,ADclk,MSBPOST,[noparse][[/noparse]ADres\9] ' Shift in the data
    HIGH ADcs' Disable ADC
    DEBUG ?ADres ' Display the result
    PAUSE 1000 ' Wait a 0.1 Seconds
    SEROUT txPIN, Baud19200, [noparse][[/noparse]22,12,18]
    SEROUT txPIN, Baud19200, [noparse][[/noparse]" TEMP ","."," F",148," PH",157,DEC ADres*(211/500)]
    PAUSE 200
    SEROUT txPIN, Baud19200, [noparse][[/noparse]22]
    GOTO START ' Repeat forever
Sign In or Register to comment.